Spaces:
Runtime error
Runtime error
Update Agent.py
Browse files
Agent.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from langchain.tools import Tool
|
| 2 |
from langgraph.graph import StateGraph, END
|
| 3 |
from langchain.agents import AgentExecutor, initialize_agent
|
|
@@ -5,7 +6,6 @@ from langchain.memory import ConversationBufferMemory
|
|
| 5 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 6 |
from langchain.schema import SystemMessage
|
| 7 |
from langchain.schema.messages import HumanMessage
|
| 8 |
-
from langchain_huggingface import ChatHuggingFace
|
| 9 |
GAIA_SYSTEM_PROMPT = """
|
| 10 |
You are an advanced autonomous agent designed to pass the GAIA benchmark.
|
| 11 |
You must:
|
|
@@ -23,21 +23,14 @@ Available tools:
|
|
| 23 |
|
| 24 |
Think aloud and explain your process clearly.
|
| 25 |
"""
|
| 26 |
-
|
| 27 |
-
import
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=1024)
|
| 36 |
-
|
| 37 |
-
# Create the LangChain chat wrapper
|
| 38 |
-
llm = ChatHuggingFace(pipeline=pipe)
|
| 39 |
-
|
| 40 |
-
|
| 41 |
messages = [
|
| 42 |
SystemMessage(content=GAIA_SYSTEM_PROMPT)
|
| 43 |
]
|
|
|
|
| 1 |
+
import os
|
| 2 |
from langchain.tools import Tool
|
| 3 |
from langgraph.graph import StateGraph, END
|
| 4 |
from langchain.agents import AgentExecutor, initialize_agent
|
|
|
|
| 6 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 7 |
from langchain.schema import SystemMessage
|
| 8 |
from langchain.schema.messages import HumanMessage
|
|
|
|
| 9 |
GAIA_SYSTEM_PROMPT = """
|
| 10 |
You are an advanced autonomous agent designed to pass the GAIA benchmark.
|
| 11 |
You must:
|
|
|
|
| 23 |
|
| 24 |
Think aloud and explain your process clearly.
|
| 25 |
"""
|
| 26 |
+
google_api_key = os.environ.get("GOOGLE_API_KEY")
|
| 27 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 28 |
+
llm = ChatGoogleGenerativeAI(
|
| 29 |
+
model="gemini-pro",
|
| 30 |
+
google_api_key=google_api_key,
|
| 31 |
+
temperature=0.2,
|
| 32 |
+
max_output_tokens=1024
|
| 33 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
messages = [
|
| 35 |
SystemMessage(content=GAIA_SYSTEM_PROMPT)
|
| 36 |
]
|