Openai Supported AI Providers [fireworks.ai] #779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the change
I was testing fireworks AI to create the embedding, and it threw an error due to an extra parameter (
user
) being included in the request body even when it was an empty string. This PR modifies the code to ensure theuser
parameter is omitted when it is empty, aligning with fireworks AI's requirements.Provide OpenAI documentation link
Relevant API documentation can be found here.
Describe your solution
The solution involves adding the
omitempty
JSON tag to theuser
field in theEmbeddingRequest
struct. This ensures that if theuser
field is empty, it will not be included in the JSON payload sent to the API. This change allows the request to be accepted by fireworks AI without triggering an error due to an emptyuser
field.Tests
I tested the change by making a request to the fireworks AI API using the modified code and verified that the request was successful. The test involved creating an embedding with the following details:
Additional context
Example error response before the fix:
Example successful response after the fix:
go code