Skip to main content
At revision 30a6d88a4, controller/relay.go dispatches native embeddings with case-sensitive strings.Contains(path, "embed"). The action :batchEmbedContents contains no lowercase embed, so the path model ID must contain lowercase embed, such as an available embedding model name. Other aliases can enter the wrong handler. The example rejects such batch aliases before sending. This is a current gateway limitation, not a Gemini protocol requirement; review it after upgrading. Native Gemini :embedContent and synchronous :batchEmbedContents accept content.parts and return embedding.values / embeddings[].values. These differ from OpenAI Embeddings input / data[].embedding. The batch action is not the asynchronous Batch API. Follow REST runtime, use a bare model ID without models/, and select a channel supporting native Gemini embeddings.
All entries use one model. The gateway maps the path model upstream and rewrites each entry’s model; do not mix models within a batch. The typed request preserves model, content, taskType, title, and outputDimensionality. Do not assume unknown top-level fields survive. The example encodes documents with RETRIEVAL_DOCUMENT; queries generally use the corresponding RETRIEVAL_QUERY. Confirm these options with the model. title applies to document retrieval; dimensionality limits and task types depend on the model. The example checks count, finite nonempty numeric vectors, and consistent dimensions before printing. It does not assume normalization or compare vectors across models. See single API, batch API, and the Google protocol reference. Verify model capabilities and limits in your deployment.
阅读中文版