fix(embedding): stop forcing dimensions on OpenAI-compatible embedding calls - #2542
Open
mesutoezdil wants to merge 5 commits into
Open
fix(embedding): stop forcing dimensions on OpenAI-compatible embedding calls#2542mesutoezdil wants to merge 5 commits into
mesutoezdil wants to merge 5 commits into
Conversation
…g calls The openai, azure_openai, and foundry embedding paths in both the Go and Python runtimes asked for exactly 768 dimensions unconditionally. Providers that only offer other sizes (e.g. Bedrock Titan behind an OpenAI-compatible gateway) reject the request outright, even though the existing truncate/normalize step already handles any size above 768. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
EItanya
approved these changes
Aug 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Removes the hardcoded dimensions=768 parameter from OpenAI-compatible embedding requests so providers that don’t support exactly 768 dimensions can still be used, relying on existing truncate/normalize post-processing.
Changes:
- Drop the
dimensionsparameter from the Python OpenAI embedding call path. - Drop the
Dimensionsfield from the Go OpenAI embedding request payload. - Add/adjust unit tests to assert
dimensionsis not sent.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/packages/kagent-adk/tests/unittests/test_embedding.py | Adds a unit test asserting the OpenAI embedding call omits dimensions. |
| python/packages/kagent-adk/src/kagent/adk/models/_embedding.py | Removes dimensions=self.TARGET_DIMENSION from the OpenAI embeddings request. |
| go/adk/pkg/embedding/embedding_test.go | Updates the OpenAI provider test expectation to ensure dimensions is not sent. |
| go/adk/pkg/embedding/embedding.go | Removes Dimensions from the OpenAI embeddings request params. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Decoding into an int field could not tell an absent dimensions key from an explicit 0. Check the raw JSON body instead. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ons-openai-compatible Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ons-openai-compatible Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ons-openai-compatible Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The openai, azure_openai, and foundry embedding paths in both the Go and Python runtimes asked for exactly 768 dimensions unconditionally. Providers that only offer other sizes, such as Bedrock Titan behind an OpenAI-compatible gateway, reject the request outright, even though the existing truncate and normalize step already handles anything larger than 768. Drops the dimensions parameter on these paths, since the truncate and normalize step already covers it.