langchain-nomic 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
+ from __future__ import annotations
2
+
1
3
  import os
2
- from typing import List, Literal, Optional, overload
4
+ from typing import Literal, Optional, overload
3
5
 
4
6
  import nomic # type: ignore[import]
5
7
  from langchain_core.embeddings import Embeddings
@@ -10,11 +12,13 @@ class NomicEmbeddings(Embeddings):
10
12
  """NomicEmbeddings embedding model.
11
13
 
12
14
  Example:
15
+
13
16
  .. code-block:: python
14
17
 
15
18
  from langchain_nomic import NomicEmbeddings
16
19
 
17
20
  model = NomicEmbeddings()
21
+
18
22
  """
19
23
 
20
24
  @overload
@@ -25,8 +29,7 @@ class NomicEmbeddings(Embeddings):
25
29
  nomic_api_key: Optional[str] = ...,
26
30
  dimensionality: Optional[int] = ...,
27
31
  inference_mode: Literal["remote"] = ...,
28
- ):
29
- ...
32
+ ): ...
30
33
 
31
34
  @overload
32
35
  def __init__(
@@ -37,8 +40,7 @@ class NomicEmbeddings(Embeddings):
37
40
  dimensionality: Optional[int] = ...,
38
41
  inference_mode: Literal["local", "dynamic"],
39
42
  device: Optional[str] = ...,
40
- ):
41
- ...
43
+ ): ...
42
44
 
43
45
  @overload
44
46
  def __init__(
@@ -49,8 +51,7 @@ class NomicEmbeddings(Embeddings):
49
51
  dimensionality: Optional[int] = ...,
50
52
  inference_mode: str,
51
53
  device: Optional[str] = ...,
52
- ):
53
- ...
54
+ ): ...
54
55
 
