Class EmbeddingModelResponseContext
java.lang.Object
dev.langchain4j.model.embedding.listener.EmbeddingModelResponseContext
The context passed to
EmbeddingModelListener.onResponse(EmbeddingModelResponseContext) after a
successful embedding call. It gives access to the EmbeddingRequest that was embedded, the resulting
EmbeddingResponse (the embeddings and response metadata), the EmbeddingModel, the
ModelProvider, and the attributes map shared with the request callback of the same listener.- Since:
- 1.11.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
-
Constructor Details
-
EmbeddingModelResponseContext
-
-
Method Details
-
embeddingRequest
- Returns:
- the
EmbeddingRequestthat was embedded, including its per-call parameters and multimodal inputs. For a convenience call (EmbeddingModel.embed(String)/EmbeddingModel.embedAll(List)) it is reconstructed from the inputs, and isnullonly when there are no inputs.
-
embeddingResponse
- Returns:
- the
EmbeddingResponse, including the embeddings and the response metadata.
-
embeddingModel
-
modelProvider
- Returns:
- the
ModelProviderof the embedding model (for exampleModelProvider.OPEN_AI).
-
attributes
- Returns:
- The attributes map. It can be used to pass data between methods of an
EmbeddingModelListeneror between multipleEmbeddingModelListeners.
-
response
- Returns:
- the embeddings and token usage. For the full response, including all response metadata, use
embeddingResponse().
-
textSegments
- Returns:
- the text of each input that was embedded. For the full request, including per-call parameters and
multimodal inputs, use
embeddingRequest().
-
builder
-