Class CompatOAIEmbedder
java.lang.Object
com.google.genkit.ai.Embedder
com.google.genkit.plugins.compatoai.CompatOAIEmbedder
- All Implemented Interfaces:
Action<EmbedRequest,,EmbedResponse, Void> Registerable
Embedder implementation for any provider that exposes an OpenAI-compatible
/embeddings
endpoint (e.g. Cohere, Mistral).
Sends a POST {baseUrl}/embeddings request with a JSON body of the form
{"model": "...", "input": ["text", ...]} and parses the data[].embedding arrays.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.genkit.ai.Embedder
Embedder.Builder -
Constructor Summary
ConstructorsConstructorDescriptionCompatOAIEmbedder(String modelName, String apiModelName, String label, CompatOAIPluginOptions options) Creates a new CompatOAIEmbedder. -
Method Summary
Modifier and TypeMethodDescriptionrun(ActionContext context, EmbedRequest request) Runs the action with the given input.Methods inherited from class com.google.genkit.ai.Embedder
builder, getDesc, getInfo, getInputSchema, getMetadata, getName, getOutputSchema, getType, register, run, runJson, runJsonWithTelemetry
-
Constructor Details
-
CompatOAIEmbedder
public CompatOAIEmbedder(String modelName, String apiModelName, String label, CompatOAIPluginOptions options) Creates a new CompatOAIEmbedder.- Parameters:
modelName- the Genkit embedder name (e.g. "cohere/embed-v4.0")apiModelName- the model name sent to the API (e.g. "embed-v4.0")label- the display label (e.g. "Cohere embed-v4.0")options- the plugin options
-
-
Method Details
-
run
Description copied from interface:ActionRuns the action with the given input.- Specified by:
runin interfaceAction<EmbedRequest,EmbedResponse, Void> - Overrides:
runin classEmbedder- Parameters:
context- the action contextrequest- the input to the action- Returns:
- the output of the action
-