Class GitHubModelsEmbeddingModel
java.lang.Object
dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dev.langchain4j.model.github.GitHubModelsEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
Represents an embedding model, hosted on GitHub Models, such as text-embedding-3-small.
Mandatory parameters for initialization are: gitHubToken (the GitHub Token used for authentication) and modelName (the name of the model to use). You can also provide your own EmbeddingsClient instance, if you need more flexibility.
The list of models, as well as the documentation and a playground to test them, can be found at https://github.com/marketplace/models
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class DimensionAwareEmbeddingModel
dimension -
Method Summary
Modifier and TypeMethodDescriptionbuilder()embedAll(List<TextSegment> textSegments) Embeds the provided text segments, processing a maximum of 16 segments at a time.protected IntegerWhen known (e.g., can be derived from the model name), returns the dimension of theEmbeddingproduced by this embedding model.Returns the name of the underlying embedding model.Methods inherited from class DimensionAwareEmbeddingModel
dimensionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingModel
embed, embed
-
Method Details
-
embedAll
Embeds the provided text segments, processing a maximum of 16 segments at a time. For more information, refer to the documentation here.- Parameters:
textSegments- A list of text segments.- Returns:
- A list of corresponding embeddings.
-
knownDimension
Description copied from class:DimensionAwareEmbeddingModelWhen known (e.g., can be derived from the model name), returns the dimension of theEmbeddingproduced by this embedding model. Otherwise, it returnsnull.- Overrides:
knownDimensionin classDimensionAwareEmbeddingModel- Returns:
- the known dimension of the
Embedding, ornullif unknown.
-
modelName
Description copied from interface:EmbeddingModelReturns the name of the underlying embedding model.Implementations are encouraged to override this method and provide the actual model name. The default implementation returns
"unknown", which indicates that the model name is unknown.- Returns:
- the model name or a fallback value if not provided
-
builder
-