langchain 0.3.24__py3-none-any.whl → 0.3.26__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.
- langchain/agents/agent_types.py +1 -1
- langchain/agents/initialize.py +2 -1
- langchain/agents/openai_assistant/base.py +4 -0
- langchain/agents/openai_functions_agent/base.py +1 -1
- langchain/agents/openai_functions_multi_agent/base.py +1 -1
- langchain/agents/output_parsers/json.py +1 -1
- langchain/callbacks/manager.py +1 -1
- langchain/callbacks/tracers/base.py +2 -1
- langchain/chains/base.py +1 -1
- langchain/chains/combine_documents/base.py +1 -1
- langchain/chains/combine_documents/map_reduce.py +1 -1
- langchain/chains/combine_documents/map_rerank.py +1 -1
- langchain/chains/conversation/base.py +1 -4
- langchain/chains/loading.py +22 -61
- langchain/chains/sql_database/query.py +17 -1
- langchain/embeddings/base.py +0 -2
- langchain/embeddings/cache.py +100 -14
- langchain/evaluation/agents/trajectory_eval_chain.py +1 -1
- langchain/evaluation/comparison/eval_chain.py +1 -1
- langchain/evaluation/criteria/eval_chain.py +1 -1
- langchain/evaluation/embedding_distance/base.py +1 -1
- langchain/evaluation/qa/eval_chain.py +1 -1
- langchain/evaluation/scoring/eval_chain.py +1 -1
- langchain/evaluation/string_distance/base.py +1 -1
- langchain/memory/buffer.py +2 -1
- langchain/memory/vectorstore.py +1 -1
- langchain/prompts/chat.py +2 -1
- langchain/retrievers/contextual_compression.py +1 -5
- langchain/retrievers/document_compressors/__init__.py +2 -1
- langchain/retrievers/document_compressors/base.py +1 -1
- langchain/retrievers/document_compressors/chain_extract.py +2 -3
- langchain/retrievers/document_compressors/chain_filter.py +2 -3
- langchain/retrievers/document_compressors/cohere_rerank.py +2 -4
- langchain/retrievers/document_compressors/embeddings_filter.py +2 -6
- langchain/retrievers/document_compressors/listwise_rerank.py +4 -1
- langchain/retrievers/self_query/base.py +8 -0
- langchain/runnables/hub.py +2 -1
- langchain/schema/callbacks/tracers/base.py +2 -1
- langchain/smith/evaluation/runner_utils.py +10 -10
- langchain/smith/evaluation/string_run_evaluator.py +9 -2
- {langchain-0.3.24.dist-info → langchain-0.3.26.dist-info}/METADATA +4 -4
- {langchain-0.3.24.dist-info → langchain-0.3.26.dist-info}/RECORD +45 -45
- {langchain-0.3.24.dist-info → langchain-0.3.26.dist-info}/WHEEL +0 -0
- {langchain-0.3.24.dist-info → langchain-0.3.26.dist-info}/entry_points.txt +0 -0
- {langchain-0.3.24.dist-info → langchain-0.3.26.dist-info}/licenses/LICENSE +0 -0
langchain/agents/agent_types.py
CHANGED
|
@@ -15,7 +15,7 @@ from langchain._api.deprecation import AGENT_DEPRECATION_WARNING
|
|
|
15
15
|
class AgentType(str, Enum):
|
|
16
16
|
"""An enum for agent types.
|
|
17
17
|
|
|
18
|
-
See documentation: https://python.langchain.com/
|
|
18
|
+
See documentation: https://python.langchain.com/api_reference/langchain/agents/langchain.agents.agent_types.AgentType.html
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
ZERO_SHOT_REACT_DESCRIPTION = "zero-shot-react-description"
|
langchain/agents/initialize.py
CHANGED
|
@@ -11,7 +11,8 @@ from langchain_core.tools import BaseTool
|
|
|
11
11
|
from langchain._api.deprecation import AGENT_DEPRECATION_WARNING
|
|
12
12
|
from langchain.agents.agent import AgentExecutor
|
|
13
13
|
from langchain.agents.agent_types import AgentType
|
|
14
|
-
from langchain.agents.loading import
|
|
14
|
+
from langchain.agents.loading import load_agent
|
|
15
|
+
from langchain.agents.types import AGENT_TO_CLASS
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
@deprecated(
|
|
@@ -584,6 +584,9 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
|
|
|
584
584
|
answer: Any = [
|
|
585
585
|
msg_content for msg in new_messages for msg_content in msg.content
|
|
586
586
|
]
|
|
587
|
+
attachments = [
|
|
588
|
+
attachment for msg in new_messages for attachment in msg.attachments
|
|
589
|
+
]
|
|
587
590
|
if all(
|
|
588
591
|
(
|
|
589
592
|
isinstance(content, openai.types.beta.threads.TextContentBlock)
|
|
@@ -601,6 +604,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
|
|
|
601
604
|
"output": answer,
|
|
602
605
|
"thread_id": run.thread_id,
|
|
603
606
|
"run_id": run.id,
|
|
607
|
+
"attachments": attachments,
|
|
604
608
|
},
|
|
605
609
|
log="",
|
|
606
610
|
run_id=run.id,
|
|
@@ -13,11 +13,11 @@ from langchain_core.messages import (
|
|
|
13
13
|
)
|
|
14
14
|
from langchain_core.prompts import BasePromptTemplate
|
|
15
15
|
from langchain_core.prompts.chat import (
|
|
16
|
-
BaseMessagePromptTemplate,
|
|
17
16
|
ChatPromptTemplate,
|
|
18
17
|
HumanMessagePromptTemplate,
|
|
19
18
|
MessagesPlaceholder,
|
|
20
19
|
)
|
|
20
|
+
from langchain_core.prompts.message import BaseMessagePromptTemplate
|
|
21
21
|
from langchain_core.runnables import Runnable, RunnablePassthrough
|
|
22
22
|
from langchain_core.tools import BaseTool
|
|
23
23
|
from langchain_core.utils.function_calling import convert_to_openai_function
|
|
@@ -17,11 +17,11 @@ from langchain_core.messages import (
|
|
|
17
17
|
)
|
|
18
18
|
from langchain_core.prompts import BasePromptTemplate
|
|
19
19
|
from langchain_core.prompts.chat import (
|
|
20
|
-
BaseMessagePromptTemplate,
|
|
21
20
|
ChatPromptTemplate,
|
|
22
21
|
HumanMessagePromptTemplate,
|
|
23
22
|
MessagesPlaceholder,
|
|
24
23
|
)
|
|
24
|
+
from langchain_core.prompts.message import BaseMessagePromptTemplate
|
|
25
25
|
from langchain_core.tools import BaseTool
|
|
26
26
|
from pydantic import model_validator
|
|
27
27
|
from typing_extensions import Self
|
|
@@ -5,7 +5,7 @@ from typing import Union
|
|
|
5
5
|
|
|
6
6
|
from langchain_core.agents import AgentAction, AgentFinish
|
|
7
7
|
from langchain_core.exceptions import OutputParserException
|
|
8
|
-
from langchain_core.
|
|
8
|
+
from langchain_core.utils.json import parse_json_markdown
|
|
9
9
|
|
|
10
10
|
from langchain.agents.agent import AgentOutputParser
|
|
11
11
|
|
langchain/callbacks/manager.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Any
|
|
4
4
|
|
|
5
|
+
from langchain_core.callbacks import Callbacks
|
|
5
6
|
from langchain_core.callbacks.manager import (
|
|
6
7
|
AsyncCallbackManager,
|
|
7
8
|
AsyncCallbackManagerForChainGroup,
|
|
@@ -18,7 +19,6 @@ from langchain_core.callbacks.manager import (
|
|
|
18
19
|
CallbackManagerForLLMRun,
|
|
19
20
|
CallbackManagerForRetrieverRun,
|
|
20
21
|
CallbackManagerForToolRun,
|
|
21
|
-
Callbacks,
|
|
22
22
|
ParentRunManager,
|
|
23
23
|
RunManager,
|
|
24
24
|
ahandle_event,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Base interfaces for tracing runs."""
|
|
2
2
|
|
|
3
|
-
from langchain_core.
|
|
3
|
+
from langchain_core.exceptions import TracerException
|
|
4
|
+
from langchain_core.tracers.base import BaseTracer
|
|
4
5
|
|
|
5
6
|
__all__ = ["BaseTracer", "TracerException"]
|
langchain/chains/base.py
CHANGED
|
@@ -11,7 +11,7 @@ from langchain_core.callbacks import (
|
|
|
11
11
|
from langchain_core.documents import Document
|
|
12
12
|
from langchain_core.prompts import BasePromptTemplate, PromptTemplate
|
|
13
13
|
from langchain_core.runnables.config import RunnableConfig
|
|
14
|
-
from langchain_core.
|
|
14
|
+
from langchain_core.utils.pydantic import create_model
|
|
15
15
|
from langchain_text_splitters import RecursiveCharacterTextSplitter, TextSplitter
|
|
16
16
|
from pydantic import BaseModel, Field
|
|
17
17
|
|
|
@@ -8,7 +8,7 @@ from langchain_core._api import deprecated
|
|
|
8
8
|
from langchain_core.callbacks import Callbacks
|
|
9
9
|
from langchain_core.documents import Document
|
|
10
10
|
from langchain_core.runnables.config import RunnableConfig
|
|
11
|
-
from langchain_core.
|
|
11
|
+
from langchain_core.utils.pydantic import create_model
|
|
12
12
|
from pydantic import BaseModel, ConfigDict, model_validator
|
|
13
13
|
|
|
14
14
|
from langchain.chains.combine_documents.base import BaseCombineDocumentsChain
|
|
@@ -9,7 +9,7 @@ from langchain_core._api import deprecated
|
|
|
9
9
|
from langchain_core.callbacks import Callbacks
|
|
10
10
|
from langchain_core.documents import Document
|
|
11
11
|
from langchain_core.runnables.config import RunnableConfig
|
|
12
|
-
from langchain_core.
|
|
12
|
+
from langchain_core.utils.pydantic import create_model
|
|
13
13
|
from pydantic import BaseModel, ConfigDict, model_validator
|
|
14
14
|
from typing_extensions import Self
|
|
15
15
|
|
|
@@ -13,10 +13,7 @@ from langchain.memory.buffer import ConversationBufferMemory
|
|
|
13
13
|
|
|
14
14
|
@deprecated(
|
|
15
15
|
since="0.2.7",
|
|
16
|
-
alternative=
|
|
17
|
-
"RunnableWithMessageHistory: "
|
|
18
|
-
"https://python.langchain.com/v0.2/api_reference/core/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html" # noqa: E501
|
|
19
|
-
),
|
|
16
|
+
alternative="langchain_core.runnables.history.RunnableWithMessageHistory",
|
|
20
17
|
removal="1.0",
|
|
21
18
|
)
|
|
22
19
|
class ConversationChain(LLMChain):
|
langchain/chains/loading.py
CHANGED
|
@@ -219,33 +219,13 @@ def _load_reduce_documents_chain(config: dict, **kwargs: Any) -> ReduceDocuments
|
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
def _load_llm_bash_chain(config: dict, **kwargs: Any) -> Any:
|
|
222
|
-
from
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
llm_chain = load_chain(config.pop("llm_chain_path"), **kwargs)
|
|
230
|
-
# llm attribute is deprecated in favor of llm_chain, here to support old configs
|
|
231
|
-
elif "llm" in config:
|
|
232
|
-
llm_config = config.pop("llm")
|
|
233
|
-
llm = load_llm_from_config(llm_config, **kwargs)
|
|
234
|
-
# llm_path attribute is deprecated in favor of llm_chain_path,
|
|
235
|
-
# its to support old configs
|
|
236
|
-
elif "llm_path" in config:
|
|
237
|
-
llm = load_llm(config.pop("llm_path"), **kwargs)
|
|
238
|
-
else:
|
|
239
|
-
raise ValueError("One of `llm_chain` or `llm_chain_path` must be present.")
|
|
240
|
-
if "prompt" in config:
|
|
241
|
-
prompt_config = config.pop("prompt")
|
|
242
|
-
prompt = load_prompt_from_config(prompt_config)
|
|
243
|
-
elif "prompt_path" in config:
|
|
244
|
-
prompt = load_prompt(config.pop("prompt_path"))
|
|
245
|
-
if llm_chain:
|
|
246
|
-
return LLMBashChain(llm_chain=llm_chain, prompt=prompt, **config)
|
|
247
|
-
else:
|
|
248
|
-
return LLMBashChain(llm=llm, prompt=prompt, **config)
|
|
222
|
+
"""Load LLM Bash chain from config dict"""
|
|
223
|
+
raise NotImplementedError(
|
|
224
|
+
"LLMBash Chain is not available through LangChain anymore. "
|
|
225
|
+
"The relevant code can be found in langchain_experimental, "
|
|
226
|
+
"but it is not appropriate for production usage due to security "
|
|
227
|
+
"concerns. Please refer to langchain-experimental repository for more details."
|
|
228
|
+
)
|
|
249
229
|
|
|
250
230
|
|
|
251
231
|
def _load_llm_checker_chain(config: dict, **kwargs: Any) -> LLMCheckerChain:
|
|
@@ -336,16 +316,12 @@ def _load_map_rerank_documents_chain(
|
|
|
336
316
|
|
|
337
317
|
|
|
338
318
|
def _load_pal_chain(config: dict, **kwargs: Any) -> Any:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
llm_chain = load_chain(config.pop("llm_chain_path"), **kwargs)
|
|
346
|
-
else:
|
|
347
|
-
raise ValueError("One of `llm_chain` or `llm_chain_path` must be present.")
|
|
348
|
-
return PALChain(llm_chain=llm_chain, **config)
|
|
319
|
+
raise NotImplementedError(
|
|
320
|
+
"PALChain is not available through LangChain anymore. "
|
|
321
|
+
"The relevant code can be found in langchain_experimental, "
|
|
322
|
+
"but it is not appropriate for production usage due to security "
|
|
323
|
+
"concerns. Please refer to langchain-experimental repository for more details."
|
|
324
|
+
)
|
|
349
325
|
|
|
350
326
|
|
|
351
327
|
def _load_refine_documents_chain(config: dict, **kwargs: Any) -> RefineDocumentsChain:
|
|
@@ -399,30 +375,15 @@ def _load_qa_with_sources_chain(config: dict, **kwargs: Any) -> QAWithSourcesCha
|
|
|
399
375
|
|
|
400
376
|
|
|
401
377
|
def _load_sql_database_chain(config: dict, **kwargs: Any) -> Any:
|
|
402
|
-
from
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return SQLDatabaseChain(llm_chain=chain, database=database, **config)
|
|
412
|
-
if "llm" in config:
|
|
413
|
-
llm_config = config.pop("llm")
|
|
414
|
-
llm = load_llm_from_config(llm_config, **kwargs)
|
|
415
|
-
elif "llm_path" in config:
|
|
416
|
-
llm = load_llm(config.pop("llm_path"), **kwargs)
|
|
417
|
-
else:
|
|
418
|
-
raise ValueError("One of `llm` or `llm_path` must be present.")
|
|
419
|
-
if "prompt" in config:
|
|
420
|
-
prompt_config = config.pop("prompt")
|
|
421
|
-
prompt = load_prompt_from_config(prompt_config)
|
|
422
|
-
else:
|
|
423
|
-
prompt = None
|
|
424
|
-
|
|
425
|
-
return SQLDatabaseChain.from_llm(llm, database, prompt=prompt, **config)
|
|
378
|
+
"""Load SQL Database chain from config dict."""
|
|
379
|
+
raise NotImplementedError(
|
|
380
|
+
"SQLDatabaseChain is not available through LangChain anymore. "
|
|
381
|
+
"The relevant code can be found in langchain_experimental, "
|
|
382
|
+
"but it is not appropriate for production usage due to security "
|
|
383
|
+
"concerns. Please refer to langchain-experimental repository for more details, "
|
|
384
|
+
"or refer to this tutorial for best practices: "
|
|
385
|
+
"https://python.langchain.com/docs/tutorials/sql_qa/"
|
|
386
|
+
)
|
|
426
387
|
|
|
427
388
|
|
|
428
389
|
def _load_vector_db_qa_with_sources_chain(
|
|
@@ -35,6 +35,8 @@ def create_sql_query_chain(
|
|
|
35
35
|
db: SQLDatabase,
|
|
36
36
|
prompt: Optional[BasePromptTemplate] = None,
|
|
37
37
|
k: int = 5,
|
|
38
|
+
*,
|
|
39
|
+
get_col_comments: Optional[bool] = None,
|
|
38
40
|
) -> Runnable[Union[SQLInput, SQLInputWithTables, dict[str, Any]], str]:
|
|
39
41
|
"""Create a chain that generates SQL queries.
|
|
40
42
|
|
|
@@ -59,6 +61,8 @@ def create_sql_query_chain(
|
|
|
59
61
|
prompt: The prompt to use. If none is provided, will choose one
|
|
60
62
|
based on dialect. Defaults to None. See Prompt section below for more.
|
|
61
63
|
k: The number of results per select statement to return. Defaults to 5.
|
|
64
|
+
get_col_comments: Whether to retrieve column comments along with table info.
|
|
65
|
+
Defaults to False.
|
|
62
66
|
|
|
63
67
|
Returns:
|
|
64
68
|
A chain that takes in a question and generates a SQL query that answers
|
|
@@ -127,10 +131,22 @@ def create_sql_query_chain(
|
|
|
127
131
|
if "dialect" in prompt_to_use.input_variables:
|
|
128
132
|
prompt_to_use = prompt_to_use.partial(dialect=db.dialect)
|
|
129
133
|
|
|
134
|
+
table_info_kwargs = {}
|
|
135
|
+
if get_col_comments:
|
|
136
|
+
if db.dialect not in ("postgresql", "mysql", "oracle"):
|
|
137
|
+
raise ValueError(
|
|
138
|
+
f"get_col_comments=True is only supported for dialects "
|
|
139
|
+
f"'postgresql', 'mysql', and 'oracle'. Received dialect: "
|
|
140
|
+
f"{db.dialect}"
|
|
141
|
+
)
|
|
142
|
+
else:
|
|
143
|
+
table_info_kwargs["get_col_comments"] = True
|
|
144
|
+
|
|
130
145
|
inputs = {
|
|
131
146
|
"input": lambda x: x["question"] + "\nSQLQuery: ",
|
|
132
147
|
"table_info": lambda x: db.get_table_info(
|
|
133
|
-
table_names=x.get("table_names_to_use")
|
|
148
|
+
table_names=x.get("table_names_to_use"),
|
|
149
|
+
**table_info_kwargs,
|
|
134
150
|
),
|
|
135
151
|
}
|
|
136
152
|
return (
|
langchain/embeddings/base.py
CHANGED
|
@@ -2,7 +2,6 @@ import functools
|
|
|
2
2
|
from importlib import util
|
|
3
3
|
from typing import Any, Optional, Union
|
|
4
4
|
|
|
5
|
-
from langchain_core._api import beta
|
|
6
5
|
from langchain_core.embeddings import Embeddings
|
|
7
6
|
from langchain_core.runnables import Runnable
|
|
8
7
|
|
|
@@ -116,7 +115,6 @@ def _check_pkg(pkg: str) -> None:
|
|
|
116
115
|
)
|
|
117
116
|
|
|
118
117
|
|
|
119
|
-
@beta()
|
|
120
118
|
def init_embeddings(
|
|
121
119
|
model: str,
|
|
122
120
|
*,
|
langchain/embeddings/cache.py
CHANGED
|
@@ -12,9 +12,9 @@ from __future__ import annotations
|
|
|
12
12
|
import hashlib
|
|
13
13
|
import json
|
|
14
14
|
import uuid
|
|
15
|
+
import warnings
|
|
15
16
|
from collections.abc import Sequence
|
|
16
|
-
from
|
|
17
|
-
from typing import Callable, Optional, Union, cast
|
|
17
|
+
from typing import Callable, Literal, Optional, Union, cast
|
|
18
18
|
|
|
19
19
|
from langchain_core.embeddings import Embeddings
|
|
20
20
|
from langchain_core.stores import BaseStore, ByteStore
|
|
@@ -25,20 +25,51 @@ from langchain.storage.encoder_backed import EncoderBackedStore
|
|
|
25
25
|
NAMESPACE_UUID = uuid.UUID(int=1985)
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
def
|
|
29
|
-
"""
|
|
30
|
-
hash_value = hashlib.sha1(input_string.encode("utf-8")).hexdigest()
|
|
31
|
-
return uuid.uuid5(NAMESPACE_UUID, hash_value)
|
|
28
|
+
def _sha1_hash_to_uuid(text: str) -> uuid.UUID:
|
|
29
|
+
"""Return a UUID derived from *text* using SHA‑1 (deterministic).
|
|
32
30
|
|
|
31
|
+
Deterministic and fast, **but not collision‑resistant**.
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
A malicious attacker could try to create two different texts that hash to the same
|
|
34
|
+
UUID. This may not necessarily be an issue in the context of caching embeddings,
|
|
35
|
+
but new applications should swap this out for a stronger hash function like
|
|
36
|
+
xxHash, BLAKE2 or SHA‑256, which are collision-resistant.
|
|
37
|
+
"""
|
|
38
|
+
sha1_hex = hashlib.sha1(text.encode("utf-8")).hexdigest()
|
|
39
|
+
# Embed the hex string in `uuid5` to obtain a valid UUID.
|
|
40
|
+
return uuid.uuid5(NAMESPACE_UUID, sha1_hex)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _make_default_key_encoder(namespace: str, algorithm: str) -> Callable[[str], str]:
|
|
44
|
+
"""Create a default key encoder function.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
namespace: Prefix that segregates keys from different embedding models.
|
|
48
|
+
algorithm:
|
|
49
|
+
* `sha1` - fast but not collision‑resistant
|
|
50
|
+
* `blake2b` - cryptographically strong, faster than SHA‑1
|
|
51
|
+
* `sha256` - cryptographically strong, slower than SHA‑1
|
|
52
|
+
* `sha512` - cryptographically strong, slower than SHA‑1
|
|
37
53
|
|
|
54
|
+
Returns:
|
|
55
|
+
A function that encodes a key using the specified algorithm.
|
|
56
|
+
"""
|
|
57
|
+
if algorithm == "sha1":
|
|
58
|
+
_warn_about_sha1_encoder()
|
|
59
|
+
|
|
60
|
+
def _key_encoder(key: str) -> str:
|
|
61
|
+
"""Encode a key using the specified algorithm."""
|
|
62
|
+
if algorithm == "sha1":
|
|
63
|
+
return f"{namespace}{_sha1_hash_to_uuid(key)}"
|
|
64
|
+
if algorithm == "blake2b":
|
|
65
|
+
return f"{namespace}{hashlib.blake2b(key.encode('utf-8')).hexdigest()}"
|
|
66
|
+
if algorithm == "sha256":
|
|
67
|
+
return f"{namespace}{hashlib.sha256(key.encode('utf-8')).hexdigest()}"
|
|
68
|
+
if algorithm == "sha512":
|
|
69
|
+
return f"{namespace}{hashlib.sha512(key.encode('utf-8')).hexdigest()}"
|
|
70
|
+
raise ValueError(f"Unsupported algorithm: {algorithm}")
|
|
38
71
|
|
|
39
|
-
|
|
40
|
-
"""Create an encoder for a key."""
|
|
41
|
-
return partial(_key_encoder, namespace=namespace)
|
|
72
|
+
return _key_encoder
|
|
42
73
|
|
|
43
74
|
|
|
44
75
|
def _value_serializer(value: Sequence[float]) -> bytes:
|
|
@@ -51,6 +82,28 @@ def _value_deserializer(serialized_value: bytes) -> list[float]:
|
|
|
51
82
|
return cast(list[float], json.loads(serialized_value.decode()))
|
|
52
83
|
|
|
53
84
|
|
|
85
|
+
# The warning is global; track emission, so it appears only once.
|
|
86
|
+
_warned_about_sha1: bool = False
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _warn_about_sha1_encoder() -> None:
|
|
90
|
+
"""Emit a one‑time warning about SHA‑1 collision weaknesses."""
|
|
91
|
+
global _warned_about_sha1
|
|
92
|
+
if not _warned_about_sha1:
|
|
93
|
+
warnings.warn(
|
|
94
|
+
"Using default key encoder: SHA‑1 is *not* collision‑resistant. "
|
|
95
|
+
"While acceptable for most cache scenarios, a motivated attacker "
|
|
96
|
+
"can craft two different payloads that map to the same cache key. "
|
|
97
|
+
"If that risk matters in your environment, supply a stronger "
|
|
98
|
+
"encoder (e.g. SHA‑256 or BLAKE2) via the `key_encoder` argument. "
|
|
99
|
+
"If you change the key encoder, consider also creating a new cache, "
|
|
100
|
+
"to avoid (the potential for) collisions with existing keys.",
|
|
101
|
+
category=UserWarning,
|
|
102
|
+
stacklevel=2,
|
|
103
|
+
)
|
|
104
|
+
_warned_about_sha1 = True
|
|
105
|
+
|
|
106
|
+
|
|
54
107
|
class CacheBackedEmbeddings(Embeddings):
|
|
55
108
|
"""Interface for caching results from embedding models.
|
|
56
109
|
|
|
@@ -234,6 +287,9 @@ class CacheBackedEmbeddings(Embeddings):
|
|
|
234
287
|
namespace: str = "",
|
|
235
288
|
batch_size: Optional[int] = None,
|
|
236
289
|
query_embedding_cache: Union[bool, ByteStore] = False,
|
|
290
|
+
key_encoder: Union[
|
|
291
|
+
Callable[[str], str], Literal["sha1", "blake2b", "sha256", "sha512"]
|
|
292
|
+
] = "sha1",
|
|
237
293
|
) -> CacheBackedEmbeddings:
|
|
238
294
|
"""On-ramp that adds the necessary serialization and encoding to the store.
|
|
239
295
|
|
|
@@ -248,9 +304,39 @@ class CacheBackedEmbeddings(Embeddings):
|
|
|
248
304
|
query_embedding_cache: The cache to use for storing query embeddings.
|
|
249
305
|
True to use the same cache as document embeddings.
|
|
250
306
|
False to not cache query embeddings.
|
|
307
|
+
key_encoder: Optional callable to encode keys. If not provided,
|
|
308
|
+
a default encoder using SHA‑1 will be used. SHA-1 is not
|
|
309
|
+
collision-resistant, and a motivated attacker could craft two
|
|
310
|
+
different texts that hash to the same cache key.
|
|
311
|
+
|
|
312
|
+
New applications should use one of the alternative encoders
|
|
313
|
+
or provide a custom and strong key encoder function to avoid this risk.
|
|
314
|
+
|
|
315
|
+
If you change a key encoder in an existing cache, consider
|
|
316
|
+
just creating a new cache, to avoid (the potential for)
|
|
317
|
+
collisions with existing keys or having duplicate keys
|
|
318
|
+
for the same text in the cache.
|
|
319
|
+
|
|
320
|
+
Returns:
|
|
321
|
+
An instance of CacheBackedEmbeddings that uses the provided cache.
|
|
251
322
|
"""
|
|
252
|
-
|
|
253
|
-
|
|
323
|
+
if isinstance(key_encoder, str):
|
|
324
|
+
key_encoder = _make_default_key_encoder(namespace, key_encoder)
|
|
325
|
+
elif callable(key_encoder):
|
|
326
|
+
# If a custom key encoder is provided, it should not be used with a
|
|
327
|
+
# namespace.
|
|
328
|
+
# A user can handle namespacing in directly their custom key encoder.
|
|
329
|
+
if namespace:
|
|
330
|
+
raise ValueError(
|
|
331
|
+
"Do not supply `namespace` when using a custom key_encoder; "
|
|
332
|
+
"add any prefixing inside the encoder itself."
|
|
333
|
+
)
|
|
334
|
+
else:
|
|
335
|
+
raise ValueError(
|
|
336
|
+
"key_encoder must be either 'blake2b', 'sha1', 'sha256', 'sha512' "
|
|
337
|
+
"or a callable that encodes keys."
|
|
338
|
+
)
|
|
339
|
+
|
|
254
340
|
document_embedding_store = EncoderBackedStore[str, list[float]](
|
|
255
341
|
document_embedding_cache,
|
|
256
342
|
key_encoder,
|
|
@@ -16,10 +16,10 @@ from typing import (
|
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
from langchain_core.agents import AgentAction
|
|
19
|
+
from langchain_core.callbacks import Callbacks
|
|
19
20
|
from langchain_core.callbacks.manager import (
|
|
20
21
|
AsyncCallbackManagerForChainRun,
|
|
21
22
|
CallbackManagerForChainRun,
|
|
22
|
-
Callbacks,
|
|
23
23
|
)
|
|
24
24
|
from langchain_core.exceptions import OutputParserException
|
|
25
25
|
from langchain_core.language_models import BaseLanguageModel
|
|
@@ -6,7 +6,7 @@ import logging
|
|
|
6
6
|
import re
|
|
7
7
|
from typing import Any, Optional, Union
|
|
8
8
|
|
|
9
|
-
from langchain_core.callbacks
|
|
9
|
+
from langchain_core.callbacks import Callbacks
|
|
10
10
|
from langchain_core.language_models import BaseLanguageModel
|
|
11
11
|
from langchain_core.output_parsers import BaseOutputParser
|
|
12
12
|
from langchain_core.prompts.prompt import PromptTemplate
|
|
@@ -5,7 +5,7 @@ from collections.abc import Mapping
|
|
|
5
5
|
from enum import Enum
|
|
6
6
|
from typing import Any, Optional, Union
|
|
7
7
|
|
|
8
|
-
from langchain_core.callbacks
|
|
8
|
+
from langchain_core.callbacks import Callbacks
|
|
9
9
|
from langchain_core.language_models import BaseLanguageModel
|
|
10
10
|
from langchain_core.output_parsers import BaseOutputParser
|
|
11
11
|
from langchain_core.prompts import BasePromptTemplate
|
|
@@ -6,10 +6,10 @@ from enum import Enum
|
|
|
6
6
|
from importlib import util
|
|
7
7
|
from typing import Any, Optional
|
|
8
8
|
|
|
9
|
+
from langchain_core.callbacks import Callbacks
|
|
9
10
|
from langchain_core.callbacks.manager import (
|
|
10
11
|
AsyncCallbackManagerForChainRun,
|
|
11
12
|
CallbackManagerForChainRun,
|
|
12
|
-
Callbacks,
|
|
13
13
|
)
|
|
14
14
|
from langchain_core.embeddings import Embeddings
|
|
15
15
|
from langchain_core.utils import pre_init
|
|
@@ -7,7 +7,7 @@ import string
|
|
|
7
7
|
from collections.abc import Sequence
|
|
8
8
|
from typing import Any, Optional
|
|
9
9
|
|
|
10
|
-
from langchain_core.callbacks
|
|
10
|
+
from langchain_core.callbacks import Callbacks
|
|
11
11
|
from langchain_core.language_models import BaseLanguageModel
|
|
12
12
|
from langchain_core.prompts import PromptTemplate
|
|
13
13
|
from pydantic import ConfigDict
|
|
@@ -6,7 +6,7 @@ import logging
|
|
|
6
6
|
import re
|
|
7
7
|
from typing import Any, Optional, Union
|
|
8
8
|
|
|
9
|
-
from langchain_core.callbacks
|
|
9
|
+
from langchain_core.callbacks import Callbacks
|
|
10
10
|
from langchain_core.language_models import BaseLanguageModel
|
|
11
11
|
from langchain_core.output_parsers import BaseOutputParser
|
|
12
12
|
from langchain_core.prompts.prompt import PromptTemplate
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from typing import Any, Callable, Optional
|
|
5
5
|
|
|
6
|
+
from langchain_core.callbacks import Callbacks
|
|
6
7
|
from langchain_core.callbacks.manager import (
|
|
7
8
|
AsyncCallbackManagerForChainRun,
|
|
8
9
|
CallbackManagerForChainRun,
|
|
9
|
-
Callbacks,
|
|
10
10
|
)
|
|
11
11
|
from langchain_core.utils import pre_init
|
|
12
12
|
from pydantic import Field
|
langchain/memory/buffer.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from typing import Any, Optional
|
|
2
2
|
|
|
3
3
|
from langchain_core._api import deprecated
|
|
4
|
+
from langchain_core.memory import BaseMemory
|
|
4
5
|
from langchain_core.messages import BaseMessage, get_buffer_string
|
|
5
6
|
from langchain_core.utils import pre_init
|
|
6
7
|
|
|
7
|
-
from langchain.memory.chat_memory import BaseChatMemory
|
|
8
|
+
from langchain.memory.chat_memory import BaseChatMemory
|
|
8
9
|
from langchain.memory.utils import get_prompt_input_key
|
|
9
10
|
|
|
10
11
|
|
langchain/memory/vectorstore.py
CHANGED
|
@@ -5,10 +5,10 @@ from typing import Any, Optional, Union
|
|
|
5
5
|
|
|
6
6
|
from langchain_core._api import deprecated
|
|
7
7
|
from langchain_core.documents import Document
|
|
8
|
+
from langchain_core.memory import BaseMemory
|
|
8
9
|
from langchain_core.vectorstores import VectorStoreRetriever
|
|
9
10
|
from pydantic import Field
|
|
10
11
|
|
|
11
|
-
from langchain.memory.chat_memory import BaseMemory
|
|
12
12
|
from langchain.memory.utils import get_prompt_input_key
|
|
13
13
|
|
|
14
14
|
|
langchain/prompts/chat.py
CHANGED
|
@@ -2,7 +2,6 @@ from langchain_core.prompt_values import ChatPromptValue, ChatPromptValueConcret
|
|
|
2
2
|
from langchain_core.prompts.chat import (
|
|
3
3
|
AIMessagePromptTemplate,
|
|
4
4
|
BaseChatPromptTemplate,
|
|
5
|
-
BaseMessagePromptTemplate,
|
|
6
5
|
BaseStringMessagePromptTemplate,
|
|
7
6
|
ChatMessagePromptTemplate,
|
|
8
7
|
ChatPromptTemplate,
|
|
@@ -34,3 +33,5 @@ __all__ = [
|
|
|
34
33
|
"MessageLike",
|
|
35
34
|
"MessageLikeRepresentation",
|
|
36
35
|
]
|
|
36
|
+
|
|
37
|
+
from langchain_core.prompts.message import BaseMessagePromptTemplate
|
|
@@ -4,14 +4,10 @@ from langchain_core.callbacks import (
|
|
|
4
4
|
AsyncCallbackManagerForRetrieverRun,
|
|
5
5
|
CallbackManagerForRetrieverRun,
|
|
6
6
|
)
|
|
7
|
-
from langchain_core.documents import Document
|
|
7
|
+
from langchain_core.documents import BaseDocumentCompressor, Document
|
|
8
8
|
from langchain_core.retrievers import BaseRetriever, RetrieverLike
|
|
9
9
|
from pydantic import ConfigDict
|
|
10
10
|
|
|
11
|
-
from langchain.retrievers.document_compressors.base import (
|
|
12
|
-
BaseDocumentCompressor,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
11
|
|
|
16
12
|
class ContextualCompressionRetriever(BaseRetriever):
|
|
17
13
|
"""Retriever that wraps a base retriever and compresses the results."""
|
|
@@ -34,9 +34,10 @@ def __getattr__(name: str) -> Any:
|
|
|
34
34
|
__all__ = [
|
|
35
35
|
"DocumentCompressorPipeline",
|
|
36
36
|
"EmbeddingsFilter",
|
|
37
|
+
"FlashrankRerank",
|
|
37
38
|
"LLMListwiseRerank",
|
|
38
39
|
"LLMChainExtractor",
|
|
39
40
|
"LLMChainFilter",
|
|
40
41
|
"CohereRerank",
|
|
41
42
|
"CrossEncoderReranker",
|
|
42
|
-
]
|
|
43
|
+
]
|
|
@@ -2,7 +2,7 @@ from collections.abc import Sequence
|
|
|
2
2
|
from inspect import signature
|
|
3
3
|
from typing import Optional, Union
|
|
4
4
|
|
|
5
|
-
from langchain_core.callbacks
|
|
5
|
+
from langchain_core.callbacks import Callbacks
|
|
6
6
|
from langchain_core.documents import (
|
|
7
7
|
BaseDocumentCompressor,
|
|
8
8
|
BaseDocumentTransformer,
|
|
@@ -5,8 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
from collections.abc import Sequence
|
|
6
6
|
from typing import Any, Callable, Optional, cast
|
|
7
7
|
|
|
8
|
-
from langchain_core.callbacks
|
|
9
|
-
from langchain_core.documents import Document
|
|
8
|
+
from langchain_core.callbacks import Callbacks
|
|
9
|
+
from langchain_core.documents import BaseDocumentCompressor, Document
|
|
10
10
|
from langchain_core.language_models import BaseLanguageModel
|
|
11
11
|
from langchain_core.output_parsers import BaseOutputParser, StrOutputParser
|
|
12
12
|
from langchain_core.prompts import PromptTemplate
|
|
@@ -14,7 +14,6 @@ from langchain_core.runnables import Runnable
|
|
|
14
14
|
from pydantic import ConfigDict
|
|
15
15
|
|
|
16
16
|
from langchain.chains.llm import LLMChain
|
|
17
|
-
from langchain.retrievers.document_compressors.base import BaseDocumentCompressor
|
|
18
17
|
from langchain.retrievers.document_compressors.chain_extract_prompt import (
|
|
19
18
|
prompt_template,
|
|
20
19
|
)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from collections.abc import Sequence
|
|
4
4
|
from typing import Any, Callable, Optional
|
|
5
5
|
|
|
6
|
-
from langchain_core.callbacks
|
|
7
|
-
from langchain_core.documents import Document
|
|
6
|
+
from langchain_core.callbacks import Callbacks
|
|
7
|
+
from langchain_core.documents import BaseDocumentCompressor, Document
|
|
8
8
|
from langchain_core.language_models import BaseLanguageModel
|
|
9
9
|
from langchain_core.output_parsers import StrOutputParser
|
|
10
10
|
from langchain_core.prompts import BasePromptTemplate, PromptTemplate
|
|
@@ -14,7 +14,6 @@ from pydantic import ConfigDict
|
|
|
14
14
|
|
|
15
15
|
from langchain.chains import LLMChain
|
|
16
16
|
from langchain.output_parsers.boolean import BooleanOutputParser
|
|
17
|
-
from langchain.retrievers.document_compressors.base import BaseDocumentCompressor
|
|
18
17
|
from langchain.retrievers.document_compressors.chain_filter_prompt import (
|
|
19
18
|
prompt_template,
|
|
20
19
|
)
|
|
@@ -5,13 +5,11 @@ from copy import deepcopy
|
|
|
5
5
|
from typing import Any, Optional, Union
|
|
6
6
|
|
|
7
7
|
from langchain_core._api.deprecation import deprecated
|
|
8
|
-
from langchain_core.callbacks
|
|
9
|
-
from langchain_core.documents import Document
|
|
8
|
+
from langchain_core.callbacks import Callbacks
|
|
9
|
+
from langchain_core.documents import BaseDocumentCompressor, Document
|
|
10
10
|
from langchain_core.utils import get_from_dict_or_env
|
|
11
11
|
from pydantic import ConfigDict, model_validator
|
|
12
12
|
|
|
13
|
-
from langchain.retrievers.document_compressors.base import BaseDocumentCompressor
|
|
14
|
-
|
|
15
13
|
|
|
16
14
|
@deprecated(
|
|
17
15
|
since="0.0.30", removal="1.0", alternative_import="langchain_cohere.CohereRerank"
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
from typing import Callable, Optional
|
|
3
3
|
|
|
4
|
-
from langchain_core.callbacks
|
|
5
|
-
from langchain_core.documents import Document
|
|
4
|
+
from langchain_core.callbacks import Callbacks
|
|
5
|
+
from langchain_core.documents import BaseDocumentCompressor, Document
|
|
6
6
|
from langchain_core.embeddings import Embeddings
|
|
7
7
|
from langchain_core.utils import pre_init
|
|
8
8
|
from pydantic import ConfigDict, Field
|
|
9
9
|
|
|
10
|
-
from langchain.retrievers.document_compressors.base import (
|
|
11
|
-
BaseDocumentCompressor,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
10
|
|
|
15
11
|
def _get_similarity_function() -> Callable:
|
|
16
12
|
try:
|
|
@@ -24,7 +24,10 @@ def _get_prompt_input(input_: dict) -> dict[str, Any]:
|
|
|
24
24
|
context = ""
|
|
25
25
|
for index, doc in enumerate(documents):
|
|
26
26
|
context += f"Document ID: {index}\n```{doc.page_content}```\n\n"
|
|
27
|
-
|
|
27
|
+
document_range = "empty list"
|
|
28
|
+
if len(documents) > 0:
|
|
29
|
+
document_range = f"Document ID: 0, ..., Document ID: {len(documents) - 1}"
|
|
30
|
+
context += f"Documents = [{document_range}]"
|
|
28
31
|
return {"query": input_["query"], "context": context}
|
|
29
32
|
|
|
30
33
|
|
|
@@ -154,6 +154,14 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
|
|
|
154
154
|
if isinstance(vectorstore, PineconeVectorStore):
|
|
155
155
|
return PineconeTranslator()
|
|
156
156
|
|
|
157
|
+
try:
|
|
158
|
+
from langchain_milvus import Milvus
|
|
159
|
+
except ImportError:
|
|
160
|
+
pass
|
|
161
|
+
else:
|
|
162
|
+
if isinstance(vectorstore, Milvus):
|
|
163
|
+
return MilvusTranslator()
|
|
164
|
+
|
|
157
165
|
try:
|
|
158
166
|
from langchain_mongodb import MongoDBAtlasVectorSearch
|
|
159
167
|
except ImportError:
|
langchain/runnables/hub.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Any, Optional
|
|
2
2
|
|
|
3
|
-
from langchain_core.runnables.base import
|
|
3
|
+
from langchain_core.runnables.base import RunnableBindingBase
|
|
4
|
+
from langchain_core.runnables.utils import Input, Output
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class HubRunnable(RunnableBindingBase[Input, Output]):
|
|
@@ -19,7 +19,7 @@ from typing import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
from langchain_core._api import warn_deprecated
|
|
22
|
-
from langchain_core.callbacks
|
|
22
|
+
from langchain_core.callbacks import Callbacks
|
|
23
23
|
from langchain_core.language_models import BaseLanguageModel
|
|
24
24
|
from langchain_core.messages import BaseMessage, messages_from_dict
|
|
25
25
|
from langchain_core.outputs import ChatResult, LLMResult
|
|
@@ -331,7 +331,7 @@ def _validate_example_inputs_for_language_model(
|
|
|
331
331
|
input_mapper: Optional[Callable[[dict], Any]],
|
|
332
332
|
) -> None:
|
|
333
333
|
if input_mapper:
|
|
334
|
-
prompt_input = input_mapper(first_example.inputs)
|
|
334
|
+
prompt_input = input_mapper(first_example.inputs or {})
|
|
335
335
|
if not isinstance(prompt_input, str) and not (
|
|
336
336
|
isinstance(prompt_input, list)
|
|
337
337
|
and all(isinstance(msg, BaseMessage) for msg in prompt_input)
|
|
@@ -344,10 +344,10 @@ def _validate_example_inputs_for_language_model(
|
|
|
344
344
|
)
|
|
345
345
|
else:
|
|
346
346
|
try:
|
|
347
|
-
_get_prompt(first_example.inputs)
|
|
347
|
+
_get_prompt(first_example.inputs or {})
|
|
348
348
|
except InputFormatError:
|
|
349
349
|
try:
|
|
350
|
-
_get_messages(first_example.inputs)
|
|
350
|
+
_get_messages(first_example.inputs or {})
|
|
351
351
|
except InputFormatError:
|
|
352
352
|
raise InputFormatError(
|
|
353
353
|
"Example inputs do not match language model input format. "
|
|
@@ -366,7 +366,7 @@ def _validate_example_inputs_for_chain(
|
|
|
366
366
|
) -> None:
|
|
367
367
|
"""Validate that the example inputs match the chain input keys."""
|
|
368
368
|
if input_mapper:
|
|
369
|
-
first_inputs = input_mapper(first_example.inputs)
|
|
369
|
+
first_inputs = input_mapper(first_example.inputs or {})
|
|
370
370
|
missing_keys = set(chain.input_keys).difference(first_inputs)
|
|
371
371
|
if not isinstance(first_inputs, dict):
|
|
372
372
|
raise InputFormatError(
|
|
@@ -780,7 +780,7 @@ async def _arun_llm_or_chain(
|
|
|
780
780
|
if isinstance(llm_or_chain_factory, BaseLanguageModel):
|
|
781
781
|
output: Any = await _arun_llm(
|
|
782
782
|
llm_or_chain_factory,
|
|
783
|
-
example.inputs,
|
|
783
|
+
example.inputs or {},
|
|
784
784
|
tags=config["tags"],
|
|
785
785
|
callbacks=config["callbacks"],
|
|
786
786
|
input_mapper=input_mapper,
|
|
@@ -790,7 +790,7 @@ async def _arun_llm_or_chain(
|
|
|
790
790
|
chain = llm_or_chain_factory()
|
|
791
791
|
output = await _arun_chain(
|
|
792
792
|
chain,
|
|
793
|
-
example.inputs,
|
|
793
|
+
example.inputs or {},
|
|
794
794
|
tags=config["tags"],
|
|
795
795
|
callbacks=config["callbacks"],
|
|
796
796
|
input_mapper=input_mapper,
|
|
@@ -932,7 +932,7 @@ def _run_llm_or_chain(
|
|
|
932
932
|
if isinstance(llm_or_chain_factory, BaseLanguageModel):
|
|
933
933
|
output: Any = _run_llm(
|
|
934
934
|
llm_or_chain_factory,
|
|
935
|
-
example.inputs,
|
|
935
|
+
example.inputs or {},
|
|
936
936
|
config["callbacks"],
|
|
937
937
|
tags=config["tags"],
|
|
938
938
|
input_mapper=input_mapper,
|
|
@@ -942,7 +942,7 @@ def _run_llm_or_chain(
|
|
|
942
942
|
chain = llm_or_chain_factory()
|
|
943
943
|
output = _run_chain(
|
|
944
944
|
chain,
|
|
945
|
-
example.inputs,
|
|
945
|
+
example.inputs or {},
|
|
946
946
|
config["callbacks"],
|
|
947
947
|
tags=config["tags"],
|
|
948
948
|
input_mapper=input_mapper,
|
|
@@ -1226,7 +1226,7 @@ class _DatasetRunContainer:
|
|
|
1226
1226
|
|
|
1227
1227
|
def _is_jupyter_environment() -> bool:
|
|
1228
1228
|
try:
|
|
1229
|
-
from IPython import get_ipython
|
|
1229
|
+
from IPython.core.getipython import get_ipython
|
|
1230
1230
|
|
|
1231
1231
|
res = get_ipython()
|
|
1232
1232
|
return get_ipython() is not None and "zmqshell" in str(type(res))
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import uuid
|
|
5
6
|
from abc import abstractmethod
|
|
6
7
|
from typing import Any, Optional
|
|
7
8
|
|
|
@@ -325,7 +326,10 @@ class StringRunEvaluatorChain(Chain, RunEvaluator):
|
|
|
325
326
|
return feedback
|
|
326
327
|
|
|
327
328
|
def evaluate_run(
|
|
328
|
-
self,
|
|
329
|
+
self,
|
|
330
|
+
run: Run,
|
|
331
|
+
example: Optional[Example] = None,
|
|
332
|
+
evaluator_run_id: Optional[uuid.UUID] = None,
|
|
329
333
|
) -> EvaluationResult:
|
|
330
334
|
"""Evaluate an example."""
|
|
331
335
|
try:
|
|
@@ -339,7 +343,10 @@ class StringRunEvaluatorChain(Chain, RunEvaluator):
|
|
|
339
343
|
)
|
|
340
344
|
|
|
341
345
|
async def aevaluate_run(
|
|
342
|
-
self,
|
|
346
|
+
self,
|
|
347
|
+
run: Run,
|
|
348
|
+
example: Optional[Example] = None,
|
|
349
|
+
evaluator_run_id: Optional[uuid.UUID] = None,
|
|
343
350
|
) -> EvaluationResult:
|
|
344
351
|
"""Evaluate an example."""
|
|
345
352
|
try:
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: langchain
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.26
|
|
4
4
|
Summary: Building applications with LLMs through composability
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/langchain
|
|
7
7
|
Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain%3D%3D0%22&expanded=true
|
|
8
8
|
Project-URL: repository, https://github.com/langchain-ai/langchain
|
|
9
|
-
Requires-Python:
|
|
10
|
-
Requires-Dist: langchain-core<1.0.0,>=0.3.
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Requires-Dist: langchain-core<1.0.0,>=0.3.66
|
|
11
11
|
Requires-Dist: langchain-text-splitters<1.0.0,>=0.3.8
|
|
12
|
-
Requires-Dist: langsmith
|
|
12
|
+
Requires-Dist: langsmith>=0.1.17
|
|
13
13
|
Requires-Dist: pydantic<3.0.0,>=2.7.4
|
|
14
14
|
Requires-Dist: SQLAlchemy<3,>=1.4
|
|
15
15
|
Requires-Dist: requests<3,>=2
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
langchain-0.3.
|
|
2
|
-
langchain-0.3.
|
|
3
|
-
langchain-0.3.
|
|
4
|
-
langchain-0.3.
|
|
1
|
+
langchain-0.3.26.dist-info/METADATA,sha256=DV8GDXcEgBrHKo19stKh4tfDgIaV7ldC_PnutWswsss,7836
|
|
2
|
+
langchain-0.3.26.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
3
|
+
langchain-0.3.26.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
langchain-0.3.26.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
|
|
5
5
|
langchain/__init__.py,sha256=4cqV-N_QJnfjk52DqtR2e72vsmJC1R6PkflvRdLjZQI,13709
|
|
6
6
|
langchain/_api/__init__.py,sha256=0FuHuMNUBMrst1Y1nm5yZzQr2xbLmb7rxMsimqKBXhs,733
|
|
7
7
|
langchain/_api/deprecation.py,sha256=K9VCkmMs_ebfd_wCJppKq4Ahw-mlXkukbsQ69iQVxT0,1246
|
|
@@ -84,7 +84,7 @@ langchain/agents/agent_toolkits/vectorstore/toolkit.py,sha256=X2Q8H0hJu4zYxq-Te5
|
|
|
84
84
|
langchain/agents/agent_toolkits/xorbits/__init__.py,sha256=LJ-yZ3UKg4vjibzbgMXocR03vcsU_7ZvU7TlScM9RlE,1095
|
|
85
85
|
langchain/agents/agent_toolkits/zapier/__init__.py,sha256=19Hc7HG8DzQfg83qqEbYiXA5FklLoRAEOfIs9JqTjX8,22
|
|
86
86
|
langchain/agents/agent_toolkits/zapier/toolkit.py,sha256=BcFOzvckA9ZBz8HTeWUPFc_eIeifE3fIGE5RBSb7Yls,670
|
|
87
|
-
langchain/agents/agent_types.py,sha256=
|
|
87
|
+
langchain/agents/agent_types.py,sha256=ucnjavV1IOS4ynxB5Rl7AdkEvVS-VSm54-LwfsE_XEY,1935
|
|
88
88
|
langchain/agents/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
89
|
langchain/agents/chat/base.py,sha256=_RIVzR3VKN9NMo9qqMiyE1lBFRrQzlHBttk-iIuUQ48,6578
|
|
90
90
|
langchain/agents/chat/output_parser.py,sha256=yhiZ765XA4BPEQwNoCGA00N7LGY44E5jaLB3OlwOcUM,2381
|
|
@@ -104,7 +104,7 @@ langchain/agents/format_scratchpad/openai_functions.py,sha256=_bku5XGavc2zWAOaaW
|
|
|
104
104
|
langchain/agents/format_scratchpad/openai_tools.py,sha256=vyBEqvIZ5HCradWWg0weg4bj9R3nr-CpGZqvSua9HnE,166
|
|
105
105
|
langchain/agents/format_scratchpad/tools.py,sha256=g1lQujvBpu5hr7Mmc_4LENzrHDO5WKiiLA3cUYXeKis,1928
|
|
106
106
|
langchain/agents/format_scratchpad/xml.py,sha256=5ZgWUipBVg78sV_XV0YIBZukHv7fBoi_u4-BYjGbe0g,546
|
|
107
|
-
langchain/agents/initialize.py,sha256=
|
|
107
|
+
langchain/agents/initialize.py,sha256=YUsRnWso7M2YCNyvjrQQVUA56RvoOQotE37Yqzzdnus,3620
|
|
108
108
|
langchain/agents/json_chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
109
109
|
langchain/agents/json_chat/base.py,sha256=Vcok_zXs9eHUS_tkb2IZYBowwKgF4zm4QwWzmHOhuWc,8015
|
|
110
110
|
langchain/agents/json_chat/prompt.py,sha256=gZukOH50C1llQ-AB2QvtL-PSrczv-a-gJLIPYP8z6vA,551
|
|
@@ -115,16 +115,16 @@ langchain/agents/mrkl/base.py,sha256=kkXmm8T_3RyhqT-8l1vWe4QUfONkKI28Q_Om03IzT3k
|
|
|
115
115
|
langchain/agents/mrkl/output_parser.py,sha256=YQGSjQq5pR4kFUg1HrOS3laV6xgtHgtIOQ_TtJY0UFI,3720
|
|
116
116
|
langchain/agents/mrkl/prompt.py,sha256=2dTMP2lAWiLvCtuEijgQRjbKDlbPEnmx77duMwdJ7e4,641
|
|
117
117
|
langchain/agents/openai_assistant/__init__.py,sha256=Xssaqoxrix3hn1gKSOLmDRQzTxAoJk0ProGXmXQe8Mw,114
|
|
118
|
-
langchain/agents/openai_assistant/base.py,sha256=
|
|
118
|
+
langchain/agents/openai_assistant/base.py,sha256=aGosEMmbyNH5Dd6uhylTZ9MeLpsP8GcP11VkWAxpJbE,30552
|
|
119
119
|
langchain/agents/openai_functions_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
120
120
|
langchain/agents/openai_functions_agent/agent_token_buffer_memory.py,sha256=_Czey8clGH7ldn1yl_8_L-RVSCGGHiKeRWxmdeQ1phw,3752
|
|
121
|
-
langchain/agents/openai_functions_agent/base.py,sha256=
|
|
121
|
+
langchain/agents/openai_functions_agent/base.py,sha256=NiJ0oUGi8JZfHuhDxxcPovcfCJMlKeTiow0Fugsm0As,13484
|
|
122
122
|
langchain/agents/openai_functions_multi_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
-
langchain/agents/openai_functions_multi_agent/base.py,sha256=
|
|
123
|
+
langchain/agents/openai_functions_multi_agent/base.py,sha256=z62ZwXVU-xEEJ3KRwqNPhbZha5oxaFRm2qfrOl7vaXU,12654
|
|
124
124
|
langchain/agents/openai_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
125
|
langchain/agents/openai_tools/base.py,sha256=Qd38V_WhyABJ3-6sFX4unF8ydleraNZwLMfM1ZXX9BM,3623
|
|
126
126
|
langchain/agents/output_parsers/__init__.py,sha256=Zzsf8moY-juhKCrnBDUhwgKQtW12cNBkua5faqbAlQA,1374
|
|
127
|
-
langchain/agents/output_parsers/json.py,sha256=
|
|
127
|
+
langchain/agents/output_parsers/json.py,sha256=oVilzM_VDmOYzpzQITl1NC4wgspECRbnjbmblTell5Q,1922
|
|
128
128
|
langchain/agents/output_parsers/openai_functions.py,sha256=VF7-gQAn8TW-c-6uSUhjNtH0VYOf1KjDXSjjI9aMnak,3461
|
|
129
129
|
langchain/agents/output_parsers/openai_tools.py,sha256=naJ78SR_gjtK9v-gxBV8h8ObU7p3udJC7FflqDxcITA,2311
|
|
130
130
|
langchain/agents/output_parsers/react_json_single_input.py,sha256=Su-mST0HR0nx4TF0tkRvimfMmAoXsxK_TSxGnDZBDlA,2487
|
|
@@ -173,7 +173,7 @@ langchain/callbacks/human.py,sha256=WOCe2OoWAkqHaAOrEEVyrBeziFxDrAQB-VDd4qvcnjA,
|
|
|
173
173
|
langchain/callbacks/infino_callback.py,sha256=O-n4mZsUOKNFXOeg-f1JQpxaDvnoLCWMJbMIOdsEPLE,683
|
|
174
174
|
langchain/callbacks/labelstudio_callback.py,sha256=d8eV4rnMsyEfwjf7wMXlmMmTc62helxUIAuXdGrqfFc,1006
|
|
175
175
|
langchain/callbacks/llmonitor_callback.py,sha256=vMf-gameGtVaxQJpU0yFtnPISKOTCzL-4crqE6TpTjw,715
|
|
176
|
-
langchain/callbacks/manager.py,sha256=
|
|
176
|
+
langchain/callbacks/manager.py,sha256=RVhR9cFxt0S5VGkyZ1bPadybEr6lnWDPtVHtvpZ0J1s,2442
|
|
177
177
|
langchain/callbacks/mlflow_callback.py,sha256=jQdNezahCLU5Xul68z062bYm8kMWF2PqNpFwmaRNgNA,1137
|
|
178
178
|
langchain/callbacks/openai_info.py,sha256=itbKLqSBimynyvLgtVoCIbUldS-9qb4o6mQxRdGi0eE,675
|
|
179
179
|
langchain/callbacks/promptlayer_callback.py,sha256=Y5KIbFF4L5Kc3cwAQay16LJ7eBzOHd0Nqs3BM8_kskI,725
|
|
@@ -187,7 +187,7 @@ langchain/callbacks/streamlit/__init__.py,sha256=P-sIGK8JkfcmGEGqvZEMxKbyrW5V4kG
|
|
|
187
187
|
langchain/callbacks/streamlit/mutable_expander.py,sha256=tDjsm1dzCHDPDxuyh7FwOXmI6BA35gqN_JRDzvhRLLU,937
|
|
188
188
|
langchain/callbacks/streamlit/streamlit_callback_handler.py,sha256=JlhRjQv4pgwENVkU6W4CwhfQUUL6PIdAhyE3VOpkNPM,1372
|
|
189
189
|
langchain/callbacks/tracers/__init__.py,sha256=U-NgyWTmQE3tn7qSFfAoBiXX5n3DKJ3gkSOyMIPQNfk,1140
|
|
190
|
-
langchain/callbacks/tracers/base.py,sha256=
|
|
190
|
+
langchain/callbacks/tracers/base.py,sha256=DtvdGR9-kJt1KwVQp9hiyGJWDZkOqf9djI3K6cYAVGg,191
|
|
191
191
|
langchain/callbacks/tracers/comet.py,sha256=RpLXGmn8RDx029pHl17bC2en2M0D3bDze4uxIcDPYlc,800
|
|
192
192
|
langchain/callbacks/tracers/evaluation.py,sha256=ryLN36OsLjXiJmb_helQqxULOYt6BcJehH5OQvSe92A,234
|
|
193
193
|
langchain/callbacks/tracers/langchain.py,sha256=KS1qe0UMdmQzoESWw696yWtQyg4_ZSXj4kNOtLfWFlU,218
|
|
@@ -216,13 +216,13 @@ langchain/chains/api/openapi/response_chain.py,sha256=7vHhIF1-3JUgOXeyWb9CAkG0Ji
|
|
|
216
216
|
langchain/chains/api/podcast_docs.py,sha256=mPW1GrX0X6kaGuGpVYFXNvSoLNoUFse8CaoJSUSa4KU,1920
|
|
217
217
|
langchain/chains/api/prompt.py,sha256=YERLepjWuo2J4wg40DWWfHH4Tsm-9eab-cIllHFxMk4,1031
|
|
218
218
|
langchain/chains/api/tmdb_docs.py,sha256=8yoowa2d53-oytU0dycV-0w9wRe9xOXAPz-s8gQ6EpE,1537
|
|
219
|
-
langchain/chains/base.py,sha256=
|
|
219
|
+
langchain/chains/base.py,sha256=SRy6JuiS63XrwIs4-msZiw1QShppzz_q2qBErzoYFEw,30546
|
|
220
220
|
langchain/chains/chat_vector_db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
221
221
|
langchain/chains/chat_vector_db/prompts.py,sha256=4YM7z5Wi8ftJEVj3ZG8YOcudYwGHCNvQh4Gf_6592yc,694
|
|
222
222
|
langchain/chains/combine_documents/__init__.py,sha256=tJZmkLOD4JGjh9OxkCdTMUzbBCb-47fHLyklQo6ida4,367
|
|
223
|
-
langchain/chains/combine_documents/base.py,sha256=
|
|
224
|
-
langchain/chains/combine_documents/map_reduce.py,sha256=
|
|
225
|
-
langchain/chains/combine_documents/map_rerank.py,sha256=
|
|
223
|
+
langchain/chains/combine_documents/base.py,sha256=ECAnAbwIKAWBg3K2xygxagriHCZ9iAE7_v7PAyJsQ1E,10148
|
|
224
|
+
langchain/chains/combine_documents/map_reduce.py,sha256=hmfrU87WQcmh6qfKE1pQbf4gemi_kMJ5Sf3CpSq1SfY,12073
|
|
225
|
+
langchain/chains/combine_documents/map_rerank.py,sha256=3l-TvInyERtM_I66drmLI9yppVxViGgsA9Y0Aj033CE,9328
|
|
226
226
|
langchain/chains/combine_documents/reduce.py,sha256=ab-Y2cZlXz2mMslXbYGICTgsy6Li1XSBXTZ-_ZnRD38,14146
|
|
227
227
|
langchain/chains/combine_documents/refine.py,sha256=4i3I0u6O2ii3me1dG7Xs8o_5FPUSiN_vsxtugjJK2Ck,9444
|
|
228
228
|
langchain/chains/combine_documents/stuff.py,sha256=4wnolhMth9SKLcQ5nsfIMDH-dyrgi04dh53tW_RzEZM,11536
|
|
@@ -232,7 +232,7 @@ langchain/chains/constitutional_ai/models.py,sha256=D_p--Zt-ut32VuU5nHdqmPv5vFZE
|
|
|
232
232
|
langchain/chains/constitutional_ai/principles.py,sha256=vElwvF1w4h8URsj38ucmoKp9hUCzf0sJyoNQmKv1Kws,21739
|
|
233
233
|
langchain/chains/constitutional_ai/prompts.py,sha256=vL7qEGpLZShdKY8i07874peWB63eTYud6iPJcWcD-Y4,9072
|
|
234
234
|
langchain/chains/conversation/__init__.py,sha256=hpIiQSoUe0bGkqAGKxG_CEYRFsjHRL4l5uBEpCBetFc,71
|
|
235
|
-
langchain/chains/conversation/base.py,sha256=
|
|
235
|
+
langchain/chains/conversation/base.py,sha256=bJySvhK1iPQuPfOr9KFRRRN0NjA96rmhuoGbW65imNk,5388
|
|
236
236
|
langchain/chains/conversation/memory.py,sha256=KoKmk5FjPEkioolvmFxcJgRr2wRdWIe1LNBHCtGgUKo,1396
|
|
237
237
|
langchain/chains/conversation/prompt.py,sha256=84xC4dy8yNiCSICT4b6UvZdQXpPifMVw1hf7WnFAVkw,913
|
|
238
238
|
langchain/chains/conversational_retrieval/__init__.py,sha256=hq7jx-kmg3s8qLYnV7gPmzVIPcGqW69H6cXIjklvGjY,49
|
|
@@ -282,7 +282,7 @@ langchain/chains/llm_summarization_checker/prompts/check_facts.txt,sha256=Du-gC9
|
|
|
282
282
|
langchain/chains/llm_summarization_checker/prompts/create_facts.txt,sha256=hM2_EVxM_8iL3rm7ui17NAUKoHCjpqhYjdXO6NQ6lEI,128
|
|
283
283
|
langchain/chains/llm_summarization_checker/prompts/revise_summary.txt,sha256=nSSq5UQMx6gvjMKIs2t_ituuEQzu2nni1wdnywAe-5U,416
|
|
284
284
|
langchain/chains/llm_symbolic_math/__init__.py,sha256=KQ6bFiFMsqs8PNtU-oo6l-czNBBwQUn2rEirz3gt-w8,470
|
|
285
|
-
langchain/chains/loading.py,sha256=
|
|
285
|
+
langchain/chains/loading.py,sha256=T__eL9HaBbLG0LebbNRNr7670BL3jOMJ5EkuctVF7e8,27139
|
|
286
286
|
langchain/chains/mapreduce.py,sha256=rUPiSmczMETU4QnmzPQ7vmiUiNqQxRhlVOz4gSgVNfs,4132
|
|
287
287
|
langchain/chains/moderation.py,sha256=K67npAUpKS6ERZBXCgWi1E1KD_SqocSgck5IEgXUgUY,4490
|
|
288
288
|
langchain/chains/natbot/__init__.py,sha256=ACF2TYNK_CTfvmdLlG5Ry0_j9D6ZfjgfQxmeKe1BAIg,96
|
|
@@ -338,7 +338,7 @@ langchain/chains/router/multi_retrieval_qa.py,sha256=0LMZinYl0G7tDYh-I6eBOy54oxk
|
|
|
338
338
|
langchain/chains/sequential.py,sha256=mroXm1uj-D3iA_MxiZT_FnTMngYLcEQWA8loclbqvcs,7487
|
|
339
339
|
langchain/chains/sql_database/__init__.py,sha256=jQotWN4EWMD98Jk-f7rqh5YtbXbP9XXA0ypLGq8NgrM,47
|
|
340
340
|
langchain/chains/sql_database/prompt.py,sha256=q3C6BbmWtNYXWV-9qHnyux5trsM3fjlRLuYNPTlpdR4,15454
|
|
341
|
-
langchain/chains/sql_database/query.py,sha256=
|
|
341
|
+
langchain/chains/sql_database/query.py,sha256=kSEveCV-Y2b3mwe-sfT20UI57_jByaTucmYmzywLsEY,6037
|
|
342
342
|
langchain/chains/structured_output/__init__.py,sha256=-6nFe-gznavFc3XCMv8XkEzuXoto2rI8Q-bcruVPOR8,204
|
|
343
343
|
langchain/chains/structured_output/base.py,sha256=qnALOtvJq5SEN5aRfzU3cdxGB9dmEr_jrHt-FMlilA8,25472
|
|
344
344
|
langchain/chains/summarize/__init__.py,sha256=mg1lKtH_x-oJ5qvKY6OD7g9kkqbjMVbL3l3OhfozSQM,151
|
|
@@ -581,10 +581,10 @@ langchain/embeddings/aleph_alpha.py,sha256=_yTqGDHsHbh83Zp0MjJ497ilIxkEJm5ccmxOW
|
|
|
581
581
|
langchain/embeddings/awa.py,sha256=1cnMiwKKU3ml3Zz5s5WIpcZSlYNVFFGCaeJilrxN8HE,626
|
|
582
582
|
langchain/embeddings/azure_openai.py,sha256=tmICp-NOrxoVFENBy4F_0-c0l3znf8bOtBBo-UZhajg,650
|
|
583
583
|
langchain/embeddings/baidu_qianfan_endpoint.py,sha256=w7BeE53d7o9Y8Xf0cZntmmziih7oBJcmF-jBW70KJlc,662
|
|
584
|
-
langchain/embeddings/base.py,sha256=
|
|
584
|
+
langchain/embeddings/base.py,sha256=g1TgfcjKScPiWXWVUuoYS7U5uAudp5eGdS38cUVL9e0,7492
|
|
585
585
|
langchain/embeddings/bedrock.py,sha256=tCBm3vcN0B21Ga6KvNwhgJpgjobC2VEcmPApUmwXO4E,638
|
|
586
586
|
langchain/embeddings/bookend.py,sha256=qWaQXZw9Gq11kEdfIO71h1H0NaXqVKm45TiStxd2xaM,638
|
|
587
|
-
langchain/embeddings/cache.py,sha256=
|
|
587
|
+
langchain/embeddings/cache.py,sha256=U7qT2sr3bzvW_8g7ik_t57q0wsMdu8Doq1DbjGiv5cE,14237
|
|
588
588
|
langchain/embeddings/clarifai.py,sha256=rKRbBFFCNFBkIFhH6vwvZleEvMDPOXfERXmcBzISQLg,641
|
|
589
589
|
langchain/embeddings/cloudflare_workersai.py,sha256=VFbhKreyN4ACAULhzL17N1GpSUADPiNNdOyLf57J4d4,756
|
|
590
590
|
langchain/embeddings/cohere.py,sha256=d9lGFQsv52mwqZ_hgyL2B-SgjZtx1xCVJwAMXCN9LU4,635
|
|
@@ -630,16 +630,16 @@ langchain/embeddings/xinference.py,sha256=nehpiy79abQ78Bm-Y9DA8FDvpACXROSIats0S6
|
|
|
630
630
|
langchain/env.py,sha256=fucAbfcmwiN1CjKSg5l2lzquRVoE7wqfuMMlaByuyEk,476
|
|
631
631
|
langchain/evaluation/__init__.py,sha256=1iX4-CeK-YkKtQh8npkJ5fhtbRPM668pPCz6SZ6WdJs,5803
|
|
632
632
|
langchain/evaluation/agents/__init__.py,sha256=Z3RFhkBgSauIRNp5dEUgkzY1Tr3kSeUwuotd0nrQViQ,166
|
|
633
|
-
langchain/evaluation/agents/trajectory_eval_chain.py,sha256=
|
|
633
|
+
langchain/evaluation/agents/trajectory_eval_chain.py,sha256=vlb3_nsSDNTB4P_eH-7RwH_FGIgH_EOhMAERqdiWtY0,13957
|
|
634
634
|
langchain/evaluation/agents/trajectory_eval_prompt.py,sha256=NY-kAJqoXfPP9zI9WsvEHEDp00ImG1Po9vBZm3U684M,5939
|
|
635
635
|
langchain/evaluation/comparison/__init__.py,sha256=1nxR3mXQ8eimpDjfarJgDRe30YjL2yeOYkFaNj09fRY,1401
|
|
636
|
-
langchain/evaluation/comparison/eval_chain.py,sha256=
|
|
636
|
+
langchain/evaluation/comparison/eval_chain.py,sha256=CWsCG46F6c8NHCuhcjd8u7hoOjJNA1OCJgxlQLfNYwc,15854
|
|
637
637
|
langchain/evaluation/comparison/prompt.py,sha256=_mvS1BsSm4aBHUQjUWtNAYGwtLj9sYOIvPi4jZRWs6M,2359
|
|
638
638
|
langchain/evaluation/criteria/__init__.py,sha256=FE5qrrz5JwWXJWXCzdyNRevEPfmmfBfjfHx-hR3pCWg,1647
|
|
639
|
-
langchain/evaluation/criteria/eval_chain.py,sha256=
|
|
639
|
+
langchain/evaluation/criteria/eval_chain.py,sha256=oo8pvPvmxglIudfVF4OQ0yzD36k6DM4--YQPkhVjJn8,21234
|
|
640
640
|
langchain/evaluation/criteria/prompt.py,sha256=6OgXmdvlYVzRMeAxa1fYGIxqeNAz1NkFCZ6ezLgUnZM,1756
|
|
641
641
|
langchain/evaluation/embedding_distance/__init__.py,sha256=YLtGUI4ZMxjsn2Q0dGZ-R9YMFgZsarfJv9qzNEnrLQs,324
|
|
642
|
-
langchain/evaluation/embedding_distance/base.py,sha256=
|
|
642
|
+
langchain/evaluation/embedding_distance/base.py,sha256=YaOKMstSkZfu-IWc93cH_LwHIQPrhDFdwUdLTJFAL3c,18964
|
|
643
643
|
langchain/evaluation/exact_match/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
644
644
|
langchain/evaluation/exact_match/base.py,sha256=9zhRWHyeyBlM2X_I34cnpnWGOiiCzGVpdP9zBlGpBX0,2736
|
|
645
645
|
langchain/evaluation/loading.py,sha256=Fbiv3f9j_UmFCANo_Kl0qSscVr8QjuEaKLH9rwnPKG8,7324
|
|
@@ -648,7 +648,7 @@ langchain/evaluation/parsing/base.py,sha256=oshaVFsY9ggIgOZX_3Xe-x7LPSRaQejmqLRT
|
|
|
648
648
|
langchain/evaluation/parsing/json_distance.py,sha256=00h1wUNQyvjQiXi2OWlKb50Hcn_X55w4kndM1L38cAM,3662
|
|
649
649
|
langchain/evaluation/parsing/json_schema.py,sha256=KaayfLXQAYwQlCbiF06oSJjT624IiwSb1QjbXig75Cs,3178
|
|
650
650
|
langchain/evaluation/qa/__init__.py,sha256=_uUrc6UBe5Bcy5qZKhumLbKzLCKES0bioUylyJ0SB8c,345
|
|
651
|
-
langchain/evaluation/qa/eval_chain.py,sha256=
|
|
651
|
+
langchain/evaluation/qa/eval_chain.py,sha256=SxzPLzHiGr1q2rZu7RmV38A_C8OQyyr9YlGCpgE9JF0,10813
|
|
652
652
|
langchain/evaluation/qa/eval_prompt.py,sha256=zfJxS2-SI_SOXBDFp0xRpNAOgeELV3ti9EhcV2DFO_Y,3911
|
|
653
653
|
langchain/evaluation/qa/generate_chain.py,sha256=16mh7KMQvwBnYRNfTuUHcr2nKDxo2mAmiIWxQETADk0,1035
|
|
654
654
|
langchain/evaluation/qa/generate_prompt.py,sha256=g6U9K8-eq7JXOjFJokFEfBtLnHp-fpK1rgIwWYZ9Odc,606
|
|
@@ -656,10 +656,10 @@ langchain/evaluation/regex_match/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
656
656
|
langchain/evaluation/regex_match/base.py,sha256=aixGwYPJu7Cac-08-98P50a3QlXsMhyHq0KKaFYZTwY,2392
|
|
657
657
|
langchain/evaluation/schema.py,sha256=yYnf-zDWTb7IaleQhtHQeA1-u45u9Dx9z71GuiY317s,18202
|
|
658
658
|
langchain/evaluation/scoring/__init__.py,sha256=D5zPsGRGCpg3KJkfAu2SN096jZi9FRlDlG4fiYV1Ko8,1113
|
|
659
|
-
langchain/evaluation/scoring/eval_chain.py,sha256=
|
|
659
|
+
langchain/evaluation/scoring/eval_chain.py,sha256=vLscTavSFq-Ur3CMhtwJtmagdsmN3GTQMCVuh8Bkb2k,15385
|
|
660
660
|
langchain/evaluation/scoring/prompt.py,sha256=WqNq8bktJUjU8tcHWVuPJFWgsOIc-G7fYMDiejHhWIY,2130
|
|
661
661
|
langchain/evaluation/string_distance/__init__.py,sha256=qAz9Z709ocAi_Yd9nbkKnFt16nc9d_gTT55N7okXWmE,286
|
|
662
|
-
langchain/evaluation/string_distance/base.py,sha256=
|
|
662
|
+
langchain/evaluation/string_distance/base.py,sha256=3Jj0X5fL0rXQxLINYX5lLZLOC7aFwdzTWQyvEx1X5uI,14033
|
|
663
663
|
langchain/example_generator.py,sha256=q_JvQKn2pgJOHcBeFc851GpaR4seOZXDe9TISAJheEY,142
|
|
664
664
|
langchain/formatting.py,sha256=4s5AwApo_6t2pVfoFXOgFU9sNNdpVDD44B4ryOwJMJo,168
|
|
665
665
|
langchain/globals.py,sha256=SUMrEo_KlpODNBDj4JZDILhbxTK_GGDEYmUQVQ-Hzus,7436
|
|
@@ -777,7 +777,7 @@ langchain/load/dump.py,sha256=st-Wju0x5jrMVfMzjeKF1jo3Jvn8b1cCCfLrAaIYvhM,100
|
|
|
777
777
|
langchain/load/load.py,sha256=sxSF6ySrMY4ouq77JPiuZKRx2lyVbqLoMi5ni5bHzAI,98
|
|
778
778
|
langchain/load/serializable.py,sha256=6iZp1sg_ozIDqXTDEk60IP89UEwZEJ4j0oMaHascLKI,412
|
|
779
779
|
langchain/memory/__init__.py,sha256=kQFlaG2Yuz1Y7U8e3Ngbv-13I3BPGKAI06Lz9sL-Lbc,5574
|
|
780
|
-
langchain/memory/buffer.py,sha256=
|
|
780
|
+
langchain/memory/buffer.py,sha256=Yugij56iMjL4gVxmFoxlGbYeJ1AE54Pcnp5PrVoex4g,6026
|
|
781
781
|
langchain/memory/buffer_window.py,sha256=6S3t4gnAlroddQuonLn_r-XCTUAvk9tcWsmJwMRVJIc,1974
|
|
782
782
|
langchain/memory/chat_memory.py,sha256=NQYpBiI9AxjA20kLM4IuQQ_vdheOV1lE0iJi9iT2aNA,3434
|
|
783
783
|
langchain/memory/chat_message_histories/__init__.py,sha256=AdCCNl_rxX4OVVLK6ZwwpMTo8VXzAS4v9bH1v2QjHec,3506
|
|
@@ -812,7 +812,7 @@ langchain/memory/summary.py,sha256=ziSQc8Q8UY8HJ0E5O-hubvB-rGP0ntf4YO1p9E6AfgE,4
|
|
|
812
812
|
langchain/memory/summary_buffer.py,sha256=bfhvQ8lcAQ1hDcP62BvShynBGih9hpy7ndpYQuHcuas,5502
|
|
813
813
|
langchain/memory/token_buffer.py,sha256=cCGS4l9lD846WHzif-vAdmoWQ7FFBVqdJ2GWVSgQWHE,2544
|
|
814
814
|
langchain/memory/utils.py,sha256=LFDdAV-vKYwLSsPtbHx600SHs9lXDaMvdH06TjFDvlU,605
|
|
815
|
-
langchain/memory/vectorstore.py,sha256=
|
|
815
|
+
langchain/memory/vectorstore.py,sha256=cNTaPoSqzSs1JADI3ytE8bDrdJoJq6YyLTIlh4UI6vo,4197
|
|
816
816
|
langchain/memory/vectorstore_token_buffer_memory.py,sha256=OiOGOp26ti9PAgI7M4Na5fz_ynROc-Tgc135n6ZuPQI,7618
|
|
817
817
|
langchain/memory/zep_memory.py,sha256=WMrAJ7jymx0_0d3JnhCuklJxfomsGhEEEQ6uPMJ21Bo,628
|
|
818
818
|
langchain/model_laboratory.py,sha256=vTxTAwZxqWH3ZxuWgAbwit49n28_N_HRvk7s_WjaMjE,4080
|
|
@@ -841,7 +841,7 @@ langchain/output_parsers/xml.py,sha256=WDHazWjxO-nDAzxkBJrd1tGINVrzo4mH2-Qgqtz9Y
|
|
|
841
841
|
langchain/output_parsers/yaml.py,sha256=L2hGULhPjMEIMR0iBF3BKHTB1kIto9H68v-UeQDMGR8,2403
|
|
842
842
|
langchain/prompts/__init__.py,sha256=TrRYiHB4qLiB8Ai4OohIijntIy_Xd5Y76cbZjPxjWNI,3153
|
|
843
843
|
langchain/prompts/base.py,sha256=QATYkT1NM2-QElHrC4qapaOm3FDxDOgPCdJixuziSbM,565
|
|
844
|
-
langchain/prompts/chat.py,sha256=
|
|
844
|
+
langchain/prompts/chat.py,sha256=_eXFm_t5OKEW5IYujtl2xGNlNWJdmE_SUPffvM5BQlk,1084
|
|
845
845
|
langchain/prompts/example_selector/__init__.py,sha256=xW0hmB8xziqLrPbvNTusslJgwdBtV7k8bzWhz_YjpDs,1153
|
|
846
846
|
langchain/prompts/example_selector/base.py,sha256=3n6781kzGl-MphxZkad_GvFBgU5r8VuxD2q6FOcZ5fk,105
|
|
847
847
|
langchain/prompts/example_selector/length_based.py,sha256=ZA-o8JtrvRldXlow83arXEPZJL69c2q6-cCclgi85yg,136
|
|
@@ -867,21 +867,21 @@ langchain/retrievers/bm25.py,sha256=L3Pq77NNfV0YDlMkU-ODvJN8ksi1SROQ-vYpPqN5gHs,
|
|
|
867
867
|
langchain/retrievers/chaindesk.py,sha256=e3oHctHNecz14jz70sMw0_YrFjeWXv7Q04r--DnxWq4,641
|
|
868
868
|
langchain/retrievers/chatgpt_plugin_retriever.py,sha256=Pds7FgWv-e6u43noFsO3v2YV8Y6FUjdkmYs5zjl79Nk,653
|
|
869
869
|
langchain/retrievers/cohere_rag_retriever.py,sha256=YMhx_AmBHUDw6-_cQtnESl0WKjtRmjvbDNQvZs3iYm4,641
|
|
870
|
-
langchain/retrievers/contextual_compression.py,sha256=
|
|
870
|
+
langchain/retrievers/contextual_compression.py,sha256=9J7Cww0lFbnVk1fMApPKKbcW95JwWqjHPVlbX3zXbwc,2226
|
|
871
871
|
langchain/retrievers/databerry.py,sha256=uMTLwG-QWCaORSPeFshi105VvXCizjF6551XHXXjzcE,661
|
|
872
872
|
langchain/retrievers/docarray.py,sha256=5BHkTy7uI5HUFi-k9qS6ZYxMyGdKbAwxhKqpz3cNCTM,791
|
|
873
|
-
langchain/retrievers/document_compressors/__init__.py,sha256=
|
|
874
|
-
langchain/retrievers/document_compressors/base.py,sha256=
|
|
875
|
-
langchain/retrievers/document_compressors/chain_extract.py,sha256=
|
|
873
|
+
langchain/retrievers/document_compressors/__init__.py,sha256=erHXIJcUXsPkA-6VDBmZb1_vWgzlG-pjDH-SXaWLguI,1256
|
|
874
|
+
langchain/retrievers/document_compressors/base.py,sha256=z01dmqPWSPDjUVTxAUw0WO4hvEab-leJObiwzlfjFTM,2950
|
|
875
|
+
langchain/retrievers/document_compressors/chain_extract.py,sha256=Xc6uT3dsjLuvEMh6Vl-6-0wHL3Y3F_2vAdvFiBERLlI,4404
|
|
876
876
|
langchain/retrievers/document_compressors/chain_extract_prompt.py,sha256=FezN4Fk0tRcRFcD1Nf1r2SUyUt49yQKzdcV_iCQj6rE,366
|
|
877
|
-
langchain/retrievers/document_compressors/chain_filter.py,sha256=
|
|
877
|
+
langchain/retrievers/document_compressors/chain_filter.py,sha256=IS_Q-rRETQsmTl8O8M4oQlu53O8vDhTnJbKfkJOuL58,4674
|
|
878
878
|
langchain/retrievers/document_compressors/chain_filter_prompt.py,sha256=FTQRPiEsZ0Q9MQXXkpBwxtcqJ9D6Zq0GbuTmMpXHobA,231
|
|
879
|
-
langchain/retrievers/document_compressors/cohere_rerank.py,sha256=
|
|
879
|
+
langchain/retrievers/document_compressors/cohere_rerank.py,sha256=yGOiHsHAVH0LibkiSu1kyCdz2dhyMhG2roCCAWAIRvY,4515
|
|
880
880
|
langchain/retrievers/document_compressors/cross_encoder.py,sha256=vXjdgFx73jSWplCKTkT1R1dvBZMEvR1WOedPYd12-fM,362
|
|
881
881
|
langchain/retrievers/document_compressors/cross_encoder_rerank.py,sha256=0xtvDDk5PnjLiGxghdMF0atfeBwgs5e_dsYxYhfJFTs,1569
|
|
882
|
-
langchain/retrievers/document_compressors/embeddings_filter.py,sha256=
|
|
882
|
+
langchain/retrievers/document_compressors/embeddings_filter.py,sha256=jDMVncGQisYgYXH43TIG1QgEqGETRdMhLsXwnQ0CS_c,5569
|
|
883
883
|
langchain/retrievers/document_compressors/flashrank_rerank.py,sha256=Eo86fJ_T2IbEEeCkI_5rb3Ao4gsdenv-_Ukt33MuMko,709
|
|
884
|
-
langchain/retrievers/document_compressors/listwise_rerank.py,sha256=
|
|
884
|
+
langchain/retrievers/document_compressors/listwise_rerank.py,sha256=9e8lSzFi7ikCu_0o_gk1VWL6fCH75a7V0q-R1IQ0YMw,5248
|
|
885
885
|
langchain/retrievers/elastic_search_bm25.py,sha256=eRboOkRQj-_E53gUQIZzxQ1bX0-uEMv7LAQSD7K7Qf8,665
|
|
886
886
|
langchain/retrievers/embedchain.py,sha256=IUnhr3QK7IJ4IMHZDrTBpZuVQ1kyxhG-bAjmOMXb5eA,644
|
|
887
887
|
langchain/retrievers/ensemble.py,sha256=Hh4lXa-0HMMfX4vew-BVoYSnZBainL-VmNoOc7r9U08,10568
|
|
@@ -905,7 +905,7 @@ langchain/retrievers/re_phraser.py,sha256=Kd3uiducQaeUyGTJceFe2wTalCpRxt0M0qXWDi
|
|
|
905
905
|
langchain/retrievers/remote_retriever.py,sha256=f1jPII31IkNrhkH1LvlUlNLRQNMKNvgE_7qHa3o3P04,659
|
|
906
906
|
langchain/retrievers/self_query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
907
907
|
langchain/retrievers/self_query/astradb.py,sha256=lxlkYOr8xicH7MNyQKIg3Wc-XwhVpKGBn7maqYyR3Hk,670
|
|
908
|
-
langchain/retrievers/self_query/base.py,sha256=
|
|
908
|
+
langchain/retrievers/self_query/base.py,sha256=zJew4Lu3O62gthTuMlvZXoJkYpxk1so1R6-A_wq_Z0E,14538
|
|
909
909
|
langchain/retrievers/self_query/chroma.py,sha256=F0u_3Id1J1hIYM2D8_oNL2JJVetTFDyqW6fuGhjZ0ew,665
|
|
910
910
|
langchain/retrievers/self_query/dashvector.py,sha256=CJAJQuJYNmw_GUIwwlPx3Scu1uDESTnFF-CzZEwFRRg,685
|
|
911
911
|
langchain/retrievers/self_query/databricks_vector_search.py,sha256=S9V-XRfG6taeW3yRx_NZs4h-R4TiyHLnuJTIZa5rsqM,782
|
|
@@ -937,7 +937,7 @@ langchain/retrievers/you.py,sha256=TvZapklNoSzxBTgKQuTTWW3xOblMOoCdrKZQX-AZYFY,6
|
|
|
937
937
|
langchain/retrievers/zep.py,sha256=v7M0yTCSZx6hH7S230LjUnaJzbHp-G0kl05QZWuBo18,855
|
|
938
938
|
langchain/retrievers/zilliz.py,sha256=hWyoQ6HNbEzETqfPH7wC7SriXXPvRuDbBKQ8A7H3m0M,796
|
|
939
939
|
langchain/runnables/__init__.py,sha256=_5XwnxKdD038iAev__Q7G36pVxXmIEFTY8y2MvjEDqk,693
|
|
940
|
-
langchain/runnables/hub.py,sha256=
|
|
940
|
+
langchain/runnables/hub.py,sha256=jyyCAJBY-TMH7_uh3F6xgfAN5F64SB7a1nwmRzB_bwE,851
|
|
941
941
|
langchain/runnables/openai_functions.py,sha256=S3JA--ymrLRXm624O3q6xbqv_IVPRHqVij2opMsYiec,1546
|
|
942
942
|
langchain/schema/__init__.py,sha256=0oXOJGG54Oo_PMIW5-kvfe30YMebBWK09ErMxOZOJuI,2066
|
|
943
943
|
langchain/schema/agent.py,sha256=ziu7m5uOBKguXx1QwbElIqUEBdMnLQaFTYGw54N5g5U,149
|
|
@@ -948,7 +948,7 @@ langchain/schema/callbacks/manager.py,sha256=vvaqMDtG_kRuT9KNBLrchSNDTmdch8KiwMA
|
|
|
948
948
|
langchain/schema/callbacks/stdout.py,sha256=9weMjKUjKSTcWmeb3Sb2KKblj7C0-QTa1SzUzRMbjw0,103
|
|
949
949
|
langchain/schema/callbacks/streaming_stdout.py,sha256=URkFIyAS4V9HAiPQuiLgi5mGzBdVF5RfaRYQKhyChI0,131
|
|
950
950
|
langchain/schema/callbacks/tracers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
951
|
-
langchain/schema/callbacks/tracers/base.py,sha256=
|
|
951
|
+
langchain/schema/callbacks/tracers/base.py,sha256=FtqtqpIrvI0USdECgrhbtx-S4TcaEe_aeT4p9RHU-iA,150
|
|
952
952
|
langchain/schema/callbacks/tracers/evaluation.py,sha256=ZJItnN_hXGnVs1DIK4J9xG3EUWlt9iU9pKSJ60XpgDQ,176
|
|
953
953
|
langchain/schema/callbacks/tracers/langchain.py,sha256=joRSY8NZPOUkq65sEZk8hyc_6adb_WJPWa2eu7aB9Ic,219
|
|
954
954
|
langchain/schema/callbacks/tracers/langchain_v1.py,sha256=xSen-sx2Uc-URj4vTRpE5IsqaStG9WvsuRJZnLPQxfg,127
|
|
@@ -989,8 +989,8 @@ langchain/smith/evaluation/__init__.py,sha256=z9uREFLECT3nu7WKmGV4aSEXUTTeaCOLx8
|
|
|
989
989
|
langchain/smith/evaluation/config.py,sha256=u0TKCnNiY-GCKE-Q-QEBb0AvnG9XndoISqOzT-qf2fA,13464
|
|
990
990
|
langchain/smith/evaluation/name_generation.py,sha256=IWocrWNjWnV8GhHJ7BrbGcWK1v9TUikzubpSBNz4Px4,9936
|
|
991
991
|
langchain/smith/evaluation/progress.py,sha256=OVEISP5s6u4nVN2aMrTCdkjpcpsi2KxdcL01ITJOa1o,3331
|
|
992
|
-
langchain/smith/evaluation/runner_utils.py,sha256=
|
|
993
|
-
langchain/smith/evaluation/string_run_evaluator.py,sha256=
|
|
992
|
+
langchain/smith/evaluation/runner_utils.py,sha256=xTHqehWIDVknNSmYCU7rqXF3nb8NMKR_K_03cAJ_9m4,54228
|
|
993
|
+
langchain/smith/evaluation/string_run_evaluator.py,sha256=jz9FJyskTx5kh5FSH1XnnlBbc1M2C-kv-fW7TP3Y8nQ,17255
|
|
994
994
|
langchain/smith/evaluation/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
995
995
|
langchain/sql_database.py,sha256=PbNTfJjIUemMO9ZkLiMIpKF-9GJ7Kto3ShcQrLPoOqk,664
|
|
996
996
|
langchain/storage/__init__.py,sha256=Wm7zDu_UBenWVknjoTiRpafsDgubMJdB1oEuV88aVyk,1585
|
|
@@ -1339,4 +1339,4 @@ langchain/vectorstores/xata.py,sha256=HW_Oi5Hz8rH2JaUhRNWQ-3hLYmNzD8eAz6K5YqPArm
|
|
|
1339
1339
|
langchain/vectorstores/yellowbrick.py,sha256=-lnjGcRE8Q1nEPOTdbKYTw5noS2cy2ce1ePOU804-_o,624
|
|
1340
1340
|
langchain/vectorstores/zep.py,sha256=RJ2auxoA6uHHLEZknw3_jeFmYJYVt-PWKMBcNMGV6TM,798
|
|
1341
1341
|
langchain/vectorstores/zilliz.py,sha256=XhPPIUfKPFJw0_svCoBgCnNkkBLoRVVcyuMfOnE5IxU,609
|
|
1342
|
-
langchain-0.3.
|
|
1342
|
+
langchain-0.3.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|