Add Gemini provider, custom URLs, local providers, and extra headers#14
Add Gemini provider, custom URLs, local providers, and extra headers#14
Conversation
Extract common utilities used across embedding providers into provider_common.h/.c: curl write callback, API key loading with tilde expansion and permission checks, JSON string escaping, OpenAI-format request building, shared HTTP POST via curl, and OpenAI-format embedding response parsing. Also adds the pgedge_vectorizer_extra_headers variable stub so the new code compiles ahead of the full GUC definition in a later task. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… provider list Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace gemini_generate() with a simple delegation to gemini_generate_batch() with count=1, matching the pattern used by the OpenAI and Voyage providers. Remove the now-unused parse_gemini_embedding_response() function and its forward declaration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…custom URLs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high (2 false positives) |
| Complexity | 12 medium |
🟢 Metrics 110 complexity · -16 duplication
Metric Results Complexity 110 Duplication -16
TIP This summary will be updated as you push new changes. Give us feedback
Column header widths for Gemini URL, extra_headers, and local provider URL were too wide in the expected output file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract provider_count_array_dimensions() for counting JSON array elements - Extract provider_parse_float_array() for parsing JSON float arrays - Extract provider_append_extra_headers() from provider_do_curl_request() - Extract provider_free_embeddings() for error cleanup - Add nosemgrep/flawfinder annotations for false positive suppressions - Refactor all three response parsers to use shared helpers - Simplify provider_do_curl_request() and provider_load_api_key() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Note that the macOS CI failure is a separate, unrelated issue. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughAdds a new Gemini embedding provider and registers it in the provider registry. Introduces shared provider utilities via 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
provider_common.c(curl, JSON, API key loading, response parsing). Slims existing providers from ~516 lines each to ~163-187 lines.provider_gemini.cwithx-goog-api-keyauth, model-in-URL-path, and native batch support viabatchEmbedContents.api_urlGUC now defaults to empty; each provider supplies its own default URL. Enables pointing any provider at a custom endpoint.extra_headersGUC (semicolon-separatedkey: valuepairs) for proxy servers like Portkey.Test plan
make clean && makebuilds cleanly with zero warningsmake install && make installcheckpasses all existing tests plus new provider/GUC test cases🤖 Generated with Claude Code