Update agent.py
Browse files
agent.py
CHANGED
|
@@ -10,7 +10,7 @@ from langgraph.prebuilt import tools_condition
|
|
| 10 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 11 |
from langfuse.callback import CallbackHandler
|
| 12 |
|
| 13 |
-
from tools import ExtractTextFromImage, DescribeImage, TranscribeAudio, read_excel, read_python, wiki_search, web_search, arxiv_search
|
| 14 |
|
| 15 |
|
| 16 |
class AgentState(TypedDict):
|
|
@@ -19,13 +19,14 @@ class AgentState(TypedDict):
|
|
| 19 |
|
| 20 |
class BasicAgent():
|
| 21 |
def __init__(self, chat):
|
| 22 |
-
self.
|
| 23 |
|
| 24 |
-
extract_text_from_image = tool(ExtractTextFromImage(self.
|
| 25 |
-
describe_image = tool(DescribeImage(self.
|
| 26 |
-
transcribe_audio = tool(TranscribeAudio(self.
|
|
|
|
| 27 |
|
| 28 |
-
self.tools = [extract_text_from_image, describe_image, transcribe_audio, read_excel, read_python, wiki_search, web_search, arxiv_search]
|
| 29 |
self.chat_with_tools = chat.bind_tools(self.tools)
|
| 30 |
self._initialize_graph()
|
| 31 |
self._initialize_telemetry()
|
|
|
|
| 10 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 11 |
from langfuse.callback import CallbackHandler
|
| 12 |
|
| 13 |
+
from tools import ExtractTextFromImage, DescribeImage, TranscribeAudio, AnalyzeVideo, read_excel, read_python, wiki_search, web_search, arxiv_search, download_youtube_video
|
| 14 |
|
| 15 |
|
| 16 |
class AgentState(TypedDict):
|
|
|
|
| 19 |
|
| 20 |
class BasicAgent():
|
| 21 |
def __init__(self, chat):
|
| 22 |
+
self.multimodal_model = ChatOpenAI(model="gpt-4o")
|
| 23 |
|
| 24 |
+
extract_text_from_image = tool(ExtractTextFromImage(self.multimodal_model).__call__)
|
| 25 |
+
describe_image = tool(DescribeImage(self.multimodal_model).__call__)
|
| 26 |
+
transcribe_audio = tool(TranscribeAudio(self.multimodal_model).__call__)
|
| 27 |
+
analyze_video = tool(AnalyzeVideo(self.multimodal_model).__call__)
|
| 28 |
|
| 29 |
+
self.tools = [extract_text_from_image, describe_image, transcribe_audio, analyze_video, read_excel, read_python, wiki_search, web_search, arxiv_search, download_youtube_video]
|
| 30 |
self.chat_with_tools = chat.bind_tools(self.tools)
|
| 31 |
self._initialize_graph()
|
| 32 |
self._initialize_telemetry()
|