55
56
  def __init__(
56
57
  self,
@@ -66,16 +67,18 @@ class NomicEmbeddings(Embeddings):
66
67
 
67
68
  Args:
68
69
  model: model name
69
- nomic_api_key: optionally, set the Nomic API key. Uses the NOMIC_API_KEY
70
+ nomic_api_key: optionally, set the Nomic API key. Uses the ``NOMIC_API_KEY``
70
71
  environment variable by default.
71
72
  dimensionality: The embedding dimension, for use with Matryoshka-capable
72
73
  models. Defaults to full-size.
73
- inference_mode: How to generate embeddings. One of `remote`, `local`
74
- (Embed4All), or `dynamic` (automatic). Defaults to `remote`.
74
+ inference_mode: How to generate embeddings. One of ``'remote'``, ``'local'``
75
+ (Embed4All), or ``'dynamic'`` (automatic). Defaults to ``'remote'``.
75
76
  device: The device to use for local embeddings. Choices include
76
- `cpu`, `gpu`, `nvidia`, `amd`, or a specific device name. See
77
- the docstring for `GPT4All.__init__` for more info. Typically
78
- defaults to CPU. Do not use on macOS.
77
+ ``'cpu'``, ``'gpu'``, ``'nvidia'``, ``'amd'``, or a specific device
78
+ name. See the docstring for ``GPT4All.__init__`` for more info.
79
+ Typically defaults to ``'cpu'``. Do not use on macOS.
80
+ vision_model: The vision model to use for image embeddings.
81
+
79
82
  """
80
83
  _api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
81
84
  if _api_key:
@@ -86,15 +89,15 @@ class NomicEmbeddings(Embeddings):
86
89
  self.device = device
87
90
  self.vision_model = vision_model
88
91
 
89
- def embed(self, texts: List[str], *, task_type: str) -> List[List[float]]:
92
+ def embed(self, texts: list[str], *, task_type: str) -> list[list[float]]:
90
93
  """Embed texts.
91
94
 
92
95
  Args:
93
96
  texts: list of texts to embed
94
- task_type: the task type to use when embedding. One of `search_query`,
95
- `search_document`, `classification`, `clustering`
96
- """
97
+ task_type: the task type to use when embedding. One of ``'search_query'``,
98
+ ``'search_document'``, ``'classification'``, ``'clustering'``
97
99
 
100
+ """
98
101
  output = embed.text(
99
102
  texts=texts,
100
103
  model=self.model,
@@ -105,29 +108,31 @@ class NomicEmbeddings(Embeddings):
105
108
  )
106
109
  return output["embeddings"]
107
110
 
108
- def embed_documents(self, texts: List[str]) -> List[List[float]]:
111
+ def embed_documents(self, texts: list[str]) -> list[list[float]]:
109
112
  """Embed search docs.
110
113
 
111
114
  Args:
112
115
  texts: list of texts to embed as documents
116
+
113
117
  """
114
118
  return self.embed(
115
119
  texts=texts,
116
120
  task_type="search_document",
117
121
  )
118
122
 
119
- def embed_query(self, text: str) -> List[float]:
123
+ def embed_query(self, text: str) -> list[float]:
120
124
  """Embed query text.
121
125
 
122
126
  Args:
123
127
  text: query text
128
+
124
129
  """
125
130
  return self.embed(
126
131
  texts=[text],
127
132
  task_type="search_query",
128
133
  )[0]
129
134
 
130
- def embed_image(self, uris: List[str]) -> List[List[float]]:
135
+ def embed_image(self, uris: list[str]) -> list[list[float]]:
131
136
  return embed.image(
132
137
  images=uris,
133
138
  model=self.vision_model,
@@ -1,22 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-nomic
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: An integration package connecting Nomic and LangChain
5
- Home-page: https://github.com/langchain-ai/langchain
6
5
  License: MIT
7
- Requires-Python: >=3.9,<4.0
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: langchain-core (>=0.2.40,<0.4)
15
- Requires-Dist: nomic (>=3.1.2,<4.0.0)
16
- Requires-Dist: pillow (>=10.3.0,<11.0.0)
17
- Project-URL: Repository, https://github.com/langchain-ai/langchain
18
- Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-nomic%3D%3D0%22&expanded=true
19
6
  Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/partners/nomic
7
+ Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-nomic%3D%3D0%22&expanded=true
8
+ Project-URL: repository, https://github.com/langchain-ai/langchain
9
+ Requires-Python: >=3.9
10
+ Requires-Dist: langchain-core>=0.3.76
11
+ Requires-Dist: nomic<4.0.0,>=3.5.3
12
+ Requires-Dist: pillow<11.0.0,>=10.3.0
20
13
  Description-Content-Type: text/markdown
21
14
 
22
15
  # langchain-nomic
@@ -0,0 +1,8 @@
1
+ langchain_nomic-0.1.5.dist-info/METADATA,sha256=86EsnuouCAaUlhFySJnCsHQrlu55-bwOVlPC7_MX0bg,1084
2
+ langchain_nomic-0.1.5.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ langchain_nomic-0.1.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ langchain_nomic-0.1.5.dist-info/licenses/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
5
+ langchain_nomic/__init__.py,sha256=MYethT7Ss07B2-ZHi0Y61JONOTXUtp_VTFW1ES-ydKM,86
6
+ langchain_nomic/embeddings.py,sha256=dVABZQQuTHfIga2ip3pNjMMjGf6ck2Mylp_FagpRESI,4035
7
+ langchain_nomic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ langchain_nomic-0.1.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: pdm-backend (2.4.5)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+
3
+ [gui_scripts]
4
+
@@ -1,7 +0,0 @@
1
- langchain_nomic/__init__.py,sha256=MYethT7Ss07B2-ZHi0Y61JONOTXUtp_VTFW1ES-ydKM,86
2
- langchain_nomic/embeddings.py,sha256=9llrozY7UJnwB9hrJxbPamC35Opn1aVbeaoHn1wHYa8,3892
3
- langchain_nomic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- langchain_nomic-0.1.3.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
5
- langchain_nomic-0.1.3.dist-info/METADATA,sha256=EFiDkGgnaubbTQsNxraA4GmwBQo5ag-it5sTA_oAKYs,1458
6
- langchain_nomic-0.1.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
7
- langchain_nomic-0.1.3.dist-info/RECORD,,