Spaces:
Configuration error
Configuration error
Upload agent.py
Browse files
agent.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
-
from llama_index.llms.openai import OpenAI
|
| 2 |
-
from llama_index.llms.gemini import Gemini # Import the Gemini LLM
|
| 3 |
from llama_index.tools.wikipedia.base import WikipediaToolSpec
|
| 4 |
from llama_index.core.llms import ChatMessage
|
| 5 |
from llama_index.core.agent import ReActAgent
|
|
@@ -70,15 +69,10 @@ class CuongBasicAgent:
|
|
| 70 |
Below is the current conversation consisting of interleaving human and assistant messages.
|
| 71 |
"""
|
| 72 |
react_system_prompt = PromptTemplate(system_prompt)
|
| 73 |
-
|
| 74 |
-
#
|
| 75 |
-
# Make sure you have your GOOGLE_API_KEY set as an environment variable
|
| 76 |
-
llm = Gemini(model='gemini-2.0-flash', api_key=os.getenv("GOOGLE_API_KEY"))
|
| 77 |
-
# 'gemini-pro' is a commonly used model for general tasks.
|
| 78 |
-
# You might also use 'gemini-1.5-pro' for larger contexts.
|
| 79 |
-
# Check the official Google Gemini API documentation for available model names.
|
| 80 |
-
# --- END CHANGE ---
|
| 81 |
|
|
|
|
| 82 |
agent = ReActAgent.from_tools(
|
| 83 |
llm=llm,
|
| 84 |
tools=WikipediaToolSpec().to_tool_list() + TavilyToolSpec(api_key=os.getenv('TAVILY_API_KEY')).to_tool_list(),
|
|
|
|
| 1 |
+
from llama_index.llms.openai import OpenAI
|
|
|
|
| 2 |
from llama_index.tools.wikipedia.base import WikipediaToolSpec
|
| 3 |
from llama_index.core.llms import ChatMessage
|
| 4 |
from llama_index.core.agent import ReActAgent
|
|
|
|
| 69 |
Below is the current conversation consisting of interleaving human and assistant messages.
|
| 70 |
"""
|
| 71 |
react_system_prompt = PromptTemplate(system_prompt)
|
| 72 |
+
#llm = DeepInfraLLM(
|
| 73 |
+
# model="meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",api_key=os.getenv("DEEPINFRA_API_KEY"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
llm = OpenAI(model='gpt-4.1', api_key=os.getenv("OPENAI_API_KEY"))
|
| 76 |
agent = ReActAgent.from_tools(
|
| 77 |
llm=llm,
|
| 78 |
tools=WikipediaToolSpec().to_tool_list() + TavilyToolSpec(api_key=os.getenv('TAVILY_API_KEY')).to_tool_list(),
|