Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
embed(texts: List[str], batch_size: int = 0, embeddings_task_type: Optional[Literal['RETRIEVAL_QUERY', 'RETRIEVAL_DOCUMENT', 'SEMANTIC_SIMILARITY', 'CLASSIFICATION', 'CLUSTERING']] = None) → List[List[float]][source]¶
Embed a list of strings.
Parameters
texts – List[str] The list of strings to embed.
batch_size – [int] The batch size of embeddings to send to the model.
If zero, then the largest batch size will be detected dynamically
at the first request, starting from 250, down to 5.
embeddings_task_type – [str] optional embeddings task type,
one of the following
RETRIEVAL_QUERY     - Text is a queryin a search/retrieval setting.
RETRIEVAL_DOCUMENT - Text is a documentin a search/retrieval setting.
SEMANTIC_SIMILARITY - Embeddings will be usedfor Semantic Textual Similarity (STS).
CLASSIFICATION - Embeddings will be used for classification.
CLUSTERING - Embeddings will be used for clustering.
Returns
List of embeddings, one for each text.
embed_documents(texts: List[str], batch_size: int = 0) → List[List[float]][source]¶
Embed a list of documents.
Parameters
texts – List[str] The list of texts to embed.
batch_size – [int] The batch size of embeddings to send to the model.
If zero, then the largest batch size will be detected dynamically
at the first request, starting from 250, down to 5.
Returns
List of embeddings, one for each text.
embed_query(text: str) → List[float][source]¶
Embed a text.
Parameters