File size: 802 Bytes
3392ab1
 
 
 
 
 
 
 
 
 
 
 
4583e4d
3392ab1
 
 
 
 
 
 
 
4583e4d
3392ab1
 
 
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
import os
from autogen import AssistantAgent, UserProxyAgent
import streamlit as st


class CAGLLMChat:
    def __init__(self,llm_config,problem):
        self.llm_config = llm_config
        self.problem = problem

    
    def start_chat(self):
        llm_config= st.session_state['llm_config']
        problem = self.problem
        assistant = AssistantAgent("assistant", llm_config=llm_config,code_execution_config=False,human_input_mode='NEVER')
        user_proxy = UserProxyAgent("user_proxy", code_execution_config=False,human_input_mode='NEVER')

        # Start the chat
        response = user_proxy.initiate_chat(
            assistant,
            message=problem,
            max_turns=2,
            clear_history=st.session_state["chat_with_history"]
        )
        return response