Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -5,17 +5,19 @@ from llama_index.core.agent.workflow import AgentWorkflow
|
|
| 5 |
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
| 6 |
from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
|
| 7 |
from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
async def smart_agent() -> AgentWorkflow:
|
| 11 |
-
api_key = os.getenv("HF_TOKEN")
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
# Create Alfred, our gala agent, with the guest info tool
|
| 20 |
llamaindex_agent = AgentWorkflow.from_tools_or_functions(
|
| 21 |
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|
|
|
|
| 5 |
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
| 6 |
from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
|
| 7 |
from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
|
| 8 |
+
from llama_index.llms.openai import OpenAI
|
| 9 |
|
| 10 |
|
| 11 |
async def smart_agent() -> AgentWorkflow:
|
| 12 |
+
# api_key = os.getenv("HF_TOKEN")
|
| 13 |
+
OpenAI_key = os.getenv("OPEN_AI_TOKEN")
|
| 14 |
+
# llm = HuggingFaceInferenceAPI(
|
| 15 |
+
# model_name="deepseek-ai/DeepSeek-R1-0528",
|
| 16 |
+
# token=api_key,
|
| 17 |
+
# provider="auto",
|
| 18 |
+
# max_iterations=10
|
| 19 |
+
# )
|
| 20 |
+
llm = OpenAI(model="gpt-4o-mini", temperature=0.2, api_key=OpenAI_key)
|
| 21 |
# Create Alfred, our gala agent, with the guest info tool
|
| 22 |
llamaindex_agent = AgentWorkflow.from_tools_or_functions(
|
| 23 |
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|