Spaces:
Sleeping
Sleeping
Download src/usecases/cag_chat.py from genaitiwari/AutogenMultiAgent: direct link, hf CLI and curl.
- Browser
- Download file 802 Bytes
-
https://huggingface.co/spaces/genaitiwari/AutogenMultiAgent/resolve/main/src/usecases/cag_chat.py
- Command line
-
hf download hf://spaces/genaitiwari/AutogenMultiAgent/src/usecases/cag_chat.py
-
curl -L -o cag_chat.py https://huggingface.co/spaces/genaitiwari/AutogenMultiAgent/resolve/main/src/usecases/cag_chat.py
802 Bytes
| 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 |