This is the main agent file for the AIAgents4Pharma.
get_app(uniq_id, llm_model=ChatOpenAI(model='gpt-4o-mini', temperature=0))
This function returns the langraph app.
Source code in aiagents4pharma/talk2aiagents4pharma/agents/main_agent.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | def get_app(uniq_id,
llm_model: BaseChatModel = ChatOpenAI(model='gpt-4o-mini', temperature=0)):
'''
This function returns the langraph app.
'''
# Load hydra configuration
logger.log(logging.INFO, "Launching AIAgents4Pharma_Agent with thread_id %s", uniq_id)
with hydra.initialize(version_base=None, config_path="../configs"):
cfg = hydra.compose(config_name='config',
overrides=['agents/main_agent=default'])
cfg = cfg.agents.main_agent
logger.log(logging.INFO, "System_prompt of T2AA4P: %s", cfg.system_prompt)
# Create supervisor workflow
workflow = create_supervisor(
[
get_app_t2b(uniq_id, llm_model), # Talk2BioModels
get_app_t2kg(uniq_id, llm_model) # Talk2KnowledgeGraphs
],
model=llm_model,
state_schema=Talk2AIAgents4Pharma,
# Full history is needed to extract
# the tool artifacts
output_mode="full_history",
add_handoff_back_messages=False,
prompt=cfg.system_prompt
)
# Compile and run
app = workflow.compile(checkpointer=MemorySaver(),
name="AIAgents4Pharma_Agent")
return app
|