Conversation
|
Caution Review failedThe pull request is closed. Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughCustom types and unmarshalling logic were introduced in the GenAI integration to handle URL-safe base64 blobs and adapt request payloads. The OpenAI integration was updated to assign model parameters directly to struct fields instead of using a generic map, and the response format handling was removed. The Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✨ Finishing Touches
🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
transports/bifrost-http/integrations/openai/types.go (1)
60-63: Avoid emitting an unnecessary emptyextra_paramsobject
ExtraParamsis pre-allocated even when no extra parameters will ultimately be inserted.
Serialising an empty map produces"extra_params":{}in downstream payloads, which is semantically useless and adds bytes on the wire.- params := &schemas.ModelParameters{ - ExtraParams: make(map[string]interface{}), - } + params := &schemas.ModelParameters{}Only allocate the map lazily in the few branches that still rely on it (
n,logprobs, …).
This keeps the JSON lean while preserving behaviour.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
transports/bifrost-http/integrations/genai/types.go(3 hunks)transports/bifrost-http/integrations/openai/types.go(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
transports/bifrost-http/integrations/genai/types.go (1)
core/schemas/bifrost.go (1)
FunctionCall(365-368)
🔇 Additional comments (2)
transports/bifrost-http/integrations/openai/types.go (1)
68-82: Double-check that the Bifrost schema exposes the direct fields you’re populatingThe code now writes directly to
MaxTokens,Temperature,TopP,PresencePenalty, andFrequencyPenalty.
If theschemas.ModelParametersstruct incore/schemashas not yet been augmented with matching pointer fields, these assignments will silently do nothing and the values will be lost.Please verify the struct definition; if the fields do not exist, either add them or fall back to
ExtraParamsfor the time being.transports/bifrost-http/integrations/genai/types.go (1)
58-69: Potential (de)serialisation mismatch for embedded GenAI SDK structs
genai_sdk.VideoMetadata,ExecutableCode, etc. do not carryjsontags.
When the server receives raw JSON,encoding/jsonwill attempt to match on exported field names of those embedded structs, which may not align with the wire protocol and can easily break with upstream SDK changes.Consider wrapping only the minimal fields you actually need in your own DTOs or implement
json.Unmarshaler/MarshaleronCustomPartto take full control of the layout.
0263e2c to
003df5d
Compare
63ba08e to
8a16392
Compare
003df5d to
418d7ae
Compare
8a16392 to
6b47876
Compare
418d7ae to
c80be38
Compare
Merge activity
|
c80be38 to
92a8099
Compare
There was a problem hiding this comment.
Bug: OpenAI Request Format Ignored
The ResponseFormat parameter is no longer processed in the convertParameters method. It was previously stored in params.ExtraParams["response_format"] but is now entirely ignored, causing OpenAI requests to lose this specification and resulting in a loss of functionality.
transports/bifrost-http/integrations/openai/types.go#L102-L106
bifrost/transports/bifrost-http/integrations/openai/types.go
Lines 102 to 106 in 92a8099
BugBot free trial expires on June 17, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
…eter handling (#89) # Add support for URL-safe base64 decoding in Google GenAI requests This PR adds custom types to handle URL-safe base64 encoding in Google GenAI requests. When clients send base64-encoded image data using URL-safe encoding (replacing '/' with '_' and '+' with '-'), the standard decoder fails. The changes include: - Added `CustomBlob` type with custom JSON unmarshalling to handle URL-safe base64 decoding - Created `CustomPart` and `CustomContent` types that wrap the GenAI SDK types - Added conversion methods to transform the custom types back to standard GenAI SDK types - Updated the OpenAI parameter handling to use the proper parameter fields instead of storing values in ExtraParams This ensures proper handling of image data in multimodal requests while maintaining compatibility with the existing API.

Add support for URL-safe base64 decoding in Google GenAI requests
This PR adds custom types to handle URL-safe base64 encoding in Google GenAI requests. When clients send base64-encoded image data using URL-safe encoding (replacing '/' with '_' and '+' with '-'), the standard decoder fails.
The changes include:
CustomBlobtype with custom JSON unmarshalling to handle URL-safe base64 decodingCustomPartandCustomContenttypes that wrap the GenAI SDK typesThis ensures proper handling of image data in multimodal requests while maintaining compatibility with the existing API.