Spaces:
Sleeping
Sleeping
| 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 |