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

add initial support for Fireworks provider #16

Merged
merged 24 commits into from
Mar 17, 2025
Merged

add initial support for Fireworks provider #16

merged 24 commits into from
Mar 17, 2025

Conversation

ofou
Copy link
Collaborator

@ofou ofou commented Mar 12, 2025

Adds support for the Fireworks AI platform as a new provider option, specifically integrating the deepseek-r1 model via the Fireworks. This addition expands our available providers options, giving users access to more powerful reasoning capabilities, particularly with DeepSeek's large context window of 160k tokens, but faster with Fireworks.

The implementation follows existing provider architecture pattern while adding Fireworks-specific adaptations:

  • Added new FireworksHandler class that implements the ApiHandler interface
  • Created a custom stream handling mechanism for Fireworks SSE responses with proper error handling
  • Added special handling for DeepSeek models which may require different message formatting and parameters for temperature (recommended)
  • Defined Fireworks model configuration in shared API types
  • Added retry logic to handle potential API failures
  • Integrated the handler into our existing provider selection system
  • Added appropriate configuration options including the Fireworks API key

The implementation uses the OpenAI compatible library with Fireworks.

@ofou ofou self-assigned this Mar 12, 2025
@ofou
Copy link
Collaborator Author

ofou commented Mar 13, 2025

It's only supporting deepseek-v3 and deepseek-r1. I tried to follow former Provider implementations

If you need a Fireworks key to test this, ping me on slack :)

@ofou ofou marked this pull request as ready for review March 13, 2025 13:33
@@ -0,0 +1,786 @@
// npx jest src/api/providers/__tests__/fireworks.test.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked too deeply yet, but why is this file so much longer than most of the other tests in /src/api/providers/__tests__? Just wondering if there are some unnecessary tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No one has ever claimed to have enough tests... but Kilocode helped me with this 😉. I also borrowed some inspiration from other implementations, but there are a few special cases, such as the </thinking> tokens from DeepSeek's models in the response

Copy link
Collaborator

@janpaul123 janpaul123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me know, aside from some git hygiene. I'll let @kevinvandijk also have a look, and maybe he can show you how to do better git hygiene, because he's good at that. Overall, nice, let's ship this soon!

@ofou ofou merged commit 1d6cbe6 into main Mar 17, 2025
6 checks passed
@ofou ofou deleted the fireworks branch March 17, 2025 14:18
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

Successfully merging this pull request may close these issues.

4 participants