langchain-nomic 0.0.1__py3-none-any.whl → 0.0.2__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.
- langchain_nomic/embeddings.py +9 -3
- {langchain_nomic-0.0.1.dist-info → langchain_nomic-0.0.2.dist-info}/METADATA +3 -3
- langchain_nomic-0.0.2.dist-info/RECORD +7 -0
- langchain_nomic-0.0.1.dist-info/RECORD +0 -7
- {langchain_nomic-0.0.1.dist-info → langchain_nomic-0.0.2.dist-info}/LICENSE +0 -0
- {langchain_nomic-0.0.1.dist-info → langchain_nomic-0.0.2.dist-info}/WHEEL +0 -0
langchain_nomic/embeddings.py
CHANGED
@@ -3,6 +3,7 @@ from typing import List, Optional
|
|
3
3
|
|
4
4
|
import nomic # type: ignore
|
5
5
|
from langchain_core.embeddings import Embeddings
|
6
|
+
from nomic import embed # type: ignore
|
6
7
|
|
7
8
|
|
8
9
|
class NomicEmbeddings(Embeddings):
|
@@ -21,6 +22,7 @@ class NomicEmbeddings(Embeddings):
|
|
21
22
|
*,
|
22
23
|
model: str,
|
23
24
|
nomic_api_key: Optional[str] = None,
|
25
|
+
dimensionality: Optional[int] = None,
|
24
26
|
):
|
25
27
|
"""Initialize NomicEmbeddings model.
|
26
28
|
|
@@ -33,6 +35,7 @@ class NomicEmbeddings(Embeddings):
|
|
33
35
|
if _api_key:
|
34
36
|
nomic.login(_api_key)
|
35
37
|
self.model = model
|
38
|
+
self.dimensionality = dimensionality
|
36
39
|
|
37
40
|
def embed(self, texts: List[str], *, task_type: str) -> List[List[float]]:
|
38
41
|
"""Embed texts.
|
@@ -42,10 +45,13 @@ class NomicEmbeddings(Embeddings):
|
|
42
45
|
task_type: the task type to use when embedding. One of `search_query`,
|
43
46
|
`search_document`, `classification`, `clustering`
|
44
47
|
"""
|
45
|
-
# TODO: do this via nomic.embed when fixed in nomic sdk
|
46
|
-
from nomic import embed
|
47
48
|
|
48
|
-
output = embed.text(
|
49
|
+
output = embed.text(
|
50
|
+
texts=texts,
|
51
|
+
model=self.model,
|
52
|
+
task_type=task_type,
|
53
|
+
dimensionality=self.dimensionality,
|
54
|
+
)
|
49
55
|
return output["embeddings"]
|
50
56
|
|
51
57
|
def embed_documents(self, texts: List[str]) -> List[List[float]]:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langchain-nomic
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.2
|
4
4
|
Summary: An integration package connecting Nomic and LangChain
|
5
5
|
Home-page: https://github.com/langchain-ai/langchain
|
6
6
|
License: MIT
|
@@ -11,8 +11,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
|
-
Requires-Dist: langchain-core (>=0.0.
|
15
|
-
Requires-Dist: nomic (>=3.0.
|
14
|
+
Requires-Dist: langchain-core (>=0.1,<0.2)
|
15
|
+
Requires-Dist: nomic (>=3.0.12,<4.0.0)
|
16
16
|
Project-URL: Repository, https://github.com/langchain-ai/langchain
|
17
17
|
Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/partners/nomic
|
18
18
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,7 @@
|
|
1
|
+
langchain_nomic/__init__.py,sha256=MQEfQNlmqQ0aGXXR7fngtWlJJeC6R4zcDhcXucjqvLE,93
|
2
|
+
langchain_nomic/embeddings.py,sha256=S312h3vwoo_zLAjGeU7RWTbDMOFY2GnS5rLY5DC2cN8,2045
|
3
|
+
langchain_nomic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
langchain_nomic-0.0.2.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
|
5
|
+
langchain_nomic-0.0.2.dist-info/METADATA,sha256=tdZzynUWUTNBIbC2CKPJ34vZKfQSzKtfNdBiyNA7c_k,1287
|
6
|
+
langchain_nomic-0.0.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
+
langchain_nomic-0.0.2.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
langchain_nomic/__init__.py,sha256=MQEfQNlmqQ0aGXXR7fngtWlJJeC6R4zcDhcXucjqvLE,93
|
2
|
-
langchain_nomic/embeddings.py,sha256=MA6QpeFoCS8yqE6niTvfXAbgZAOfSdnKPNTg_LsIlt0,1915
|
3
|
-
langchain_nomic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
langchain_nomic-0.0.1.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
|
5
|
-
langchain_nomic-0.0.1.dist-info/METADATA,sha256=ndoYR2_4PpnNn0HmdAcPSlZMRowR1WgD-FFpfSROo-4,1284
|
6
|
-
langchain_nomic-0.0.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
-
langchain_nomic-0.0.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|