langchain 0.2.8__py3-none-any.whl → 0.2.9__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.

Potentially problematic release.


This version of langchain might be problematic. Click here for more details.

@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import asyncio
3
4
  import json
4
5
  from json import JSONDecodeError
5
6
  from time import sleep
@@ -742,5 +743,5 @@ class OpenAIAssistantRunnable(RunnableSerializable[Dict, OutputType]):
742
743
  )
743
744
  in_progress = run.status in ("in_progress", "queued")
744
745
  if in_progress:
745
- sleep(self.check_every_ms / 1000)
746
+ await asyncio.sleep(self.check_every_ms / 1000)
746
747
  return run
@@ -19,6 +19,8 @@ class SearchType(str, Enum):
19
19
 
20
20
  similarity = "similarity"
21
21
  """Similarity search."""
22
+ similarity_score_threshold = "similarity_score_threshold"
23
+ """Similarity search with a score threshold."""
22
24
  mmr = "mmr"
23
25
  """Maximal Marginal Relevance reranking of similarity search."""
24
26
 
@@ -64,6 +66,13 @@ class MultiVectorRetriever(BaseRetriever):
64
66
  sub_docs = self.vectorstore.max_marginal_relevance_search(
65
67
  query, **self.search_kwargs
66
68
  )
69
+ elif self.search_type == SearchType.similarity_score_threshold:
70
+ sub_docs_and_similarities = (
71
+ self.vectorstore.similarity_search_with_relevance_scores(
72
+ query, **self.search_kwargs
73
+ )
74
+ )
75
+ sub_docs = [sub_doc for sub_doc, _ in sub_docs_and_similarities]
67
76
  else:
68
77
  sub_docs = self.vectorstore.similarity_search(query, **self.search_kwargs)
69
78
 
@@ -89,6 +98,13 @@ class MultiVectorRetriever(BaseRetriever):
89
98
  sub_docs = await self.vectorstore.amax_marginal_relevance_search(
90
99
  query, **self.search_kwargs
91
100
  )
101
+ elif self.search_type == SearchType.similarity_score_threshold:
102
+ sub_docs_and_similarities = (
103
+ await self.vectorstore.asimilarity_search_with_relevance_scores(
104
+ query, **self.search_kwargs
105
+ )
106
+ )
107
+ sub_docs = [sub_doc for sub_doc, _ in sub_docs_and_similarities]
92
108
  else:
