Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import os
|
|
|
|
|
|
|
| 2 |
from langgraph.graph import START, StateGraph, MessagesState
|
| 3 |
from langgraph.prebuilt import tools_condition
|
| 4 |
from langgraph.prebuilt import ToolNode
|
|
@@ -103,8 +105,10 @@ def build_graph(provider: str = "google"):
|
|
| 103 |
llm_with_tools = llm.bind_tools(tools)
|
| 104 |
|
| 105 |
def assistant(state: MessagesState):
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
|
| 110 |
builder = StateGraph(MessagesState)
|
|
|
|
| 1 |
import os
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
from langgraph.graph import START, StateGraph, MessagesState
|
| 5 |
from langgraph.prebuilt import tools_condition
|
| 6 |
from langgraph.prebuilt import ToolNode
|
|
|
|
| 105 |
llm_with_tools = llm.bind_tools(tools)
|
| 106 |
|
| 107 |
def assistant(state: MessagesState):
|
| 108 |
+
""" Use the tools to answer the query. you have add,subtract,multiply,divide,web_search,wikipedia_search,arxiv_search tools."""
|
| 109 |
+
response = llm_with_tools.invoke([system_message]+state["messages"])
|
| 110 |
+
time.sleep(5) # 무료 티어의 한계
|
| 111 |
+
return {"messages": state["messages"] + [response)]}
|
| 112 |
|
| 113 |
|
| 114 |
builder = StateGraph(MessagesState)
|