miffy
February 24, 2025, 3:46pm
1
Hey guys I’m trying to call models through deepinfra in my agent but it’s technically not supported in the documentation. I saw that Fireworks is an option, but is there any way I could follow a format and do the same as Fireworks but with Deepinfra?
Thanks!
@miffy I have a PR up that adds DeepInfra support to Agno. I’m unsure if they will merge it though. I’m currently working off my personal fork until it’s merged.
main
← berrydev-ai:feature/deepinfra
opened 05:15PM - 20 Feb 25 UTC
## Description
- **Summary of changes**:
This PR introduces a new DeepIn… fra model integration into Agno along with several cookbook examples demonstrating asynchronous and synchronous usage, tool integration, and JSON output. It also updates the documentation within the DeepInfra model implementation to clarify attributes and usage. Finally, the PR adds reasoning support for OpenAILike reasoning models by extending the agent’s reasoning logic to handle DeepSeek-based models.
- **Related issues**:
This PR may be related to [PR #2193](https://github.com/agno-agi/agno/pull/2193)
- **Motivation and context**:
The changes enhance Agno's support for DeepInfra's text generation models, enabling users to integrate and experiment with these models seamlessly. Adding comprehensive cookbook examples and improved documentation helps users understand how to configure and run DeepInfra agents, including advanced scenarios such as tool usage and JSON-formatted responses. Furthermore, the reasoning support extension ensures that agents leveraging OpenAILike models (with DeepSeek reasoning models) can produce more reliable and contextually relevant outputs.
- **Environment or dependencies**:
- Requires setting the `DEEPINFRA_API_KEY` environment variable for authentication.
- No breaking dependency changes; ensure the virtual environment is updated as per the new cookbook instructions.
- **Impact on metrics**:
While there are no direct performance benchmarks updated by these changes, the integration and reasoning improvements are expected to enhance the overall quality and reliability of model outputs in Agno.
---
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] Model update (Addition or modification of models)
- [ ] Other (please describe):
---
## Checklist
- [x] Adherence to standards: Code complies with Agno's style guidelines and best practices.
- [x] Formatting and validation: `./scripts/format.sh` and `./scripts/validate.sh` have been run to ensure code is formatted and linted.
- [x] Self-review completed: A thorough review has been performed by the contributor(s).
- [x] Documentation: Docstrings and inline comments have been added or updated for any complex logic.
- [x] Examples and guides: Relevant cookbook examples have been included and updated.
- [x] Tested in a clean environment: Changes have been tested in a clean environment to confirm expected behavior.
- [ ] Tests (optional): Tests have been added or updated to cover any new or changed functionality.
---
## Additional Notes
- Ensure that users set the `DEEPINFRA_API_KEY` environment variable as documented in the new cookbook examples.
- The reasoning support for OpenAILike models now includes handling for DeepSeek models by checking if the model id contains "deepseek" and adjusting the reasoning agent accordingly.
- No changes to existing functionality outside of the DeepInfra integration and reasoning logic.
miffy
February 25, 2025, 6:55pm
3
Thank you so much, I also figured out I can just run the following in the agent and it works too if anyone is looking for a quick fix.
from agno.agent import Agent
from agno.models.openai.like import OpenAILike
agent = Agent(
model=OpenAILike(
id="deepseek-ai/DeepSeek-V3",
api_key=DEEPINFRA_API_KEY,
base_url="https://api.deepinfra.com/v1/openai/",
),
)
agent.print_response("Hello World!", stream=True)