Class EmbeddingModelRequestContext
java.lang.Object
dev.langchain4j.model.embedding.listener.EmbeddingModelRequestContext
The context passed to
EmbeddingModelListener.onRequest(EmbeddingModelRequestContext) before an
embedding call. It gives access to the EmbeddingRequest being embedded (its inputs and per-call
parameters), the EmbeddingModel, the ModelProvider, and a mutable attributes map that
can be used to pass data to the response/error callbacks of the same listener.- Since:
- 1.11.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EmbeddingModelRequestContext
-
-
Method Details
-
embeddingRequest
- Returns:
- the
EmbeddingRequestbeing 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.
-
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.
-
textSegments
- Returns:
- the text of each input being embedded. For the full request, including per-call parameters and
multimodal inputs, use
embeddingRequest().
-
builder
-