Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call OpenAI-like models through an API? #2

Open
win4r opened this issue Dec 27, 2024 · 2 comments
Open

How to call OpenAI-like models through an API? #2

win4r opened this issue Dec 27, 2024 · 2 comments

Comments

@win4r
Copy link

win4r commented Dec 27, 2024

How to call OpenAI-like models through an API?

@holazzer
Copy link

You can use the LiteLLMModel which is a wrapper using litellm.

@aymeric-roucher
Copy link
Collaborator

Hellow @win4r!

You can use our LiteLLM integration and just specify the model_id of your model:

from smolagents import LiteLLMModel
model = LiteLLMModel(model_id="gpt-4o")

Then just start an agent with this:

from smolagents import CodeAgent

agent = CodeAgent(tools=[], model=model)

agent.run("What's the 20th number in the Fibonacci sequence?")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants