embeddings
Java-friendly overload that accepts a Consumer for configuring the embedding request.
Return
An OpenaiEmbedBuildingStep for specifying the mock response to embedding requests.
Parameters
Optional identifier for the mock configuration.
Consumer to configure the request matching criteria via OpenaiEmbedRequestSpecification.
Sets up a mock handler for the OpenAI /v1/embeddings endpoint, allowing configuration of request matching for embedding requests.
Supports matching on model, input (string or list), dimensions, encoding_format, and user fields in the request body.
Example with single string input:
openai.embeddings {
model = "text-embedding-3-small"
inputContains("Hello")
stringInput("Hello world")
} responds {
delay = 200.milliseconds
embeddings(listOf(0.1f, 0.2f, 0.3f))
}Example with list of strings:
openai.embeddings {
model = "text-embedding-3-small"
stringListInput(listOf("Hello", "world"))
} responds {
embeddings(
listOf(0.1f, 0.2f, 0.3f),
listOf(0.4f, 0.5f, 0.6f)
)
}Return
An OpenaiEmbedBuildingStep for specifying the mock response to embedding requests.
Parameters
Optional identifier for the mock configuration.
Lambda to configure the request matching criteria via OpenaiEmbedRequestSpecification.