Spaces:
Configuration error
Configuration error
Enrico Mannarino commited on
Commit ·
852ec49
1
Parent(s): cadf170
dajeee
Browse files
agent.py
CHANGED
|
@@ -11,6 +11,8 @@ from langchain_community.tools import DuckDuckGoSearchRun, WikipediaQueryRun, Ar
|
|
| 11 |
from langchain_community.utilities import WikipediaAPIWrapper, ArxivAPIWrapper
|
| 12 |
from langchain_community.tools.wikidata.tool import WikidataAPIWrapper, WikidataQueryRun
|
| 13 |
|
|
|
|
|
|
|
| 14 |
from tools import GetYouTubeTranscriptTool, ImageRecognitionTool
|
| 15 |
from dotenv import load_dotenv
|
| 16 |
import os
|
|
@@ -51,19 +53,16 @@ def build_graph():
|
|
| 51 |
# Otherwise if there is, we continue
|
| 52 |
else:
|
| 53 |
return "continue"
|
| 54 |
-
|
| 55 |
-
model =
|
| 56 |
-
|
| 57 |
-
task="text-generation",
|
| 58 |
-
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
| 59 |
-
)
|
| 60 |
|
| 61 |
tools = [GetYouTubeTranscriptTool(),
|
| 62 |
WikidataQueryRun(api_wrapper=WikidataAPIWrapper()),
|
| 63 |
DuckDuckGoSearchRun(),
|
| 64 |
ArxivQueryRun(api_wrapper=ArxivAPIWrapper()),
|
| 65 |
WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper()),
|
| 66 |
-
ImageRecognitionTool(hf_endpoint=
|
| 67 |
model = model.bind_tools(tools)
|
| 68 |
|
| 69 |
tool_node = ToolNode(tools)
|
|
|
|
| 11 |
from langchain_community.utilities import WikipediaAPIWrapper, ArxivAPIWrapper
|
| 12 |
from langchain_community.tools.wikidata.tool import WikidataAPIWrapper, WikidataQueryRun
|
| 13 |
|
| 14 |
+
from langchain_openai import ChatOpenAI
|
| 15 |
+
|
| 16 |
from tools import GetYouTubeTranscriptTool, ImageRecognitionTool
|
| 17 |
from dotenv import load_dotenv
|
| 18 |
import os
|
|
|
|
| 53 |
# Otherwise if there is, we continue
|
| 54 |
else:
|
| 55 |
return "continue"
|
| 56 |
+
|
| 57 |
+
model = ChatOpenAI(model="o1")
|
| 58 |
+
image_model = ChatOpenAI(model="gpt-4o")
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
tools = [GetYouTubeTranscriptTool(),
|
| 61 |
WikidataQueryRun(api_wrapper=WikidataAPIWrapper()),
|
| 62 |
DuckDuckGoSearchRun(),
|
| 63 |
ArxivQueryRun(api_wrapper=ArxivAPIWrapper()),
|
| 64 |
WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper()),
|
| 65 |
+
ImageRecognitionTool(hf_endpoint=image_model)]
|
| 66 |
model = model.bind_tools(tools)
|
| 67 |
|
| 68 |
tool_node = ToolNode(tools)
|