Skip to content

feat(gemini): Phase 5 -- embeddings (embedContent) #1597

@bug-ops

Description

@bug-ops

Part of #1592

Scope

Implement the embedContent endpoint for Gemini's embedding models.

Files to Modify

  • crates/zeph-llm/src/gemini.rs -- implement embed(), update supports_embeddings()
  • crates/zeph-core/src/config/types.rs -- add embedding_model field to GeminiConfig

Key Implementation Details

  • Endpoint: POST /v1beta/models/{model}:embedContent?key={API_KEY}
  • Default model: text-embedding-004 (768 dimensions)
  • Request includes taskType for optimal embedding:
    • RETRIEVAL_QUERY for search queries (used in embed() calls)
    • RETRIEVAL_DOCUMENT for stored documents
  • Response: embedding.values as Vec<f32>
  • supports_embeddings() returns true only when embedding_model is configured

Config

[llm.gemini]
model = "gemini-2.5-flash"
max_output_tokens = 8192
embedding_model = "text-embedding-004"

Acceptance Criteria

  • supports_embeddings() returns true when embedding model configured
  • embed() returns correctly dimensioned vectors
  • taskType set to RETRIEVAL_QUERY for embed() calls
  • Embedding model configurable in [llm.gemini]
  • Compatible with existing Qdrant/semantic memory pipeline
  • Unit tests with wiremock

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions