PremAIEmbeddings#

class langchain_community.embeddings.premai.PremAIEmbeddings[source]#

Bases: BaseModel, Embeddings

Prem’s Embedding APIs

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param client: Any [Required]#
param max_retries: int = 1#

Max number of retries for tenacity

param model: str [Required]#

The Embedding model to choose from

param premai_api_key: SecretStr | None = None#

Prem AI API Key. Get it here: https://app.premai.io/api_keys/

param project_id: int [Required]#

The project ID in which the experiments or deployments are carried out. You can find all your projects here: https://app.premai.io/projects/

param show_progress_bar: bool = False#

Whether to show a tqdm progress bar. Must have tqdm installed.

async aembed_documents(texts: list[str]) β†’ list[list[float]]#

Asynchronous Embed search docs.

Parameters:

texts (list[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

list[list[float]]

async aembed_query(text: str) β†’ list[float]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

list[float]

embed_documents(texts: List[str]) β†’ List[List[float]][source]#

Embed search docs.

Parameters:

texts (List[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

List[List[float]]

embed_query(text: str) β†’ List[float][source]#

Embed query text

Parameters:

text (str)

Return type:

List[float]

classmethod validate_environments(values: Dict) β†’ Dict[source]#

Validate that the package is installed and that the API token is valid

Parameters:

values (Dict)

Return type:

Dict

Examples using PremAIEmbeddings