Home / Class/ NomicEmbeddings Class — langchain Architecture

NomicEmbeddings Class — langchain Architecture

Architecture documentation for the NomicEmbeddings class in embeddings.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0646ce15_0ff5_ff53_3e70_3fd27c663144["NomicEmbeddings"]
  b1e4f760_c634_d3bf_ca9a_db7ab899cc4a["Embeddings"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|extends| b1e4f760_c634_d3bf_ca9a_db7ab899cc4a
  6dd7fd2c_b005_fbff_bf71_f0e6486137c9["embeddings.py"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|defined in| 6dd7fd2c_b005_fbff_bf71_f0e6486137c9
  025ef17a_2c81_ea30_737c_356481951b75["__init__()"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|method| 025ef17a_2c81_ea30_737c_356481951b75
  5d3fe9cb_b3db_545c_9ac3_c09c238b4690["embed()"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|method| 5d3fe9cb_b3db_545c_9ac3_c09c238b4690
  99a82c59_97c1_5050_aab0_84a9dd45930a["embed_documents()"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|method| 99a82c59_97c1_5050_aab0_84a9dd45930a
  aa8e0525_8e6e_1009_4ff7_dc79b4207f63["embed_query()"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|method| aa8e0525_8e6e_1009_4ff7_dc79b4207f63
  96a50201_709c_c5b8_1bd4_f010aa8592c6["embed_image()"]
  0646ce15_0ff5_ff53_3e70_3fd27c663144 -->|method| 96a50201_709c_c5b8_1bd4_f010aa8592c6

Relationship Graph

Source Code

libs/partners/nomic/langchain_nomic/embeddings.py lines 13–149

class NomicEmbeddings(Embeddings):
    """`NomicEmbeddings` embedding model.

    Example:
        ```python
        from langchain_nomic import NomicEmbeddings

        model = NomicEmbeddings()
        ```
    """

    @overload
    def __init__(
        self,
        *,
        model: str,
        nomic_api_key: str | None = ...,
        dimensionality: int | None = ...,
        inference_mode: Literal["remote"] = ...,
    ) -> None: ...

    @overload
    def __init__(
        self,
        *,
        model: str,
        nomic_api_key: str | None = ...,
        dimensionality: int | None = ...,
        inference_mode: Literal["local", "dynamic"],
        device: str | None = ...,
    ) -> None: ...

    @overload
    def __init__(
        self,
        *,
        model: str,
        nomic_api_key: str | None = ...,
        dimensionality: int | None = ...,
        inference_mode: str,
        device: str | None = ...,
    ) -> None: ...

    def __init__(
        self,
        *,
        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.

        Args:
            model: Model name
            nomic_api_key: Optionally, set the Nomic API key. Uses the `NOMIC_API_KEY`
                environment variable by default.
            dimensionality: The embedding dimension, for use with Matryoshka-capable
                models. Defaults to full-size.
            inference_mode: How to generate embeddings. One of `'remote'`, `'local'`
                (Embed4All), or `'dynamic'` (automatic).
            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.
            vision_model: The vision model to use for image embeddings.

        """
        _api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
        if _api_key:
            nomic.login(_api_key)
        self.model = model
        self.dimensionality = dimensionality
        self.inference_mode = inference_mode

Extends

Frequently Asked Questions

What is the NomicEmbeddings class?
NomicEmbeddings is a class in the langchain codebase, defined in libs/partners/nomic/langchain_nomic/embeddings.py.
Where is NomicEmbeddings defined?
NomicEmbeddings is defined in libs/partners/nomic/langchain_nomic/embeddings.py at line 13.
What does NomicEmbeddings extend?
NomicEmbeddings extends Embeddings.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free