feat(server): gemini embedding 2 support (#14956)

#### PR Dependency Tree


* **PR #14956** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Improved Gemini Vertex provider configuration validation logic for
enhanced reliability.
  * Refined Google Vertex publisher base URL construction handling.

* **Tests**
  * Added test coverage for Gemini Embedding 2 model resolution.
* Added test coverage for Gemini Vertex provider Google Cloud
integration.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/toeverything/AFFiNE/pull/14956)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-05-14 04:12:49 +08:00
committed by GitHub
parent 2b22fe4692
commit 4b4def3a11
5 changed files with 46 additions and 11 deletions
@@ -111,6 +111,21 @@ mod tests {
assert_eq!(response.variant.unwrap().raw_model_id, "gemini-embedding-001");
}
#[test]
fn should_resolve_gemini_embedding_2() {
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
backend_kind: Some("gemini_api".to_string()),
model_id: "gemini-embedding-2".to_string(),
})
.unwrap();
let variant = response.variant.unwrap();
assert_eq!(variant.raw_model_id, "gemini-embedding-2");
assert_eq!(variant.protocol.as_deref(), Some("gemini"));
assert_eq!(variant.request_layer.as_deref(), Some("gemini_api"));
assert_eq!(variant.display_name.as_deref(), Some("Gemini Embedding 2"));
}
#[test]
fn should_keep_same_raw_id_as_two_backend_variants() {
let api_variant = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {