langchain-nomic 0.0.1rc0__py3-none-any.whl → 0.1.0__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 +12 -3
- {langchain_nomic-0.0.1rc0.dist-info → langchain_nomic-0.1.0.dist-info}/METADATA +3 -3
- langchain_nomic-0.1.0.dist-info/RECORD +7 -0
- langchain_nomic-0.0.1rc0.dist-info/RECORD +0 -7
- {langchain_nomic-0.0.1rc0.dist-info → langchain_nomic-0.1.0.dist-info}/LICENSE +0 -0
- {langchain_nomic-0.0.1rc0.dist-info → langchain_nomic-0.1.0.dist-info}/WHEEL +0 -0
langchain_nomic/embeddings.py
CHANGED
@@ -3,7 +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
|
6
|
+
from nomic import embed # type: ignore
|
7
7
|
|
8
8
|
|
9
9
|
class NomicEmbeddings(Embeddings):
|
@@ -22,6 +22,7 @@ class NomicEmbeddings(Embeddings):
|
|
22
22
|
*,
|
23
23
|
model: str,
|
24
24
|
nomic_api_key: Optional[str] = None,
|
25
|
+
dimensionality: Optional[int] = None,
|
25
26
|
):
|
26
27
|
"""Initialize NomicEmbeddings model.
|
27
28
|
|
@@ -31,8 +32,10 @@ class NomicEmbeddings(Embeddings):
|
|
31
32
|
environment variable by default.
|
32
33
|
"""
|
33
34
|
_api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
|
34
|
-
|
35
|
+
if _api_key:
|
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,7 +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
|
-
|
48
|
+
|
49
|
+
output = embed.text(
|
50
|
+
texts=texts,
|
51
|
+
model=self.model,
|
52
|
+
task_type=task_type,
|
53
|
+
dimensionality=self.dimensionality,
|
54
|
+
)
|
46
55
|
return output["embeddings"]
|
47
56
|
|
48
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.1.0
|
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.46,<0.3)
|
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.1.0.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
|
5
|
+
langchain_nomic-0.1.0.dist-info/METADATA,sha256=mcsG_BzcXxavKkll8JfW9xKXnxwR7bViaqc6vYamTMQ,1290
|
6
|
+
langchain_nomic-0.1.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
+
langchain_nomic-0.1.0.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
langchain_nomic/__init__.py,sha256=MQEfQNlmqQ0aGXXR7fngtWlJJeC6R4zcDhcXucjqvLE,93
|
2
|
-
langchain_nomic/embeddings.py,sha256=TlzYAPwSAAhT0C59nwVnD06YxvnkAc7Z0Fh1UqI3Bfo,1817
|
3
|
-
langchain_nomic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
langchain_nomic-0.0.1rc0.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
|
5
|
-
langchain_nomic-0.0.1rc0.dist-info/METADATA,sha256=Z8iuL9OYjh4Iajcpg1UTBM32whVB1wIyhRm4_c0KMd0,1287
|
6
|
-
langchain_nomic-0.0.1rc0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
7
|
-
langchain_nomic-0.0.1rc0.dist-info/RECORD,,
|
File without changes
|
File without changes
|