GPT4AllEmbeddings#
- class langchain_community.embeddings.gpt4all.GPT4AllEmbeddings[source]#
Bases:
BaseModel
,Embeddings
GPT4All embedding models.
To use, you should have the gpt4all python package installed
Example
from langchain_community.embeddings import GPT4AllEmbeddings model_name = "all-MiniLM-L6-v2.gguf2.f16.gguf" gpt4all_kwargs = {'allow_download': 'True'} embeddings = GPT4AllEmbeddings( model_name=model_name, gpt4all_kwargs=gpt4all_kwargs )
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 device: str | None = 'cpu'#
- param gpt4all_kwargs: dict | None = {}#
- param model_name: str | None = None#
- param n_threads: int | None = None#
- 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]
Examples using GPT4AllEmbeddings