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
Part of #1592
Scope
Implement the
embedContentendpoint for Gemini's embedding models.Files to Modify
crates/zeph-llm/src/gemini.rs-- implementembed(), updatesupports_embeddings()crates/zeph-core/src/config/types.rs-- addembedding_modelfield toGeminiConfigKey Implementation Details
POST /v1beta/models/{model}:embedContent?key={API_KEY}text-embedding-004(768 dimensions)taskTypefor optimal embedding:RETRIEVAL_QUERYfor search queries (used inembed()calls)RETRIEVAL_DOCUMENTfor stored documentsembedding.valuesasVec<f32>supports_embeddings()returnstrueonly whenembedding_modelis configuredConfig
Acceptance Criteria
supports_embeddings()returnstruewhen embedding model configuredembed()returns correctly dimensioned vectorstaskTypeset toRETRIEVAL_QUERYfor embed() calls[llm.gemini]