Update agent.py
Browse files
agent.py
CHANGED
|
@@ -4,7 +4,7 @@ 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 |
from langchain_openai import ChatOpenAI
|
| 9 |
from typing import TypedDict, Annotated, Optional
|
| 10 |
|
|
@@ -15,7 +15,10 @@ class AgentState(TypedDict):
|
|
| 15 |
|
| 16 |
class BasicAgent():
|
| 17 |
def __init__(self, chat, vision_llm):
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
self.chat_with_tools = chat.bind_tools(self.tools)
|
| 20 |
self._initialize_graph()
|
| 21 |
print("BasicAgent initialized.")
|
|
|
|
| 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 ExtractTextFromImage, DescribeImage, read_excel, read_python, wiki_search, web_search, arxiv_search
|
| 8 |
from langchain_openai import ChatOpenAI
|
| 9 |
from typing import TypedDict, Annotated, Optional
|
| 10 |
|
|
|
|
| 15 |
|
| 16 |
class BasicAgent():
|
| 17 |
def __init__(self, chat, vision_llm):
|
| 18 |
+
extract_text_from_image = ExtractTextFromImage(vision_llm)
|
| 19 |
+
describe_image = DescribeImage(vision_llm)
|
| 20 |
+
|
| 21 |
+
self.tools = [extract_text_from_image, describe_image, read_excel, read_python, wiki_search, web_search, arxiv_search]
|
| 22 |
self.chat_with_tools = chat.bind_tools(self.tools)
|
| 23 |
self._initialize_graph()
|
| 24 |
print("BasicAgent initialized.")
|