Skip to content

fix: allow Azure OpenAI API version override - #1650

Merged
AlexsJones merged 1 commit into
k8sgpt-ai:mainfrom
Zakharden:fix-azure-openai-api-version
Jun 4, 2026
Merged

fix: allow Azure OpenAI API version override#1650
AlexsJones merged 1 commit into
k8sgpt-ai:mainfrom
Zakharden:fix-azure-openai-api-version

Conversation

@Zakharden

@Zakharden Zakharden commented May 18, 2026

Copy link
Copy Markdown
Contributor

Description

Adds Azure OpenAI API version configuration support for the azureopenai provider.

The API version can now be set through:

  • k8sgpt auth add --azureAPIVersion
  • k8sgpt auth update --azureAPIVersion
  • K8SGPT_AZURE_API_VERSION when running k8sgpt serve
  • the persisted provider config

When present, the value is passed to the Azure OpenAI client configuration so users can opt into newer Azure OpenAI API versions without changing code.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Validated locally:

  • GOCACHE=/private/tmp/k8sgpt-go-build go test ./cmd/auth ./cmd/serve
  • GOCACHE=/private/tmp/k8sgpt-go-build go test ./pkg/ai

Additional Information

The pkg/ai test package uses local httptest servers, so it needs permission to bind a localhost listener in restricted environments.

@Zakharden
Zakharden requested review from a team as code owners May 18, 2026 14:09
@github-project-automation github-project-automation Bot moved this to Proposed in Backlog May 18, 2026
@AlexsJones

Copy link
Copy Markdown
Member

Thanks for this, please sign the DCO @Zakharden

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.70115% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.84%. Comparing base (173e4dc) to head (d4dd3dc).
⚠️ Report is 227 commits behind head on main.

Files with missing lines Patch % Lines
cmd/serve/serve.go 93.54% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1650       +/-   ##
===========================================
+ Coverage   34.76%   45.84%   +11.08%     
===========================================
  Files          94      121       +27     
  Lines        6342     7518     +1176     
===========================================
+ Hits         2205     3447     +1242     
+ Misses       4046     3836      -210     
- Partials       91      235      +144     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zakharden
Zakharden force-pushed the fix-azure-openai-api-version branch from c5d53d9 to 00bf249 Compare May 18, 2026 17:32
@Zakharden

Copy link
Copy Markdown
Contributor Author

Signed off the commit and added coverage around the Azure API version paths.

Signed-off-by: Zakhar Dvurechensky <72825626+Zakharden@users.noreply.github.com>
@Zakharden
Zakharden force-pushed the fix-azure-openai-api-version branch from 00bf249 to d4dd3dc Compare June 3, 2026 14:34
@Zakharden

Copy link
Copy Markdown
Contributor Author

Rebased on current main and fixed the test mock compile break from the updated IAIConfig method set. Verified locally with GOCACHE=/private/tmp/k8sgpt-gocache GOMODCACHE=/private/tmp/k8sgpt-gomodcache go test ./cmd/auth ./cmd/serve ./pkg/ai.

@AlexsJones
AlexsJones merged commit 1b7d1f0 into k8sgpt-ai:main Jun 4, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Proposed to Done in Backlog Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants