Skip to content

langchain-nomic

PyPI - Version PyPI - License PyPI - Downloads

Reference docs

This page contains reference documentation for Nomic. See the docs for conceptual guides, tutorials, and examples on using Nomic modules.

langchain_nomic

Nomic partner integration for LangChain.

NomicEmbeddings

Bases: Embeddings

NomicEmbeddings embedding model.

Example
from langchain_nomic import NomicEmbeddings

model = NomicEmbeddings()
METHOD DESCRIPTION
aembed_documents

Asynchronous Embed search docs.

aembed_query

Asynchronous Embed query text.

__init__

Initialize NomicEmbeddings model.

embed

Embed texts.

embed_documents

Embed search docs.

embed_query

Embed query text.

embed_image

Embed images.

aembed_documents async

aembed_documents(texts: list[str]) -> list[list[float]]

Asynchronous Embed search docs.

PARAMETER DESCRIPTION
texts

List of text to embed.

TYPE: list[str]

RETURNS DESCRIPTION
list[list[float]]

List of embeddings.

aembed_query async

aembed_query(text: str) -> list[float]

Asynchronous Embed query text.

PARAMETER DESCRIPTION
text

Text to embed.

TYPE: str

RETURNS DESCRIPTION
list[float]

Embedding.

__init__

__init__(
    *,
    model: str,
    nomic_api_key: str | None = None,
    dimensionality: int | None = None,
    inference_mode: str = "remote",
    device: str | None = None,
    vision_model: str | None = None,
)

Initialize NomicEmbeddings model.

PARAMETER DESCRIPTION
model

Model name

TYPE: str

nomic_api_key

Optionally, set the Nomic API key. Uses the NOMIC_API_KEY environment variable by default.

TYPE: str | None DEFAULT: None

dimensionality

The embedding dimension, for use with Matryoshka-capable models. Defaults to full-size.

TYPE: int | None DEFAULT: None

inference_mode

How to generate embeddings. One of 'remote', 'local' (Embed4All), or 'dynamic' (automatic).

TYPE: str DEFAULT: 'remote'

device

The device to use for local embeddings. Choices include 'cpu', 'gpu', 'nvidia', 'amd', or a specific device name. See the docstring for GPT4All.__init__ for more info.

Typically defaults to 'cpu'.

Warning

Do not use on macOS.

TYPE: str | None DEFAULT: None

vision_model

The vision model to use for image embeddings.

TYPE: str | None DEFAULT: None

embed

embed(texts: list[str], *, task_type: str) -> list[list[float]]

Embed texts.

PARAMETER DESCRIPTION
texts

List of texts to embed

TYPE: list[str]

task_type

The task type to use when embedding. One of 'search_query', 'search_document', 'classification', 'clustering'

TYPE: str

embed_documents

embed_documents(texts: list[str]) -> list[list[float]]

Embed search docs.

PARAMETER DESCRIPTION
texts

List of texts to embed as documents

TYPE: list[str]

embed_query

embed_query(text: str) -> list[float]

Embed query text.

PARAMETER DESCRIPTION
text

Query text

TYPE: str

embed_image

embed_image(uris: list[str]) -> list[list[float]]

Embed images.

PARAMETER DESCRIPTION
uris

List of image URIs to embed

TYPE: list[str]