93
109
  sub_docs = await self.vectorstore.asimilarity_search(
94
110
  query, **self.search_kwargs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: Building applications with LLMs through composability
5
5
  Home-page: https://github.com/langchain-ai/langchain
6
6
  License: MIT
@@ -15,7 +15,7 @@ Requires-Dist: PyYAML (>=5.3)
15
15
  Requires-Dist: SQLAlchemy (>=1.4,<3)
16
16
  Requires-Dist: aiohttp (>=3.8.3,<4.0.0)
17
17
  Requires-Dist: async-timeout (>=4.0.0,<5.0.0) ; python_version < "3.11"
18
- Requires-Dist: langchain-core (>=0.2.19,<0.3.0)
18
+ Requires-Dist: langchain-core (>=0.2.20,<0.3.0)
19
19
  Requires-Dist: langchain-text-splitters (>=0.2.0,<0.3.0)
20
20
  Requires-Dist: langsmith (>=0.1.17,<0.2.0)
21
21
  Requires-Dist: numpy (>=1,<2) ; python_version < "3.12"
@@ -111,7 +111,7 @@ langchain/agents/mrkl/base.py,sha256=cj73s3Z0JxQotFgqhnxEDNkZT4nlL69g3ZleHkUuma4
111
111
  langchain/agents/mrkl/output_parser.py,sha256=YQGSjQq5pR4kFUg1HrOS3laV6xgtHgtIOQ_TtJY0UFI,3720
112
112
  langchain/agents/mrkl/prompt.py,sha256=2dTMP2lAWiLvCtuEijgQRjbKDlbPEnmx77duMwdJ7e4,641
113
113
  langchain/agents/openai_assistant/__init__.py,sha256=Xssaqoxrix3hn1gKSOLmDRQzTxAoJk0ProGXmXQe8Mw,114
114
- langchain/agents/openai_assistant/base.py,sha256=GEY-Wq6OgPMesE76oNF0Tr2fn_g27R4UXhYUHAOOkvM,28228
114
+ langchain/agents/openai_assistant/base.py,sha256=L_YWEbv9f2MBUae7wpWIka3RroKzU_XXwVpbdP5XfAE,28257
115
115
  langchain/agents/openai_functions_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
116
116
  langchain/agents/openai_functions_agent/agent_token_buffer_memory.py,sha256=t3J3Qku4lvs-EGTbPRzhrxAwTVBoEj4tu5wbl5u2-N0,3764
117
117
  langchain/agents/openai_functions_agent/base.py,sha256=sMPCrDXhJDZ_fnkpy0fJ0Ptfm02w0_3_JXm9Nktq3NQ,13498
@@ -890,7 +890,7 @@ langchain/retrievers/merger_retriever.py,sha256=uzwpkarGfgByXbqCFYNHXL-mczqfTgJI
890
890
  langchain/retrievers/metal.py,sha256=E9KmySjhmpq_kZhDhOLS8sH4KpbOnWUodR4-3Kd2E30,629
891
891
  langchain/retrievers/milvus.py,sha256=f_vi-uodWcS5PyYq-8QD8S7Bx1t_uVswQtqG2D35XnE,796
892
892
  langchain/retrievers/multi_query.py,sha256=2G90v5RxXiqM5JWIz6k8cgSdcrJ4uSGR6cebbCYFhbU,7049
893
- langchain/retrievers/multi_vector.py,sha256=0bt0wTfm1Ha21fH3Ikoln-iXzbnyHIh6lWI1vrmZMaI,3920
893
+ langchain/retrievers/multi_vector.py,sha256=rb5gDEAzhzHURJ-VfKGnvq7erZ-xWklnk8RQCBTNsds,4731
894
894
  langchain/retrievers/outline.py,sha256=uNuqhoHkfDx73ZEYbHbFjVmJfW-eAdLUzyC9EuoV608,635
895
895
  langchain/retrievers/parent_document_retriever.py,sha256=Xhy2tnAl1dmrajt-iu78BiFFp2SEGoy0Zi2lIlljDFY,5236
896
896
  langchain/retrievers/pinecone_hybrid_search.py,sha256=oEbmHdKIZ86H1O8GhzNC1KVfKb_xAJdRJXpODMY6X3Y,674
@@ -1334,8 +1334,8 @@ langchain/vectorstores/xata.py,sha256=HW_Oi5Hz8rH2JaUhRNWQ-3hLYmNzD8eAz6K5YqPArm
1334
1334
  langchain/vectorstores/yellowbrick.py,sha256=-lnjGcRE8Q1nEPOTdbKYTw5noS2cy2ce1ePOU804-_o,624
1335
1335
  langchain/vectorstores/zep.py,sha256=RJ2auxoA6uHHLEZknw3_jeFmYJYVt-PWKMBcNMGV6TM,798
1336
1336
  langchain/vectorstores/zilliz.py,sha256=XhPPIUfKPFJw0_svCoBgCnNkkBLoRVVcyuMfOnE5IxU,609
1337
- langchain-0.2.8.dist-info/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
1338
- langchain-0.2.8.dist-info/METADATA,sha256=PBvkNncvRD6BEs225g95MwUuNTt2Q1VFXjmmjVoCwWU,6854
1339
- langchain-0.2.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1340
- langchain-0.2.8.dist-info/entry_points.txt,sha256=IgKjoXnkkVC8Nm7ggiFMCNAk01ua6RVTb9cmZTVNm5w,58
1341
- langchain-0.2.8.dist-info/RECORD,,
1337
+ langchain-0.2.9.dist-info/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
1338
+ langchain-0.2.9.dist-info/METADATA,sha256=rRRjxzIaypaG1Ho9TlqNp6ruV5ii_yDIhFFC714s8xo,6854
1339
+ langchain-0.2.9.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1340
+ langchain-0.2.9.dist-info/entry_points.txt,sha256=IgKjoXnkkVC8Nm7ggiFMCNAk01ua6RVTb9cmZTVNm5w,58
1341
+ langchain-0.2.9.dist-info/RECORD,,