Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
# app.py
|
2 |
# Multi-Agent Chatbot with LangGraph, DeepSeek-R1, Function Calls, and Agentic RAG
|
3 |
# Using local (in-memory) Chroma to avoid tenant errors.
|
|
|
|
|
4 |
|
5 |
import os
|
6 |
import re
|
@@ -45,7 +47,7 @@ development_texts = [
|
|
45 |
# --- Chroma Client Settings (in-memory) ---
|
46 |
client_settings = Settings(
|
47 |
chroma_api_impl="local",
|
48 |
-
persist_directory=None # Use None for ephemeral in-memory DB; or specify a folder
|
49 |
)
|
50 |
|
51 |
# --- Preprocessing & Embeddings ---
|
@@ -89,7 +91,7 @@ development_tool = create_retriever_tool(
|
|
89 |
tools = [research_tool, development_tool]
|
90 |
|
91 |
# --- Agent and Workflow Functions ---
|
92 |
-
#
|
93 |
class AgentState(TypedDict):
|
94 |
messages: Annotated[Sequence[AIMessage | HumanMessage], add_messages]
|
95 |
|
@@ -300,7 +302,7 @@ def main():
|
|
300 |
with st.spinner("Processing your question..."):
|
301 |
events = process_question(query, app_workflow, {"configurable": {"thread_id": "1"}})
|
302 |
for event in events:
|
303 |
-
#
|
304 |
if 'agent' in event:
|
305 |
with st.expander("🔄 Processing Step", expanded=True):
|
306 |
content = event['agent']['messages'][0].content
|
|
|
1 |
# app.py
|
2 |
# Multi-Agent Chatbot with LangGraph, DeepSeek-R1, Function Calls, and Agentic RAG
|
3 |
# Using local (in-memory) Chroma to avoid tenant errors.
|
4 |
+
#
|
5 |
+
# Ensure that the environment variables OPENAI_API_KEY and DEEP_SEEK_API are set in your HF Space Secrets.
|
6 |
|
7 |
import os
|
8 |
import re
|
|
|
47 |
# --- Chroma Client Settings (in-memory) ---
|
48 |
client_settings = Settings(
|
49 |
chroma_api_impl="local",
|
50 |
+
persist_directory=None # Use None for ephemeral in-memory DB; or specify a folder to persist data.
|
51 |
)
|
52 |
|
53 |
# --- Preprocessing & Embeddings ---
|
|
|
91 |
tools = [research_tool, development_tool]
|
92 |
|
93 |
# --- Agent and Workflow Functions ---
|
94 |
+
# Use only AIMessage and HumanMessage for message types.
|
95 |
class AgentState(TypedDict):
|
96 |
messages: Annotated[Sequence[AIMessage | HumanMessage], add_messages]
|
97 |
|
|
|
302 |
with st.spinner("Processing your question..."):
|
303 |
events = process_question(query, app_workflow, {"configurable": {"thread_id": "1"}})
|
304 |
for event in events:
|
305 |
+
# Display processing steps
|
306 |
if 'agent' in event:
|
307 |
with st.expander("🔄 Processing Step", expanded=True):
|
308 |
content = event['agent']['messages'][0].content
|