File size: 745 Bytes
5b7c4fe
 
 
 
abe1b53
5b7c4fe
abe1b53
5b7c4fe
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from dotenv import load_dotenv
from smolagents import CodeAgent, DuckDuckGoSearchTool
from smolagents.models import AzureOpenAIServerModel

load_dotenv()

if __name__ == "__main__":
    # model = HfApiModel()
    model = AzureOpenAIServerModel(
        model_id="gpt-4o",
        api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
        api_version=os.environ.get("OPENAI_API_VERSION"),
        azure_endpoint=os.environ.get("AZURE_OPENAI_API_ENDPOINT"),
        # custom_role_conversions={"system": "assistant", "tool-call": "assistant", "tool-response": "user"}
    )
    agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model, add_base_tools=True)
    agent.run("Could you give me the 118th number in the Fibonacci sequence?")