feat: Support OpenAI-compatible embeddings base URL#69
Conversation
WalkthroughThis change introduces support for configuring a custom base URL for embeddings services. A new optional environment variable 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/service/embedding_client_factory_test.go`:
- Around line 104-114: Add parallel test cases for the "google-gemini" provider
mirroring the existing "google" BaseURL restriction checks in
TestNewEmbeddingClient and TestValidateEmbeddingConfig: create entries using
Provider set to EmbeddingProviderGoogleGemini (or the constant used for
google-gemini), ProviderAPIKey "key", Model "text-embedding-004", BaseURL
"https://embeddings.example.com/v1", and expect wantErr true with errIs
ErrEmbeddingBaseURLUnsupported; place them alongside the existing google case so
both provider variants assert the same BaseURL restriction.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: cc88769e-4305-4916-85a1-91a12b9a2919
📒 Files selected for processing (11)
.env.examplecharts/hub/values.yamlcmd/api/app.gocmd/backfill-embeddings/main.gocmd/worker/app.gointernal/config/config.gointernal/config/config_test.gointernal/openai/client.gointernal/openai/client_test.gointernal/service/embedding_client_factory.gointernal/service/embedding_client_factory_test.go
Summary
EMBEDDING_BASE_URLas an optional config/env/Helm value forEMBEDDING_PROVIDER=openai.OPENAI_BASE_URL.Validation
go test ./internal/... ./cmd/... ./pkg/...make lint GOLANGCI_LINT="$(go env GOPATH)/bin/golangci-lint"git diff --cached --checkhelm lint /Users/bhagya/work/formbricks/hub/charts/hubhelm template hub /Users/bhagya/work/formbricks/hub/charts/hub --set secrets.stringData.DATABASE_URL=postgres://example --set secrets.stringData.API_KEY=test-keyNotes
go test ./...still requires the local integration Postgres onlocalhost:5432; that dependency was unavailable in this environment, so the DB-backedtests/package could not be validated locally.