fix(go-adk): openai embeddings generation#2132
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Go ADK memory embedding failures (401 invalid_issuer) by ensuring embedding providers don’t reuse the Kagent-authenticated HTTP client, and refactors embedding generation to use vendor SDKs (OpenAI, Azure OpenAI, Ollama) for improved stability.
Changes:
- Stop passing a Kagent-authenticated
HTTPClientinto the embedding client so OpenAI auth headers are sourced correctly fromOPENAI_API_KEY. - Refactor embedding providers to use the OpenAI, Azure OpenAI (via OpenAI SDK), and Ollama SDK clients instead of manual HTTP calls.
- Add embedding package unit tests validating OpenAI API key usage and shared embedding post-processing behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| go/adk/pkg/memory/kagent_service.go | Stops injecting the Kagent HTTP client into embeddings to avoid incorrect auth propagation. |
| go/adk/pkg/memory/kagent_service_test.go | Updates mock embedding client creation to match the new embedding client configuration. |
| go/adk/pkg/embedding/embedding.go | Migrates OpenAI/Azure/Ollama embedding calls to SDKs and centralizes embedding post-processing. |
| go/adk/pkg/embedding/embedding_test.go | Adds targeted tests for OpenAI auth header usage and embedding normalization/validation helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
EItanya
approved these changes
Jul 2, 2026
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.
Close #2131
The main fix is to remove
HTTPClientpassed to embedding client so that it creates its own and attaches auth header properly (one line fix).However, since we're here already, I'm also moving OpenAI, Azure, and Ollama providers to use their respective SDK like Bedrock and Gemini instead of doing direct HTTP calls to the endpoints. This ensures better long-term stability and maintainability. Also improves some test coverage + refactoring