File size: 1,122 Bytes
ed09e37
b0c4e8b
 
 
 
 
 
9660daf
b0c4e8b
1eb7123
1b5c4ff
9660daf
 
 
 
 
 
 
 
 
b0c4e8b
 
 
 
 
42ed707
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import asyncio
import nest_asyncio
from llama_index.core.agent.workflow import AgentWorkflow
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
from llama_index.llms.openai import OpenAI


async def smart_agent():
    # api_key = os.getenv("HF_TOKEN")
    OpenAI_key = os.getenv("OPEN_AI_TOKEN")
    # llm = HuggingFaceInferenceAPI(
    #     model_name="deepseek-ai/DeepSeek-R1-0528", 
    #     token=api_key,
    #     provider="auto",
    #     max_iterations=10
    #     )
    llm = OpenAI(model="gpt-4o-mini", temperature=0.2, api_key=OpenAI_key)
    # Create Alfred, our gala agent, with the guest info tool
    llamaindex_agent = AgentWorkflow.from_tools_or_functions(
        [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
        llm=llm,
    )
    return llamaindex_agent