Toggle Menu
Prev Up Next

# `langchain_nomic.embeddings`.NomicEmbeddings

class langchain_nomic.embeddings.NomicEmbeddings(*, model: str, nomic_api_key: Optional[str] = None, dimensionality: Optional[int] = None)

  NomicEmbeddings embedding model.

  Example

      from langchain_nomic import NomicEmbeddings

      model = NomicEmbeddings()

  Initialize NomicEmbeddings model.

  Parameters

    - model (str) – model name

    - nomic_api_key (Optional[str]) – optionally, set the Nomic API key. Uses the NOMIC_API_KEY environment variable by default.

    - dimensionality (Optional[int]) –

  Methods

  `__init__`(*, model[, nomic_api_key, ...]) | Initialize NomicEmbeddings model.
  `aembed_documents`(texts) | Asynchronous Embed search docs.
  `aembed_query`(text) | Asynchronous Embed query text.
  `embed`(texts, *, task_type) | Embed texts.
  `embed_documents`(texts) | Embed search docs.
  `embed_query`(text) | Embed query text.

  __init__(*, model: str, nomic_api_key: Optional[str] = None, dimensionality: Optional[int] = None)

    Initialize NomicEmbeddings model.

    Parameters

      - model (str) – model name

      - nomic_api_key (Optional[str]) – optionally, set the Nomic API key. Uses the NOMIC_API_KEY environment variable by default.

      - dimensionality (Optional[int]) –

  async aembed_documents(texts: List[str]) → List[List[float]]

    Asynchronous Embed search docs.

    Parameters

      texts (List[str]) –

    Return type

      List[List[float]]

  async aembed_query(text: str) → List[float]

    Asynchronous Embed query text.

    Parameters

      text (str) –

    Return type

      List[float]

  embed(texts: List[str], *, task_type: str) → List[List[float]]

    Embed texts.

    Parameters

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

      - task_type (str) – the task type to use when embedding. One of search_query, search_document, classification, clustering

    Return type

      List[List[float]]

  embed_documents(texts: List[str]) → List[List[float]]

    Embed search docs.

    Parameters

      texts (List[str]) – list of texts to embed as documents

    Return type

      List[List[float]]

  embed_query(text: str) → List[float]

    Embed query text.

    Parameters

      text (str) – query text

    Return type

      List[float]

# Examples using NomicEmbeddings

- install package

- nomic.md