Package dev.langchain4j.model.mistralai
Class MistralAiEmbeddingModel
java.lang.Object
dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dev.langchain4j.model.mistralai.MistralAiEmbeddingModel
- All Implemented Interfaces:
dev.langchain4j.model.embedding.EmbeddingModel
public class MistralAiEmbeddingModel
extends dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
Represents a Mistral AI embedding model, such as mistral-embed.
You can find description of parameters here.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
Fields inherited from class dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dimension -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()dev.langchain4j.model.output.Response<List<dev.langchain4j.data.embedding.Embedding>> Embeds a list of text segments using the Mistral AI embedding model.static MistralAiEmbeddingModelwithApiKey(String apiKey) Creates a new MistralAiEmbeddingModel instance with the specified API key.Methods inherited from class dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dimension, knownDimensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.embedding.EmbeddingModel
embed, embed
-
Constructor Details
-
MistralAiEmbeddingModel
public MistralAiEmbeddingModel(String baseUrl, String apiKey, String modelName, Duration timeout, Boolean logRequests, Boolean logResponses, Integer maxRetries) Constructs a new MistralAiEmbeddingModel instance.- Parameters:
baseUrl- the base URL of the Mistral AI API. It use a default value if not specifiedapiKey- the API key for authenticationmodelName- the name of the embedding model. It uses a default value if not specifiedtimeout- the timeout duration for API requests. It uses a default value of 60 seconds if not specifiedThe default value is 60 seconds
logRequests- a flag indicating whether to log API requestslogResponses- a flag indicating whether to log API responsesmaxRetries- the maximum number of retries for API requests. It uses a default value of 3 if not specified
-
-
Method Details
-
withApiKey
Creates a new MistralAiEmbeddingModel instance with the specified API key.- Parameters:
apiKey- the Mistral AI API key for authentication- Returns:
- a new MistralAiEmbeddingModel instance
-
embedAll
public dev.langchain4j.model.output.Response<List<dev.langchain4j.data.embedding.Embedding>> embedAll(List<dev.langchain4j.data.segment.TextSegment> textSegments) Embeds a list of text segments using the Mistral AI embedding model.- Parameters:
textSegments- the list of text segments to embed- Returns:
- a Response object containing the embeddings and token usage information
-
builder
-