Mohammad Haghir commited on
Commit ·
5529ddf
1
Parent(s): 21d5b3a
tool update
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
| 6 |
# import re
|
| 7 |
# import json
|
| 8 |
from typing_extensions import TypedDict
|
| 9 |
-
|
| 10 |
|
| 11 |
import operator
|
| 12 |
from typing import Annotated
|
|
@@ -28,7 +28,7 @@ tools = [wiki_ret, arxiv_ret, tavily_ret, handle_file_tool]
|
|
| 28 |
llm = ChatGroq(api_key=groq_api_key, model="gemma2-9b-it")
|
| 29 |
llm_with_tools = llm.bind_tools(tools)
|
| 30 |
class GraphState(TypedDict):
|
| 31 |
-
messages:
|
| 32 |
context: str
|
| 33 |
|
| 34 |
# --- Basic Agent Definition ---
|
|
@@ -74,7 +74,7 @@ class BasicAgent:
|
|
| 74 |
# Call the LLM
|
| 75 |
messages = [HumanMessage(content=prompt)]
|
| 76 |
print("messages: ", messages)
|
| 77 |
-
response =
|
| 78 |
print("response: ", response)
|
| 79 |
# cleaned_text = re.sub(r"<think>.*?</think>", "", response.content, flags=re.DOTALL)
|
| 80 |
|
|
|
|
| 6 |
# import re
|
| 7 |
# import json
|
| 8 |
from typing_extensions import TypedDict
|
| 9 |
+
from typing import Dict
|
| 10 |
|
| 11 |
import operator
|
| 12 |
from typing import Annotated
|
|
|
|
| 28 |
llm = ChatGroq(api_key=groq_api_key, model="gemma2-9b-it")
|
| 29 |
llm_with_tools = llm.bind_tools(tools)
|
| 30 |
class GraphState(TypedDict):
|
| 31 |
+
messages: Annotated[Dict, operator.add]
|
| 32 |
context: str
|
| 33 |
|
| 34 |
# --- Basic Agent Definition ---
|
|
|
|
| 74 |
# Call the LLM
|
| 75 |
messages = [HumanMessage(content=prompt)]
|
| 76 |
print("messages: ", messages)
|
| 77 |
+
response = llm_with_tools.invoke(messages)
|
| 78 |
print("response: ", response)
|
| 79 |
# cleaned_text = re.sub(r"<think>.*?</think>", "", response.content, flags=re.DOTALL)
|
| 80 |
|