Update agent.py
Browse files
agent.py
CHANGED
|
@@ -4,7 +4,8 @@ from langgraph.prebuilt import ToolNode
|
|
| 4 |
from langgraph.graph import START, StateGraph
|
| 5 |
from langgraph.prebuilt import tools_condition
|
| 6 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 7 |
-
from tools import
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
class AgentState(TypedDict):
|
|
@@ -12,9 +13,13 @@ class AgentState(TypedDict):
|
|
| 12 |
|
| 13 |
|
| 14 |
class Agent():
|
| 15 |
-
def __init__(self, llm
|
| 16 |
chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
self._initialize_graph()
|
| 19 |
|
| 20 |
def _initialize_graph(self):
|
|
|
|
| 4 |
from langgraph.graph import START, StateGraph
|
| 5 |
from langgraph.prebuilt import tools_condition
|
| 6 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 7 |
+
from tools import extract_text
|
| 8 |
+
from langchain_community.tools import DuckDuckGoSearchRun
|
| 9 |
|
| 10 |
|
| 11 |
class AgentState(TypedDict):
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
class Agent():
|
| 16 |
+
def __init__(self, llm):
|
| 17 |
chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 18 |
+
|
| 19 |
+
search_tool = DuckDuckGoSearchRun()
|
| 20 |
+
vision_llm = ChatOpenAI(model="gpt-4o")
|
| 21 |
+
|
| 22 |
+
chat_with_tools = chat.bind_tools([extract_text,search_tool])
|
| 23 |
self._initialize_graph()
|
| 24 |
|
| 25 |
def _initialize_graph(self):
|