Skip to content

fix(go-adk): openai embeddings generation#2132

Merged
EItanya merged 4 commits into
kagent-dev:mainfrom
supreme-gg-gg:fix/go-embeddings
Jul 2, 2026
Merged

fix(go-adk): openai embeddings generation#2132
EItanya merged 4 commits into
kagent-dev:mainfrom
supreme-gg-gg:fix/go-embeddings

Conversation

@supreme-gg-gg

@supreme-gg-gg supreme-gg-gg commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Close #2131

The main fix is to remove HTTPClient passed 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

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Copilot AI review requested due to automatic review settings July 1, 2026 18:10
@github-actions github-actions Bot added the bug Something isn't working label Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 HTTPClient into the embedding client so OpenAI auth headers are sourced correctly from OPENAI_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.

Comment thread go/adk/pkg/embedding/embedding.go
Comment thread go/adk/pkg/embedding/embedding.go
Comment thread go/adk/pkg/embedding/embedding.go Outdated
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 1, 2026
@EItanya EItanya merged commit 4444bcf into kagent-dev:main Jul 2, 2026
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go ADK runtime: memory embedding fails with 401 invalid_issuer (OpenAI provider) — works on Python runtime with identical config

3 participants