Spaces:
Runtime error
Runtime error
- real_agent.py +4 -5
real_agent.py
CHANGED
|
@@ -7,7 +7,7 @@ from langgraph.prebuilt import tools_condition
|
|
| 7 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 8 |
from langchain_openai import ChatOpenAI
|
| 9 |
import os
|
| 10 |
-
from tools import hub_stats_tool, extract_image_text, add, divide, multiply, subtract, calculate_cargo_travel_time, web_search_tool, wiki_search_tool, arvix_search_tool
|
| 11 |
from retriever import guest_info_tool
|
| 12 |
import gradio as gr
|
| 13 |
from langfuse.langchain import CallbackHandler
|
|
@@ -18,7 +18,7 @@ with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
| 18 |
system_prompt = f.read()
|
| 19 |
|
| 20 |
# System message
|
| 21 |
-
|
| 22 |
|
| 23 |
|
| 24 |
|
|
@@ -30,7 +30,6 @@ with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
| 30 |
|
| 31 |
def call_build():
|
| 32 |
|
| 33 |
-
|
| 34 |
# Initialize the web search tool
|
| 35 |
# search_tool = GoogleSearchTool(provider = "serpapi")
|
| 36 |
# search_tool.name = "GoogleSearchTool"
|
|
@@ -39,7 +38,7 @@ def call_build():
|
|
| 39 |
# Generate the chat interface, including the tools
|
| 40 |
|
| 41 |
chat = ChatOpenAI(model="gpt-4o")
|
| 42 |
-
tools = [guest_info_tool, hub_stats_tool, extract_image_text, add, divide, multiply, subtract, calculate_cargo_travel_time, web_search_tool, wiki_search_tool, arvix_search_tool]
|
| 43 |
chat_with_tools = chat.bind_tools(tools)
|
| 44 |
|
| 45 |
# Generate the AgentState and Agent graph
|
|
@@ -50,7 +49,7 @@ def call_build():
|
|
| 50 |
return {
|
| 51 |
"messages": [chat_with_tools.invoke(state["messages"])],
|
| 52 |
}
|
| 53 |
-
|
| 54 |
## The graph
|
| 55 |
builder = StateGraph(AgentState)
|
| 56 |
|
|
|
|
| 7 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 8 |
from langchain_openai import ChatOpenAI
|
| 9 |
import os
|
| 10 |
+
from tools import hub_stats_tool, extract_image_text, add, divide, multiply, subtract, calculate_cargo_travel_time, web_search_tool, wiki_search_tool, arvix_search_tool, excel_search_tool
|
| 11 |
from retriever import guest_info_tool
|
| 12 |
import gradio as gr
|
| 13 |
from langfuse.langchain import CallbackHandler
|
|
|
|
| 18 |
system_prompt = f.read()
|
| 19 |
|
| 20 |
# System message
|
| 21 |
+
|
| 22 |
|
| 23 |
|
| 24 |
|
|
|
|
| 30 |
|
| 31 |
def call_build():
|
| 32 |
|
|
|
|
| 33 |
# Initialize the web search tool
|
| 34 |
# search_tool = GoogleSearchTool(provider = "serpapi")
|
| 35 |
# search_tool.name = "GoogleSearchTool"
|
|
|
|
| 38 |
# Generate the chat interface, including the tools
|
| 39 |
|
| 40 |
chat = ChatOpenAI(model="gpt-4o")
|
| 41 |
+
tools = [guest_info_tool, hub_stats_tool, excel_search_tool, extract_image_text, add, divide, multiply, subtract, calculate_cargo_travel_time, web_search_tool, wiki_search_tool, arvix_search_tool]
|
| 42 |
chat_with_tools = chat.bind_tools(tools)
|
| 43 |
|
| 44 |
# Generate the AgentState and Agent graph
|
|
|
|
| 49 |
return {
|
| 50 |
"messages": [chat_with_tools.invoke(state["messages"])],
|
| 51 |
}
|
| 52 |
+
sys_msg = SystemMessage(content=system_prompt)
|
| 53 |
## The graph
|
| 54 |
builder = StateGraph(AgentState)
|
| 55 |
|