langchain-nomic 0.0.1rc0__tar.gz → 0.1.0__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-nomic
3
- Version: 0.0.1rc0
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.12)
15
- Requires-Dist: nomic (>=3.0.7,<4.0.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
@@ -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
- nomic.login(_api_key)
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
- output = embed.text(texts=texts, model=self.model, task_type=task_type)
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
  [tool.poetry]
2
2
  name = "langchain-nomic"
3
- version = "0.0.1rc0"
3
+ version = "0.1.0"
4
4
  description = "An integration package connecting Nomic and LangChain"
5
5
  authors = []
6
6
  readme = "README.md"
@@ -12,8 +12,8 @@ license = "MIT"
12
12
 
13
13
  [tool.poetry.dependencies]
14
14
  python = ">=3.8.1,<4.0"
15
- langchain-core = ">=0.0.12"
16
- nomic = "^3.0.7"
15
+ langchain-core = ">=0.1.46,<0.3"
16
+ nomic = "^3.0.12"
17
17
 
18
18
  [tool.poetry.group.test]
19
19
  optional = true
@@ -21,11 +21,11 @@ optional = true
21
21
  [tool.poetry.group.test.dependencies]
22
22
  pytest = "^7.3.0"
23
23
  freezegun = "^1.2.2"
24
- pytest-mock = "^3.10.0"
24
+ pytest-mock = "^3.10.0"
25
25
  syrupy = "^4.0.2"
26
26
  pytest-watcher = "^0.3.4"
27
27
  pytest-asyncio = "^0.21.1"
28
- langchain-core = {path = "../../core", develop = true}
28
+ langchain-core = { path = "../../core", develop = true }
29
29
 
30
30
  [tool.poetry.group.codespell]
31
31
  optional = true
@@ -46,28 +46,27 @@ ruff = "^0.1.5"
46
46
 
47
47
  [tool.poetry.group.typing.dependencies]
48
48
  mypy = "^0.991"
49
- langchain-core = {path = "../../core", develop = true}
49
+ langchain-core = { path = "../../core", develop = true }
50
50
 
51
51
  [tool.poetry.group.dev]
52
52
  optional = true
53
53
 
54
54
  [tool.poetry.group.dev.dependencies]
55
- langchain-core = {path = "../../core", develop = true}
55
+ langchain-core = { path = "../../core", develop = true }
56
56
 
57
- [tool.ruff]
57
+ [tool.ruff.lint]
58
58
  select = [
59
- "E", # pycodestyle
60
- "F", # pyflakes
61
- "I", # isort
59
+ "E", # pycodestyle
60
+ "F", # pyflakes
61
+ "I", # isort
62
+ "T201", # print
62
63
  ]
63
64
 
64
65
  [tool.mypy]
65
66
  disallow_untyped_defs = "True"
66
67
 
67
68
  [tool.coverage.run]
68
- omit = [
69
- "tests/*",
70
- ]
69
+ omit = ["tests/*"]
71
70
 
72
71
  [build-system]
73
72
  requires = ["poetry-core>=1.0.0"]