File size: 1,170 Bytes
4d969ce
 
 
 
 
ed306c8
1923ab6
722929d
ed306c8
4d969ce
 
 
ed306c8
7ddfa83
4d969ce
 
 
 
d8a9c24
eda68a5
 
ed306c8
7ddfa83
4d969ce
 
722929d
4d969ce
722929d
 
d56f6b1
4d969ce
d56f6b1
4d969ce
7ddfa83
4d969ce
 
 
f2d10d1
722929d
7ddfa83
4d969ce
ed306c8
4d969ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from autogen import ConversableAgent, AssistantAgent
from autogen.coding import LocalCommandLineCodeExecutor

#import os
#from IPython.display import Image

def run_multi_agent(llm, message):
    llm_config = {"model": llm}
    
    executor = LocalCommandLineCodeExecutor(
        timeout=60,
        work_dir="coding",
    )
    
    code_executor_agent = ConversableAgent(
        name="code_executor_agent",
        llm_config=False,
        code_execution_config={"executor": executor},
        human_input_mode="NEVER",
        default_auto_reply=
        "Please continue. If everything is done, reply 'TERMINATE'.",
    )
    
    code_writer_agent = AssistantAgent(
        name="code_writer_agent",
        llm_config=llm_config,
        code_execution_config=False,
        human_input_mode="NEVER",
    )
    
    code_writer_agent_system_message = code_writer_agent.system_message
    
    print(code_writer_agent_system_message)
    
    chat_result = code_executor_agent.initiate_chat(
        code_writer_agent,
        message=message,
        max_turns=10
    )
    
    #Image(os.path.join("coding", "ytd_stock_gains.png"))
    
    return chat_result