langchain 0.2.4__py3-none-any.whl → 0.2.6__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.
Files changed (31) hide show
  1. langchain/_api/module_import.py +2 -2
  2. langchain/agents/json_chat/base.py +3 -3
  3. langchain/agents/react/agent.py +3 -0
  4. langchain/agents/tool_calling_agent/base.py +13 -3
  5. langchain/chains/llm.py +3 -2
  6. langchain/chains/openai_functions/extraction.py +6 -6
  7. langchain/chains/openai_tools/extraction.py +3 -3
  8. langchain/chains/structured_output/base.py +6 -6
  9. langchain/evaluation/agents/trajectory_eval_chain.py +2 -0
  10. langchain/indexes/_sql_record_manager.py +8 -3
  11. langchain/output_parsers/combining.py +1 -1
  12. langchain/output_parsers/enum.py +7 -3
  13. langchain/output_parsers/fix.py +57 -16
  14. langchain/output_parsers/pandas_dataframe.py +1 -1
  15. langchain/output_parsers/regex.py +1 -1
  16. langchain/output_parsers/regex_dict.py +1 -1
  17. langchain/output_parsers/retry.py +76 -29
  18. langchain/output_parsers/structured.py +3 -3
  19. langchain/output_parsers/yaml.py +4 -0
  20. langchain/python.py +4 -7
  21. langchain/retrievers/ensemble.py +17 -3
  22. langchain/retrievers/multi_query.py +2 -1
  23. langchain/retrievers/re_phraser.py +2 -1
  24. langchain/retrievers/self_query/base.py +2 -1
  25. langchain/utilities/__init__.py +2 -2
  26. langchain/utilities/python.py +4 -7
  27. {langchain-0.2.4.dist-info → langchain-0.2.6.dist-info}/METADATA +3 -3
  28. {langchain-0.2.4.dist-info → langchain-0.2.6.dist-info}/RECORD +31 -31
  29. {langchain-0.2.4.dist-info → langchain-0.2.6.dist-info}/LICENSE +0 -0
  30. {langchain-0.2.4.dist-info → langchain-0.2.6.dist-info}/WHEEL +0 -0
  31. {langchain-0.2.4.dist-info → langchain-0.2.6.dist-info}/entry_points.txt +0 -0
@@ -101,7 +101,7 @@ def create_importer(
101
101
  f">> from {new_module} import {name}\n"
102
102
  "You can use the langchain cli to **automatically** "
103
103
  "upgrade many imports. Please see documentation here "
104
- "https://python.langchain.com/v0.2/docs/versions/v0_2/ "
104
+ "<https://python.langchain.com/v0.2/docs/versions/v0_2/>"
105
105
  ),
106
106
  )
107
107
  return result
@@ -133,7 +133,7 @@ def create_importer(
133
133
  f">> from {fallback_module} import {name}\n"
134
134
  "You can use the langchain cli to **automatically** "
135
135
  "upgrade many imports. Please see documentation here "
136
- "https://python.langchain.com/v0.2/docs/versions/v0_2/ "
136
+ "<https://python.langchain.com/v0.2/docs/versions/v0_2/>"
137
137
  ),
138
138
  )
139
139
  return result
@@ -122,8 +122,8 @@ def create_json_chat_agent(
122
122
 
123
123
  ```json
124
124
  {{
125
- "action": string, \ The action to take. Must be one of {tool_names}
126
- "action_input": string \ The input to the action
125
+ "action": string, \\ The action to take. Must be one of {tool_names}
126
+ "action_input": string \\ The input to the action
127
127
  }}
128
128
  ```
129
129
 
@@ -134,7 +134,7 @@ def create_json_chat_agent(
134
134
  ```json
135
135
  {{
136
136
  "action": "Final Answer",
137
- "action_input": string \ You should put what you want to return to use here
137
+ "action_input": string \\ You should put what you want to return to use here
138
138
  }}
139
139
  ```
140
140
 
@@ -24,6 +24,9 @@ def create_react_agent(
24
24
  ) -> Runnable:
25
25
  """Create an agent that uses ReAct prompting.
26
26
 
27
+ Based on paper "ReAct: Synergizing Reasoning and Acting in Language Models"
28
+ (https://arxiv.org/abs/2210.03629)
29
+
27
30
  Args:
28
31
  llm: LLM to use as the agent.
29
32
  tools: Tools this agent has access to.
@@ -1,6 +1,8 @@
1
- from typing import Sequence
1
+ from typing import Callable, List, Sequence, Tuple
2
2
 
3
+ from langchain_core.agents import AgentAction
3
4
  from langchain_core.language_models import BaseLanguageModel
5
+ from langchain_core.messages import BaseMessage
4
6
  from langchain_core.prompts.chat import ChatPromptTemplate
5
7
  from langchain_core.runnables import Runnable, RunnablePassthrough
6
8
  from langchain_core.tools import BaseTool
@@ -10,9 +12,15 @@ from langchain.agents.format_scratchpad.tools import (
10
12
  )
11
13
  from langchain.agents.output_parsers.tools import ToolsAgentOutputParser
12
14
 
15
+ MessageFormatter = Callable[[Sequence[Tuple[AgentAction, str]]], List[BaseMessage]]
16
+
13
17
 
14
18
  def create_tool_calling_agent(
15
- llm: BaseLanguageModel, tools: Sequence[BaseTool], prompt: ChatPromptTemplate
19
+ llm: BaseLanguageModel,
20
+ tools: Sequence[BaseTool],
21
+ prompt: ChatPromptTemplate,
22
+ *,
23
+ message_formatter: MessageFormatter = format_to_tool_messages,
16
24
  ) -> Runnable:
17
25
  """Create an agent that uses tools.
18
26
 
@@ -21,6 +29,8 @@ def create_tool_calling_agent(
21
29
  tools: Tools this agent has access to.
22
30
  prompt: The prompt to use. See Prompt section below for more on the expected
23
31
  input variables.
32
+ message_formatter: Formatter function to convert (AgentAction, tool output)
33
+ tuples into FunctionMessages.
24
34
 
25
35
  Returns:
26
36
  A Runnable sequence representing an agent. It takes as input all the same input
@@ -89,7 +99,7 @@ def create_tool_calling_agent(
89
99
 
90
100
  agent = (
91
101
  RunnablePassthrough.assign(
92
- agent_scratchpad=lambda x: format_to_tool_messages(x["intermediate_steps"])
102
+ agent_scratchpad=lambda x: message_formatter(x["intermediate_steps"])
93
103
  )
94
104
  | prompt
95
105
  | llm_with_tools
langchain/chains/llm.py CHANGED
@@ -38,7 +38,7 @@ from langchain.chains.base import Chain
38
38
  @deprecated(
39
39
  since="0.1.17",
40
40
  alternative="RunnableSequence, e.g., `prompt | llm`",
41
- removal="0.3.0",
41
+ removal="1.0",
42
42
  )
43
43
  class LLMChain(Chain):
44
44
  """Chain to run queries against LLMs.
@@ -48,6 +48,7 @@ class LLMChain(Chain):
48
48
 
49
49
  .. code-block:: python
50
50
 
51
+ from langchain_core.output_parsers import StrOutputParser
51
52
  from langchain_core.prompts import PromptTemplate
52
53
  from langchain_openai import OpenAI
53
54
 
@@ -56,7 +57,7 @@ class LLMChain(Chain):
56
57
  input_variables=["adjective"], template=prompt_template
57
58
  )
58
59
  llm = OpenAI()
59
- chain = prompt | llm
60
+ chain = prompt | llm | StrOutputParser()
60
61
 
61
62
  chain.invoke("your adjective here")
62
63
 
@@ -50,13 +50,13 @@ Passage:
50
50
  "LangChain has introduced a method called `with_structured_output` that"
51
51
  "is available on ChatModels capable of tool calling."
52
52
  "You can read more about the method here: "
53
- "https://python.langchain.com/docs/modules/model_io/chat/structured_output/"
53
+ "<https://python.langchain.com/docs/modules/model_io/chat/structured_output/>. "
54
54
  "Please follow our extraction use case documentation for more guidelines"
55
55
  "on how to do information extraction with LLMs."
56
- "https://python.langchain.com/docs/use_cases/extraction/."
56
+ "<https://python.langchain.com/docs/use_cases/extraction/>. "
57
57
  "If you notice other issues, please provide "
58
58
  "feedback here:"
59
- "https://github.com/langchain-ai/langchain/discussions/18154"
59
+ "<https://github.com/langchain-ai/langchain/discussions/18154>"
60
60
  ),
61
61
  removal="0.3.0",
62
62
  alternative=(
@@ -120,13 +120,13 @@ def create_extraction_chain(
120
120
  "LangChain has introduced a method called `with_structured_output` that"
121
121
  "is available on ChatModels capable of tool calling."
122
122
  "You can read more about the method here: "
123
- "https://python.langchain.com/docs/modules/model_io/chat/structured_output/"
123
+ "<https://python.langchain.com/docs/modules/model_io/chat/structured_output/>. "
124
124
  "Please follow our extraction use case documentation for more guidelines"
125
125
  "on how to do information extraction with LLMs."
126
- "https://python.langchain.com/docs/use_cases/extraction/."
126
+ "<https://python.langchain.com/docs/use_cases/extraction/>. "
127
127
  "If you notice other issues, please provide "
128
128
  "feedback here:"
129
- "https://github.com/langchain-ai/langchain/discussions/18154"
129
+ "<https://github.com/langchain-ai/langchain/discussions/18154>"
130
130
  ),
131
131
  removal="0.3.0",
132
132
  alternative=(
@@ -20,14 +20,14 @@ If a property is not present and is not required in the function parameters, do
20
20
  "LangChain has introduced a method called `with_structured_output` that"
21
21
  "is available on ChatModels capable of tool calling."
22
22
  "You can read more about the method here: "
23
- "https://python.langchain.com/docs/modules/model_io/chat/structured_output/"
23
+ "<https://python.langchain.com/docs/modules/model_io/chat/structured_output/>. "
24
24
  "Please follow our extraction use case documentation for more guidelines"
25
25
  "on how to do information extraction with LLMs."
26
- "https://python.langchain.com/docs/use_cases/extraction/."
26
+ "<https://python.langchain.com/docs/use_cases/extraction/>. "
27
27
  "with_structured_output does not currently support a list of pydantic schemas. "
28
28
  "If this is a blocker or if you notice other issues, please provide "
29
29
  "feedback here:"
30
- "https://github.com/langchain-ai/langchain/discussions/18154"
30
+ "<https://github.com/langchain-ai/langchain/discussions/18154>"
31
31
  ),
32
32
  removal="0.3.0",
33
33
  alternative=(
@@ -32,13 +32,13 @@ from langchain_core.utils.function_calling import (
32
32
  "LangChain has introduced a method called `with_structured_output` that "
33
33
  "is available on ChatModels capable of tool calling. "
34
34
  "You can read more about the method here: "
35
- "https://python.langchain.com/docs/modules/model_io/chat/structured_output/ "
35
+ "<https://python.langchain.com/docs/modules/model_io/chat/structured_output/>. "
36
36
  "Please follow our extraction use case documentation for more guidelines "
37
37
  "on how to do information extraction with LLMs. "
38
- "https://python.langchain.com/docs/use_cases/extraction/. "
38
+ "<https://python.langchain.com/docs/use_cases/extraction/>. "
39
39
  "If you notice other issues, please provide "
40
40
  "feedback here: "
41
- "https://github.com/langchain-ai/langchain/discussions/18154"
41
+ "<https://github.com/langchain-ai/langchain/discussions/18154>"
42
42
  ),
43
43
  removal="0.3.0",
44
44
  alternative=(
@@ -150,13 +150,13 @@ def create_openai_fn_runnable(
150
150
  "LangChain has introduced a method called `with_structured_output` that "
151
151
  "is available on ChatModels capable of tool calling. "
152
152
  "You can read more about the method here: "
153
- "https://python.langchain.com/docs/modules/model_io/chat/structured_output/ "
153
+ "<https://python.langchain.com/docs/modules/model_io/chat/structured_output/>."
154
154
  "Please follow our extraction use case documentation for more guidelines "
155
155
  "on how to do information extraction with LLMs. "
156
- "https://python.langchain.com/docs/use_cases/extraction/. "
156
+ "<https://python.langchain.com/docs/use_cases/extraction/>. "
157
157
  "If you notice other issues, please provide "
158
158
  "feedback here: "
159
- "https://github.com/langchain-ai/langchain/discussions/18154"
159
+ "<https://github.com/langchain-ai/langchain/discussions/18154>"
160
160
  ),
161
161
  removal="0.3.0",
162
162
  alternative=(
@@ -103,6 +103,8 @@ class TrajectoryEvalChain(AgentTrajectoryEvaluator, LLMEvalChain):
103
103
 
104
104
  This chain is used to evaluate ReAct style agents by reasoning about
105
105
  the sequence of actions taken and their outcomes.
106
+ Based on the paper "ReAct: Synergizing Reasoning and Acting in Language Models"
107
+ (https://arxiv.org/abs/2210.03629)
106
108
 
107
109
  Example:
108
110
 
@@ -13,6 +13,7 @@ allow it to work with a variety of SQL as a backend.
13
13
  * Keys can be listed based on the updated at field.
14
14
  * Keys can be deleted.
15
15
  """
16
+
16
17
  import contextlib
17
18
  import decimal
18
19
  import uuid
@@ -20,9 +21,7 @@ from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Sequenc
20
21
 
21
22
  from langchain_core.indexing import RecordManager
22
23
  from sqlalchemy import (
23
- URL,
24
24
  Column,
25
- Engine,
26
25
  Float,
27
26
  Index,
28
27
  String,
@@ -33,15 +32,21 @@ from sqlalchemy import (
33
32
  select,
34
33
  text,
35
34
  )
35
+ from sqlalchemy.engine import URL, Engine
36
36
  from sqlalchemy.ext.asyncio import (
37
37
  AsyncEngine,
38
38
  AsyncSession,
39
- async_sessionmaker,
40
39
  create_async_engine,
41
40
  )
42
41
  from sqlalchemy.ext.declarative import declarative_base
43
42
  from sqlalchemy.orm import Query, Session, sessionmaker
44
43
 
44
+ try:
45
+ from sqlalchemy.ext.asyncio import async_sessionmaker
46
+ except ImportError:
47
+ # dummy for sqlalchemy < 2
48
+ async_sessionmaker = type("async_sessionmaker", (type,), {}) # type: ignore
49
+
45
50
  Base = declarative_base()
46
51
 
47
52
 
@@ -6,7 +6,7 @@ from langchain_core.output_parsers import BaseOutputParser
6
6
  from langchain_core.pydantic_v1 import root_validator
7
7
 
8
8
 
9
- class CombiningOutputParser(BaseOutputParser):
9
+ class CombiningOutputParser(BaseOutputParser[Dict[str, Any]]):
10
10
  """Combine multiple output parsers into one."""
11
11
 
12
12
  parsers: List[BaseOutputParser]
@@ -1,12 +1,12 @@
1
1
  from enum import Enum
2
- from typing import Any, Dict, List, Type
2
+ from typing import Dict, List, Type
3
3
 
4
4
  from langchain_core.exceptions import OutputParserException
5
5
  from langchain_core.output_parsers import BaseOutputParser
6
6
  from langchain_core.pydantic_v1 import root_validator
7
7
 
8
8
 
9
- class EnumOutputParser(BaseOutputParser):
9
+ class EnumOutputParser(BaseOutputParser[Enum]):
10
10
  """Parse an output that is one of a set of values."""
11
11
 
12
12
  enum: Type[Enum]
@@ -23,7 +23,7 @@ class EnumOutputParser(BaseOutputParser):
23
23
  def _valid_values(self) -> List[str]:
24
24
  return [e.value for e in self.enum]
25
25
 
26
- def parse(self, response: str) -> Any:
26
+ def parse(self, response: str) -> Enum:
27
27
  try:
28
28
  return self.enum(response.strip())
29
29
  except ValueError:
@@ -34,3 +34,7 @@ class EnumOutputParser(BaseOutputParser):
34
34
 
35
35
  def get_format_instructions(self) -> str:
36
36
  return f"Select one of the following options: {', '.join(self._valid_values)}"
37
+
38
+ @property
39
+ def OutputType(self) -> Type[Enum]:
40
+ return self.enum
@@ -1,11 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, TypeVar
3
+ from typing import Any, TypeVar, Union
4
4
 
5
5
  from langchain_core.exceptions import OutputParserException
6
6
  from langchain_core.language_models import BaseLanguageModel
7
7
  from langchain_core.output_parsers import BaseOutputParser
8
8
  from langchain_core.prompts import BasePromptTemplate
9
+ from langchain_core.runnables import RunnableSerializable
9
10
 
10
11
  from langchain.output_parsers.prompts import NAIVE_FIX_PROMPT
11
12
 
@@ -22,10 +23,12 @@ class OutputFixingParser(BaseOutputParser[T]):
22
23
  parser: BaseOutputParser[T]
23
24
  """The parser to use to parse the output."""
24
25
  # Should be an LLMChain but we want to avoid top-level imports from langchain.chains
25
- retry_chain: Any
26
- """The LLMChain to use to retry the completion."""
26
+ retry_chain: Union[RunnableSerializable, Any]
27
+ """The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
27
28
  max_retries: int = 1
28
29
  """The maximum number of times to retry the parse."""
30
+ legacy: bool = True
31
+ """Whether to use the run or arun method of the retry_chain."""
29
32
 
30
33
  @classmethod
31
34
  def from_llm(
@@ -46,9 +49,7 @@ class OutputFixingParser(BaseOutputParser[T]):
46
49
  Returns:
47
50
  OutputFixingParser
48
51
  """
49
- from langchain.chains.llm import LLMChain
50
-
51
- chain = LLMChain(llm=llm, prompt=prompt)
52
+ chain = prompt | llm
52
53
  return cls(parser=parser, retry_chain=chain, max_retries=max_retries)
53
54
 
54
55
  def parse(self, completion: str) -> T:
@@ -62,11 +63,29 @@ class OutputFixingParser(BaseOutputParser[T]):
62
63
  raise e
63
64
  else:
64
65
  retries += 1
65
- completion = self.retry_chain.run(
66
- instructions=self.parser.get_format_instructions(),
67
- completion=completion,
68
- error=repr(e),
69
- )
66
+ if self.legacy and hasattr(self.retry_chain, "run"):
67
+ completion = self.retry_chain.run(
68
+ instructions=self.parser.get_format_instructions(),
69
+ completion=completion,
70
+ error=repr(e),
71
+ )
72
+ else:
73
+ try:
74
+ completion = self.retry_chain.invoke(
75
+ dict(
76
+ instructions=self.parser.get_format_instructions(), # noqa: E501
77
+ input=completion,
78
+ error=repr(e),
79
+ )
80
+ )
81
+ except (NotImplementedError, AttributeError):
82
+ # Case: self.parser does not have get_format_instructions # noqa: E501
83
+ completion = self.retry_chain.invoke(
84
+ dict(
85
+ input=completion,
86
+ error=repr(e),
87
+ )
88
+ )
70
89
 
71
90
  raise OutputParserException("Failed to parse")
72
91
 
@@ -81,11 +100,29 @@ class OutputFixingParser(BaseOutputParser[T]):
81
100
  raise e
82
101
  else:
83
102
  retries += 1
84
- completion = await self.retry_chain.arun(
85
- instructions=self.parser.get_format_instructions(),
86
- completion=completion,
87
- error=repr(e),
88
- )
103
+ if self.legacy and hasattr(self.retry_chain, "arun"):
104
+ completion = await self.retry_chain.arun(
105
+ instructions=self.parser.get_format_instructions(), # noqa: E501
106
+ completion=completion,
107
+ error=repr(e),
108
+ )
109
+ else:
110
+ try:
111
+ completion = await self.retry_chain.ainvoke(
112
+ dict(
113
+ instructions=self.parser.get_format_instructions(), # noqa: E501
114
+ input=completion,
115
+ error=repr(e),
116
+ )
117
+ )
118
+ except (NotImplementedError, AttributeError):
119
+ # Case: self.parser does not have get_format_instructions # noqa: E501
120
+ completion = await self.retry_chain.ainvoke(
121
+ dict(
122
+ input=completion,
123
+ error=repr(e),
124
+ )
125
+ )
89
126
 
90
127
  raise OutputParserException("Failed to parse")
91
128
 
@@ -95,3 +132,7 @@ class OutputFixingParser(BaseOutputParser[T]):
95
132
  @property
96
133
  def _type(self) -> str:
97
134
  return "output_fixing"
135
+
136
+ @property
137
+ def OutputType(self) -> type[T]:
138
+ return self.parser.OutputType
@@ -10,7 +10,7 @@ from langchain.output_parsers.format_instructions import (
10
10
  )
11
11
 
12
12
 
13
- class PandasDataFrameOutputParser(BaseOutputParser):
13
+ class PandasDataFrameOutputParser(BaseOutputParser[Dict[str, Any]]):
14
14
  """Parse an output using Pandas DataFrame format."""
15
15
 
16
16
  """The Pandas DataFrame to parse."""
@@ -6,7 +6,7 @@ from typing import Dict, List, Optional
6
6
  from langchain_core.output_parsers import BaseOutputParser
7
7
 
8
8
 
9
- class RegexParser(BaseOutputParser):
9
+ class RegexParser(BaseOutputParser[Dict[str, str]]):
10
10
  """Parse the output of an LLM call using a regex."""
11
11
 
12
12
  @classmethod
@@ -6,7 +6,7 @@ from typing import Dict, Optional
6
6
  from langchain_core.output_parsers import BaseOutputParser
7
7
 
8
8
 
9
- class RegexDictParser(BaseOutputParser):
9
+ class RegexDictParser(BaseOutputParser[Dict[str, str]]):
10
10
  """Parse the output of an LLM call into a Dictionary using a regex."""
11
11
 
12
12
  regex_pattern: str = r"{}:\s?([^.'\n']*)\.?" # : :meta private:
@@ -1,12 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, TypeVar
3
+ from typing import Any, TypeVar, Union
4
4
 
5
5
  from langchain_core.exceptions import OutputParserException
6
6
  from langchain_core.language_models import BaseLanguageModel
7
7
  from langchain_core.output_parsers import BaseOutputParser
8
8
  from langchain_core.prompt_values import PromptValue
9
9
  from langchain_core.prompts import BasePromptTemplate, PromptTemplate
10
+ from langchain_core.runnables import RunnableSerializable
10
11
 
11
12
  NAIVE_COMPLETION_RETRY = """Prompt:
12
13
  {prompt}
@@ -43,10 +44,12 @@ class RetryOutputParser(BaseOutputParser[T]):
43
44
  parser: BaseOutputParser[T]
44
45
  """The parser to use to parse the output."""
45
46
  # Should be an LLMChain but we want to avoid top-level imports from langchain.chains
46
- retry_chain: Any
47
- """The LLMChain to use to retry the completion."""
47
+ retry_chain: Union[RunnableSerializable, Any]
48
+ """The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
48
49
  max_retries: int = 1
49
50
  """The maximum number of times to retry the parse."""
51
+ legacy: bool = True
52
+ """Whether to use the run or arun method of the retry_chain."""
50
53
 
51
54
  @classmethod
52
55
  def from_llm(
@@ -67,9 +70,7 @@ class RetryOutputParser(BaseOutputParser[T]):
67
70
  Returns:
68
71
  RetryOutputParser
69
72
  """
70
- from langchain.chains.llm import LLMChain
71
-
72
- chain = LLMChain(llm=llm, prompt=prompt)
73
+ chain = prompt | llm
73
74
  return cls(parser=parser, retry_chain=chain, max_retries=max_retries)
74
75
 
75
76
  def parse_with_prompt(self, completion: str, prompt_value: PromptValue) -> T:
@@ -92,9 +93,19 @@ class RetryOutputParser(BaseOutputParser[T]):
92
93
  raise e
93
94
  else:
94
95
  retries += 1
95
- completion = self.retry_chain.run(
96
- prompt=prompt_value.to_string(), completion=completion
97
- )
96
+ if self.legacy and hasattr(self.retry_chain, "run"):
97
+ completion = self.retry_chain.run(
98
+ prompt=prompt_value.to_string(),
99
+ completion=completion,
100
+ error=repr(e),
101
+ )
102
+ else:
103
+ completion = self.retry_chain.invoke(
104
+ dict(
105
+ prompt=prompt_value.to_string(),
106
+ input=completion,
107
+ )
108
+ )
98
109
 
99
110
  raise OutputParserException("Failed to parse")
100
111
 
@@ -118,9 +129,19 @@ class RetryOutputParser(BaseOutputParser[T]):
118
129
  raise e
119
130
  else:
120
131
  retries += 1
121
- completion = await self.retry_chain.arun(
122
- prompt=prompt_value.to_string(), completion=completion
123
- )
132
+ if self.legacy and hasattr(self.retry_chain, "arun"):
133
+ completion = await self.retry_chain.arun(
134
+ prompt=prompt_value.to_string(),
135
+ completion=completion,
136
+ error=repr(e),
137
+ )
138
+ else:
139
+ completion = await self.retry_chain.ainvoke(
140
+ dict(
141
+ prompt=prompt_value.to_string(),
142
+ input=completion,
143
+ )
144
+ )
124
145
 
125
146
  raise OutputParserException("Failed to parse")
126
147
 
@@ -136,6 +157,10 @@ class RetryOutputParser(BaseOutputParser[T]):
136
157
  def _type(self) -> str:
137
158
  return "retry"
138
159
 
160
+ @property
161
+ def OutputType(self) -> type[T]:
162
+ return self.parser.OutputType
163
+
139
164
 
140
165
  class RetryWithErrorOutputParser(BaseOutputParser[T]):
141
166
  """Wrap a parser and try to fix parsing errors.
@@ -149,11 +174,13 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
149
174
 
150
175
  parser: BaseOutputParser[T]
151
176
  """The parser to use to parse the output."""
152
- # Should be an LLMChain but we want to avoid top-level imports from langchain.chains
153
- retry_chain: Any
154
- """The LLMChain to use to retry the completion."""
177
+ # Should be an LLMChain but we want to avoid top-level imports from langchain.chains # noqa: E501
178
+ retry_chain: Union[RunnableSerializable, Any]
179
+ """The RunnableSerializable to use to retry the completion (Legacy: LLMChain)."""
155
180
  max_retries: int = 1
156
181
  """The maximum number of times to retry the parse."""
182
+ legacy: bool = True
183
+ """Whether to use the run or arun method of the retry_chain."""
157
184
 
158
185
  @classmethod
159
186
  def from_llm(
@@ -174,12 +201,10 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
174
201
  Returns:
175
202
  A RetryWithErrorOutputParser.
176
203
  """
177
- from langchain.chains.llm import LLMChain
178
-
179
- chain = LLMChain(llm=llm, prompt=prompt)
204
+ chain = prompt | llm
180
205
  return cls(parser=parser, retry_chain=chain, max_retries=max_retries)
181
206
 
182
- def parse_with_prompt(self, completion: str, prompt_value: PromptValue) -> T:
207
+ def parse_with_prompt(self, completion: str, prompt_value: PromptValue) -> T: # noqa: E501
183
208
  retries = 0
184
209
 
185
210
  while retries <= self.max_retries:
@@ -190,11 +215,20 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
190
215
  raise e
191
216
  else:
192
217
  retries += 1
193
- completion = self.retry_chain.run(
194
- prompt=prompt_value.to_string(),
195
- completion=completion,
196
- error=repr(e),
197
- )
218
+ if self.legacy and hasattr(self.retry_chain, "run"):
219
+ completion = self.retry_chain.run(
220
+ prompt=prompt_value.to_string(),
221
+ completion=completion,
222
+ error=repr(e),
223
+ )
224
+ else:
225
+ completion = self.retry_chain.invoke(
226
+ dict(
227
+ input=completion,
228
+ prompt=prompt_value.to_string(),
229
+ error=repr(e),
230
+ )
231
+ )
198
232
 
199
233
  raise OutputParserException("Failed to parse")
200
234
 
@@ -209,11 +243,20 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
209
243
  raise e
210
244
  else:
211
245
  retries += 1
212
- completion = await self.retry_chain.arun(
213
- prompt=prompt_value.to_string(),
214
- completion=completion,
215
- error=repr(e),
216
- )
246
+ if self.legacy and hasattr(self.retry_chain, "arun"):
247
+ completion = await self.retry_chain.arun(
248
+ prompt=prompt_value.to_string(),
249
+ completion=completion,
250
+ error=repr(e),
251
+ )
252
+ else:
253
+ completion = await self.retry_chain.ainvoke(
254
+ dict(
255
+ prompt=prompt_value.to_string(),
256
+ input=completion,
257
+ error=repr(e),
258
+ )
259
+ )
217
260
 
218
261
  raise OutputParserException("Failed to parse")
219
262
 
@@ -228,3 +271,7 @@ class RetryWithErrorOutputParser(BaseOutputParser[T]):
228
271
  @property
229
272
  def _type(self) -> str:
230
273
  return "retry_with_error"
274
+
275
+ @property
276
+ def OutputType(self) -> type[T]:
277
+ return self.parser.OutputType
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, List
3
+ from typing import Any, Dict, List
4
4
 
5
5
  from langchain_core.output_parsers import BaseOutputParser
6
6
  from langchain_core.output_parsers.json import parse_and_check_json_markdown
@@ -31,7 +31,7 @@ def _get_sub_string(schema: ResponseSchema) -> str:
31
31
  )
32
32
 
33
33
 
34
- class StructuredOutputParser(BaseOutputParser):
34
+ class StructuredOutputParser(BaseOutputParser[Dict[str, Any]]):
35
35
  """Parse the output of an LLM call to a structured output."""
36
36
 
37
37
  response_schemas: List[ResponseSchema]
@@ -92,7 +92,7 @@ class StructuredOutputParser(BaseOutputParser):
92
92
  else:
93
93
  return STRUCTURED_FORMAT_INSTRUCTIONS.format(format=schema_str)
94
94
 
95
- def parse(self, text: str) -> Any:
95
+ def parse(self, text: str) -> Dict[str, Any]:
96
96
  expected_keys = [rs.name for rs in self.response_schemas]
97
97
  return parse_and_check_json_markdown(text, expected_keys)
98
98
 
@@ -60,3 +60,7 @@ class YamlOutputParser(BaseOutputParser[T]):
60
60
  @property
61
61
  def _type(self) -> str:
62
62
  return "yaml"
63
+
64
+ @property
65
+ def OutputType(self) -> Type[T]:
66
+ return self.pydantic_object
langchain/python.py CHANGED
@@ -1,11 +1,11 @@
1
1
  """For backwards compatibility."""
2
- from typing import TYPE_CHECKING, Any
2
+ from typing import Any
3
3
 
4
4
  from langchain._api import create_importer
5
5
 
6
- if TYPE_CHECKING:
7
- from langchain_community.utilities.python import PythonREPL
8
-
6
+ # Code has been removed from the community package as well.
7
+ # We'll proxy to community package, which will raise an appropriate exception,
8
+ # but we'll not include this in __all__, so it won't be listed as importable.
9
9
 
10
10
  _importer = create_importer(
11
11
  __package__,
@@ -16,6 +16,3 @@ _importer = create_importer(
16
16
  def __getattr__(name: str) -> Any:
17
17
  """Look up attributes dynamically."""
18
18
  return _importer(name)
19
-
20
-
21
- __all__ = ["PythonREPL"]
@@ -66,11 +66,14 @@ class EnsembleRetriever(BaseRetriever):
66
66
  c: A constant added to the rank, controlling the balance between the importance
67
67
  of high-ranked items and the consideration given to lower-ranked items.
68
68
  Default is 60.
69
+ id_key: The key in the document's metadata used to determine unique documents.
70
+ If not specified, page_content is used.
69
71
  """
70
72
 
71
73
  retrievers: List[RetrieverLike]
72
74
  weights: List[float]
73
75
  c: int = 60
76
+ id_key: Optional[str] = None
74
77
 
75
78
  @property
76
79
  def config_specs(self) -> List[ConfigurableFieldSpec]:
@@ -305,13 +308,24 @@ class EnsembleRetriever(BaseRetriever):
305
308
  rrf_score: Dict[str, float] = defaultdict(float)
306
309
  for doc_list, weight in zip(doc_lists, self.weights):
307
310
  for rank, doc in enumerate(doc_list, start=1):
308
- rrf_score[doc.page_content] += weight / (rank + self.c)
311
+ rrf_score[
312
+ doc.page_content
313
+ if self.id_key is None
314
+ else doc.metadata[self.id_key]
315
+ ] += weight / (rank + self.c)
309
316
 
310
317
  # Docs are deduplicated by their contents then sorted by their scores
311
318
  all_docs = chain.from_iterable(doc_lists)
312
319
  sorted_docs = sorted(
313
- unique_by_key(all_docs, lambda doc: doc.page_content),
320
+ unique_by_key(
321
+ all_docs,
322
+ lambda doc: doc.page_content
323
+ if self.id_key is None
324
+ else doc.metadata[self.id_key],
325
+ ),
314
326
  reverse=True,
315
- key=lambda doc: rrf_score[doc.page_content],
327
+ key=lambda doc: rrf_score[
328
+ doc.page_content if self.id_key is None else doc.metadata[self.id_key]
329
+ ],
316
330
  )
317
331
  return sorted_docs
@@ -9,6 +9,7 @@ from langchain_core.callbacks import (
9
9
  from langchain_core.documents import Document
10
10
  from langchain_core.language_models import BaseLanguageModel
11
11
  from langchain_core.output_parsers import BaseOutputParser
12
+ from langchain_core.prompts import BasePromptTemplate
12
13
  from langchain_core.prompts.prompt import PromptTemplate
13
14
  from langchain_core.retrievers import BaseRetriever
14
15
  from langchain_core.runnables import Runnable
@@ -62,7 +63,7 @@ class MultiQueryRetriever(BaseRetriever):
62
63
  cls,
63
64
  retriever: BaseRetriever,
64
65
  llm: BaseLanguageModel,
65
- prompt: PromptTemplate = DEFAULT_QUERY_PROMPT,
66
+ prompt: BasePromptTemplate = DEFAULT_QUERY_PROMPT,
66
67
  parser_key: Optional[str] = None,
67
68
  include_original: bool = False,
68
69
  ) -> "MultiQueryRetriever":
@@ -7,6 +7,7 @@ from langchain_core.callbacks import (
7
7
  )
8
8
  from langchain_core.documents import Document
9
9
  from langchain_core.language_models import BaseLLM
10
+ from langchain_core.prompts import BasePromptTemplate
10
11
  from langchain_core.prompts.prompt import PromptTemplate
11
12
  from langchain_core.retrievers import BaseRetriever
12
13
 
@@ -36,7 +37,7 @@ class RePhraseQueryRetriever(BaseRetriever):
36
37
  cls,
37
38
  retriever: BaseRetriever,
38
39
  llm: BaseLLM,
39
- prompt: PromptTemplate = DEFAULT_QUERY_PROMPT,
40
+ prompt: BasePromptTemplate = DEFAULT_QUERY_PROMPT,
40
41
  ) -> "RePhraseQueryRetriever":
41
42
  """Initialize from llm using default template.
42
43
 
@@ -170,11 +170,12 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
170
170
 
171
171
  try:
172
172
  from langchain_postgres import PGVector
173
+ from langchain_postgres import PGVectorTranslator as NewPGVectorTranslator
173
174
  except ImportError:
174
175
  pass
175
176
  else:
176
177
  if isinstance(vectorstore, PGVector):
177
- return PGVectorTranslator()
178
+ return NewPGVectorTranslator()
178
179
 
179
180
  raise ValueError(
180
181
  f"Self query retriever with Vector Store type {vectorstore.__class__}"
@@ -38,7 +38,6 @@ if TYPE_CHECKING:
38
38
  Portkey,
39
39
  PowerBIDataset,
40
40
  PubMedAPIWrapper,
41
- PythonREPL,
42
41
  Requests,
43
42
  RequestsWrapper,
44
43
  SceneXplainAPIWrapper,
@@ -90,6 +89,8 @@ DEPRECATED_LOOKUP = {
90
89
  "Portkey": "langchain_community.utilities",
91
90
  "PowerBIDataset": "langchain_community.utilities",
92
91
  "PubMedAPIWrapper": "langchain_community.utilities",
92
+ # We will not list PythonREPL in __all__ since it has been removed from community
93
+ # it'll proxy to community package, which will raise an appropriate exception.
93
94
  "PythonREPL": "langchain_community.utilities",
94
95
  "Requests": "langchain_community.utilities",
95
96
  "SteamWebAPIWrapper": "langchain_community.utilities",
@@ -147,7 +148,6 @@ __all__ = [
147
148
  "Portkey",
148
149
  "PowerBIDataset",
149
150
  "PubMedAPIWrapper",
150
- "PythonREPL",
151
151
  "Requests",
152
152
  "SteamWebAPIWrapper",
153
153
  "SQLDatabase",
@@ -1,11 +1,11 @@
1
1
  """For backwards compatibility."""
2
- from typing import TYPE_CHECKING, Any
2
+ from typing import Any
3
3
 
4
4
  from langchain._api import create_importer
5
5
 
6
- if TYPE_CHECKING:
7
- from langchain_community.utilities.python import PythonREPL
8
-
6
+ # Code has been removed from the community package as well.
7
+ # We'll proxy to community package, which will raise an appropriate exception,
8
+ # but we'll not include this in __all__, so it won't be listed as importable.
9
9
 
10
10
  _importer = create_importer(
11
11
  __package__,
@@ -16,6 +16,3 @@ _importer = create_importer(
16
16
  def __getattr__(name: str) -> Any:
17
17
  """Look up attributes dynamically."""
18
18
  return _importer(name)
19
-
20
-
21
- __all__ = ["PythonREPL"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Building applications with LLMs through composability
5
5
  Home-page: https://github.com/langchain-ai/langchain
6
6
  License: MIT
@@ -15,14 +15,14 @@ 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.6,<0.3.0)
18
+ Requires-Dist: langchain-core (>=0.2.10,<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"
22
22
  Requires-Dist: numpy (>=1.26.0,<2.0.0) ; python_version >= "3.12"
23
23
  Requires-Dist: pydantic (>=1,<3)
24
24
  Requires-Dist: requests (>=2,<3)
25
- Requires-Dist: tenacity (>=8.1.0,<9.0.0)
25
+ Requires-Dist: tenacity (>=8.1.0,<9.0.0,!=8.4.0)
26
26
  Project-URL: Repository, https://github.com/langchain-ai/langchain
27
27
  Description-Content-Type: text/markdown
28
28
 
@@ -2,7 +2,7 @@ langchain/__init__.py,sha256=nk2PxBYk13JmK6OtzQmfVlSn6t-UkwWcczdcfeil1zU,13708
2
2
  langchain/_api/__init__.py,sha256=0FuHuMNUBMrst1Y1nm5yZzQr2xbLmb7rxMsimqKBXhs,733
3
3
  langchain/_api/deprecation.py,sha256=MpH4S7a11UDuoAGCv1RLWGn4pwhoFwEOrtONJGep40U,471
4
4
  langchain/_api/interactive_env.py,sha256=NlnXizhm1TG3l_qKNI0qHJiHkh9q2jRjt5zGJsg_BCA,139
5
- langchain/_api/module_import.py,sha256=CkKUtPotyqx0JtwaPYwBTdZkQZxYxVRHn7dDAsTBvEc,6355
5
+ langchain/_api/module_import.py,sha256=2uxBo3ckCeqUGPvHETVOMCDyN2xyuJUxjYLtWro0mi4,6357
6
6
  langchain/_api/path.py,sha256=ovJP6Pcf7L_KaKvMMet9G9OzfLTb-sZV2pEw3Tp7o3I,122
7
7
  langchain/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  langchain/adapters/openai.py,sha256=kWvS_DdRtpcc49vDY8zLUo3BrtXA3a89bLJu3Sksvaw,1996
@@ -102,7 +102,7 @@ langchain/agents/format_scratchpad/tools.py,sha256=5zw3o1zOcEuuayatYM8YpDgXh91Sb
102
102
  langchain/agents/format_scratchpad/xml.py,sha256=DtMBd2-Rgi2LdfxXNImYYNcCEy5lxk8ix7-SSCOpWQY,578
103
103
  langchain/agents/initialize.py,sha256=CjGDkDyHW0gl8bbegpd0Ql63cPHL-sS-xYtukQKCQik,3244
104
104
  langchain/agents/json_chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
105
- langchain/agents/json_chat/base.py,sha256=Cb3IIKvZAP_Ss_EJLrq81bXiCv1eXDNZBV3ItP_jNQ8,7743
105
+ langchain/agents/json_chat/base.py,sha256=Jjxr82tV3tRll_O5583tvwHdBdv9t_2q-V2CExMfgDk,7746
106
106
  langchain/agents/json_chat/prompt.py,sha256=gZukOH50C1llQ-AB2QvtL-PSrczv-a-gJLIPYP8z6vA,551
107
107
  langchain/agents/load_tools.py,sha256=uMi1EZtkv2sgyUw6iXMNlCSZlIaju0Rw2svwMtkeW3E,286
108
108
  langchain/agents/loading.py,sha256=Q7UDyLQ8l7vh6v60ehBPAyumWpYdyNCBKxGwmQe34NI,4634
@@ -129,7 +129,7 @@ langchain/agents/output_parsers/self_ask.py,sha256=-4_-hQbKB1ichR5odEyeYUV-wIdLm
129
129
  langchain/agents/output_parsers/tools.py,sha256=9hRlUsJVmS0VmFzEKVYfg5AeusynB2lw4Xi4uYns5JM,3753
130
130
  langchain/agents/output_parsers/xml.py,sha256=2MjxW4nAM4sZN-in3K40_K5DBx6cI2Erb0TZbpSoZIY,1658
131
131
  langchain/agents/react/__init__.py,sha256=9RIjjaUDfWnoMEMpV57JQ0CwZZC5Soh357QdKpVIM-4,76
132
- langchain/agents/react/agent.py,sha256=WjD2UYv5aYfmMDH-bSCpmvrz7TnyUmosYpA8rRRom-0,4975
132
+ langchain/agents/react/agent.py,sha256=r-GmQhjZjWLZ4bf7I2KpGvJbWdQZFpGbrpkTM2daZV8,5095
133
133
  langchain/agents/react/base.py,sha256=vJTNp6zq9hCMhCTYjk8wBFuSK4s8DnFlYdmKrobYP5A,5798
134
134
  langchain/agents/react/output_parser.py,sha256=bEL3U3mxYGK7_7Lm4GlOq8JKQTgyHFQQIEVUUZjV1qs,1231
135
135
  langchain/agents/react/textworld_prompt.py,sha256=b9WDM8pFmqrfAWJ8n6zkxlPlxQI5oHljZ1R9g5y6cRE,1906
@@ -144,7 +144,7 @@ langchain/agents/structured_chat/base.py,sha256=AL8e0NTYYgVZ3thd64wQWpaLf7pkY7sE
144
144
  langchain/agents/structured_chat/output_parser.py,sha256=0jj2cSH8SLMJMW9cSI82oIJf2lg5SJf34-0Cv_91x8g,3799
145
145
  langchain/agents/structured_chat/prompt.py,sha256=OiBTRUOhvhSyO2jO2ByUUiaCrkK_tIUH9pMWWKs-aF4,992
146
146
  langchain/agents/tool_calling_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- langchain/agents/tool_calling_agent/base.py,sha256=LrHBSzlNQeDHiO_I62LnYcybmiHe_Ene_aPYezfzn30,3465
147
+ langchain/agents/tool_calling_agent/base.py,sha256=pEL8y4YN9pQICFYpkPi76jnMVD5-PZWIrgUIPat87F8,3870
148
148
  langchain/agents/tools.py,sha256=mvd2lvmCyfK37XFouRlgKIjsltxoOWiTsXaI_r0eEbs,1409
149
149
  langchain/agents/types.py,sha256=reTknIC_U9YMexGn3LoHJ5ApW3SuMm9S4QGJs5gTjoM,1475
150
150
  langchain/agents/utils.py,sha256=_cLXKL6NS2iqfftiGJOnNZtM7mLZLwd5qBKxEshhuRQ,384
@@ -262,7 +262,7 @@ langchain/chains/history_aware_retriever.py,sha256=a92vlxlq0PaOubc_b4jj_WwGivk4T
262
262
  langchain/chains/hyde/__init__.py,sha256=mZ-cb7slBdlK5aG2R_NegBzNCXToHR-tdmfIIA6lKvQ,75
263
263
  langchain/chains/hyde/base.py,sha256=3bjH3SNN-sE3jNgOhu1SlCI8RBQihU7rbKhso1-Bc0U,3341
264
264
  langchain/chains/hyde/prompts.py,sha256=U4LfozneOyHDIKd8rCbnGSQK84YvZqAtpf5EL435Ol8,1913
265
- langchain/chains/llm.py,sha256=_FXecD596uCJHKNE61BhYU9C0s0367aUQUvXpda9yVc,15470
265
+ langchain/chains/llm.py,sha256=-BWf6XswR4FayUwQ7TdfJ4ALqUVtGjk7dcHYtLsy3A8,15558
266
266
  langchain/chains/llm_bash/__init__.py,sha256=qvRpa5tj09akj4DLVZoKvWK8-oJrUxc5-7ooAP3mO18,453
267
267
  langchain/chains/llm_checker/__init__.py,sha256=2IHg5XUQTQEoEMutGa66_tzOStNskQnDDXdN9VzJCSo,139
268
268
  langchain/chains/llm_checker/base.py,sha256=qnmIhplnkXZG9br1-Tc3VawjzrGBTMTnr-a3tVvHX1M,6190
@@ -288,13 +288,13 @@ langchain/chains/natbot/prompt.py,sha256=zB95SYLG5_12ABFFGDtDi8vVP9DSdPoP8UCjrar
288
288
  langchain/chains/openai_functions/__init__.py,sha256=p4ELyzXWaLb7xOEwgyRZLgvVcO5ayYjmlNXOGHvioLg,1403
289
289
  langchain/chains/openai_functions/base.py,sha256=EVfHBtxkLqXEJ3S5Sy9rlyBSS35C83iRJIuoOQ4IhoE,10172
290
290
  langchain/chains/openai_functions/citation_fuzzy_match.py,sha256=bHkYOhTgEG1wIhdC06WL6Wmnc_s-KctLs1cC5PLxwgQ,3558
291
- langchain/chains/openai_functions/extraction.py,sha256=ScWjzJzwtGTehw3CGGvj2vqwuX7p9qiYAVO9hPgODCU,7301
291
+ langchain/chains/openai_functions/extraction.py,sha256=NTP9lKKeHcqQC_PQtAJLKTsvzAmAdoqPYbyEPlVFUxw,7319
292
292
  langchain/chains/openai_functions/openapi.py,sha256=512z96_-iv73_LAd-doxWyjbh2tSrlmLKs0YJY2mfV8,11869
293
293
  langchain/chains/openai_functions/qa_with_structure.py,sha256=MmOrJnrfknmXAdEi588-YAqL7Pc3Qdk7VsLMc97z6wU,3959
294
294
  langchain/chains/openai_functions/tagging.py,sha256=nbvW29Cb4tHTz1kQciQa8Upti01brRbhGgC2Mqou2V0,2663
295
295
  langchain/chains/openai_functions/utils.py,sha256=GDhYjszQGut1UcJ-dyPvkwiT8gHOV0IejRuIfN7_fhw,1255
296
296
  langchain/chains/openai_tools/__init__.py,sha256=xX0If1Nx_ocEOI56EGxCI0v0RZ1_VUegzyODAj0RLVU,134
297
- langchain/chains/openai_tools/extraction.py,sha256=-Qs0BQQl5vXSmpWI9mNB6UgvGPTmiR6Y3cCsrffgGCw,3428
297
+ langchain/chains/openai_tools/extraction.py,sha256=oP2ZL_JMmzz8a0yidW0aTEr_n7NSpmyCWpNsjMvuGH4,3437
298
298
  langchain/chains/prompt_selector.py,sha256=zJdUcMQctOZd5dMXcXSCwMwQssnLvCecHYFDEOiHphU,2015
299
299
  langchain/chains/qa_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
300
300
  langchain/chains/qa_generation/base.py,sha256=MPwn8l8O3ZB5M3dJ2-4CEyaV4tjx_NwAxyCqJ9XkiBM,2465
@@ -336,7 +336,7 @@ langchain/chains/sql_database/__init__.py,sha256=jQotWN4EWMD98Jk-f7rqh5YtbXbP9XX
336
336
  langchain/chains/sql_database/prompt.py,sha256=W0xFqVZ18PzxmutnIBJrocXus8_QBByrKtxg8CjGaYw,15458
337
337
  langchain/chains/sql_database/query.py,sha256=h-QP5ESatTFj8t7sGsHppXSchy3ZGL1U1afza-Lo8fc,5421
338
338
  langchain/chains/structured_output/__init__.py,sha256=-6nFe-gznavFc3XCMv8XkEzuXoto2rI8Q-bcruVPOR8,204
339
- langchain/chains/structured_output/base.py,sha256=XpNEsRaUlKUkzddE6akKZhbrVtSBshhGxoPbxMVb9eE,25530
339
+ langchain/chains/structured_output/base.py,sha256=unaZJnNDFEVn0nJBstRRIJ3u4k_H5WrfyllMwT5GeMs,25543
340
340
  langchain/chains/summarize/__init__.py,sha256=mg1lKtH_x-oJ5qvKY6OD7g9kkqbjMVbL3l3OhfozSQM,151
341
341
  langchain/chains/summarize/chain.py,sha256=-vj0oCLooN4oGf9hsyuqJsHebaqg1_1AcMclRz9MOys,6192
342
342
  langchain/chains/summarize/map_reduce_prompt.py,sha256=HZSitW2_WhJINN-_YJCzU6zJXbPuMr5zFek31AzutuQ,238
@@ -626,7 +626,7 @@ langchain/embeddings/xinference.py,sha256=nehpiy79abQ78Bm-Y9DA8FDvpACXROSIats0S6
626
626
  langchain/env.py,sha256=fucAbfcmwiN1CjKSg5l2lzquRVoE7wqfuMMlaByuyEk,476
627
627
  langchain/evaluation/__init__.py,sha256=jFKhJ5vxBMphg7qQe9Tw7Ma-rL7F3FRZG4C6XQPaZhg,5803
628
628
  langchain/evaluation/agents/__init__.py,sha256=fqXIN8cbpBYwE1m7LQRnTHTcMXS1fedZyOhpwzWCqbc,165
629
- langchain/evaluation/agents/trajectory_eval_chain.py,sha256=EWBSiM-T1V6ZZLRIaqCYDgWWLjSEsDarfkBcACA9dKA,13901
629
+ langchain/evaluation/agents/trajectory_eval_chain.py,sha256=zYgpXsccc0y2h6OfgoCw_TtDKpJW1sBC71CDIcpbhuU,14024
630
630
  langchain/evaluation/agents/trajectory_eval_prompt.py,sha256=UqAk4-CKL1LjjpCNgRi-fuY1JEJO03tGxudL_P04N4k,5938
631
631
  langchain/evaluation/comparison/__init__.py,sha256=gHLBcYkt9wI2mf2YEmAxskptxQwuVPCQJrW4MqL_rWQ,1400
632
632
  langchain/evaluation/comparison/eval_chain.py,sha256=wBDsII3fN28B5anjuk_viiDjMSKqf2VT52XiWGAj4rw,15934
@@ -675,7 +675,7 @@ langchain/graphs/rdf_graph.py,sha256=i42Srtc325zzRDq-0hqpQu2NVltvsaP7tkaWSRpgvfc
675
675
  langchain/hub.py,sha256=lXz6fuzXgY8KT-nlsPMq5-y1OAQDoF4eolDeTzKOFvg,3462
676
676
  langchain/indexes/__init__.py,sha256=XvRNk7ojFJ1RNwinCrR36lPnFn2WA4gtLebldZMc60E,1480
677
677
  langchain/indexes/_api.py,sha256=93hOcQ5gNxwmgjV0hqcYHJQ1WkE8tc8JrAQuwKf2X80,252
678
- langchain/indexes/_sql_record_manager.py,sha256=pBPp-oJOQje2mwDMy17zYEMNSN1aAW81ySV9VolQt7o,20640
678
+ langchain/indexes/_sql_record_manager.py,sha256=GEsKB_spqA7k--RJOm3IvX44rVx1f4e99Kl2M_hWix8,20834
679
679
  langchain/indexes/graph.py,sha256=9Yd-nC_BUe52iQEcrJuzNw_XyDjh0b8KRKQmPkBktvE,906
680
680
  langchain/indexes/prompts/__init__.py,sha256=x7GmPPOIgbsrRbtLCFcX302xHttZ6qAofGYyNvSBJIs,357
681
681
  langchain/indexes/prompts/entity_extraction.py,sha256=gTKrAXGbbR3OKdtkgaq8UgigvNp8Q4oICcBHbaeVhOg,1952
@@ -813,27 +813,27 @@ langchain/memory/zep_memory.py,sha256=WMrAJ7jymx0_0d3JnhCuklJxfomsGhEEEQ6uPMJ21B
813
813
  langchain/model_laboratory.py,sha256=IaJzVG_SbFX7W6ODriqqme-Q5x0MB18j4Bhg1Y-fWLo,3278
814
814
  langchain/output_parsers/__init__.py,sha256=dx0wohmy74_2jrO31f8NQ57bCk8J82Pqj3LytLYPUtk,2719
815
815
  langchain/output_parsers/boolean.py,sha256=1-_Xtqhq-9ll4GxfPXW_5sAjAbODCWKF6yTPdVhY8mQ,1689
816
- langchain/output_parsers/combining.py,sha256=9AcNNou-wCmbEvRL37c650O-FrW_FieJoaMq-4ACRO8,1799
816
+ langchain/output_parsers/combining.py,sha256=dYNXviLuZBe4OV1hyTXJy7EJ5mFtmc6KAX5_VsyUkQQ,1815
817
817
  langchain/output_parsers/datetime.py,sha256=zxhwax0YxVahE3CCHMXTqjpyzQcffgZ9J0NA0qLL0_8,1974
818
- langchain/output_parsers/enum.py,sha256=ldgLvck3wxyLe7LQLDYdoSmFmqNugDpvV-4fBcusjMI,1205
818
+ langchain/output_parsers/enum.py,sha256=1oGbXB7ujsAdUSkYQG8XV4gBq4pNqSOCdu3ANt0lYpo,1287
819
819
  langchain/output_parsers/ernie_functions.py,sha256=86DsYlAGncjRalnmw5ZGwhH80lP2ms6zaw8PJGC3m3Q,1427
820
- langchain/output_parsers/fix.py,sha256=f2wmCYTUuRl8DMu5H6cjXpVH-kTTqAvlLjWYxqgoul0,3150
820
+ langchain/output_parsers/fix.py,sha256=TKGG3XKQz8FCnmCvblu_0jtmBE7w_R7_wydqmeuDN5s,5347
821
821
  langchain/output_parsers/format_instructions.py,sha256=y5oSpjwzgmvYRNhfe0JmKHHdFZZP65L2snJI6xcMXEY,3958
822
822
  langchain/output_parsers/json.py,sha256=2FJL7uLd7pHgvpQm-r5XDyt9S1ZZ9mlJUW8ilQAQ0k4,340
823
823
  langchain/output_parsers/list.py,sha256=D35r0U51Xy5wHn-VcWxr97Ftul4UqszmyLetDi4syYQ,310
824
824
  langchain/output_parsers/loading.py,sha256=YD3RZ8TTBVtVTXdV14xpj_RNZqrJgclk9J9fHQI7YIA,702
825
825
  langchain/output_parsers/openai_functions.py,sha256=XmqUCySXGsaHugtItczb8K71lrQIfMNYvAofP9ZEF7U,364
826
826
  langchain/output_parsers/openai_tools.py,sha256=beZWrEXyOyGMVWJ7lWE7xxEgbfQCuQnHligdxuEQxng,229
827
- langchain/output_parsers/pandas_dataframe.py,sha256=Zom-2Bv9tNFIsI74kJa05kvoTNubaAoK4GdSLYoT3hk,6548
827
+ langchain/output_parsers/pandas_dataframe.py,sha256=tOAd9A4KqS3dcM4FdjAyZ9Vo-ZDKE-dDiWhvgiIdIyo,6564
828
828
  langchain/output_parsers/prompts.py,sha256=zVhB4xjeWW3MKm4ZM8RfIiPUMg06SJAhYVmCa3jCNS8,508
829
829
  langchain/output_parsers/pydantic.py,sha256=uxbrfdyPnZxfdDvmuDr3QOmBFMwML3SfMDEmAKqmyvA,99
830
830
  langchain/output_parsers/rail_parser.py,sha256=iHmX3ux2jE2k0MsLqe5XCrJ1eQOBBfZtRbRzQoYPTfU,691
831
- langchain/output_parsers/regex.py,sha256=Rp6Mbkp9EQM2XlqmZ8qYtK3Hm_4rVHlYxF_jngcRQDs,1214
832
- langchain/output_parsers/regex_dict.py,sha256=ZT1a4n63T-ju853QwZBXhniQQWlSuAPrtd6CDnUMOpA,1709
833
- langchain/output_parsers/retry.py,sha256=LUSgNktQDX6j37ihB-HoGLrQnch1RwRjz5Ht72-_ydQ,7786
834
- langchain/output_parsers/structured.py,sha256=KDWRXE9zrPvw1CUPKR6TAcTxZEefJMf4VqdynXhq7Bk,3132
831
+ langchain/output_parsers/regex.py,sha256=TAkxKzxRQQ810LuXbxYatwLZgsYhoVwez3j5e2P55bA,1230
832
+ langchain/output_parsers/regex_dict.py,sha256=UK6iL4Hx-q6UlPNEGLAnbh7_8-IwtXY2V1-_KicG1Z8,1725
833
+ langchain/output_parsers/retry.py,sha256=y_PXibg9jXb0ePN3CKT1jlDc_WaTf-Do8D2IHLpCWdU,10003
834
+ langchain/output_parsers/structured.py,sha256=YdoqEl1FXanSNVtXZapYPKgiz7VfudzXvBXYQvwr4vo,3165
835
835
  langchain/output_parsers/xml.py,sha256=WDHazWjxO-nDAzxkBJrd1tGINVrzo4mH2-Qgqtz9Y2w,93
836
- langchain/output_parsers/yaml.py,sha256=nedQqQivPTj7NlG2j2Tl0PGbZVHO26QOqP16tsLuWh8,2181
836
+ langchain/output_parsers/yaml.py,sha256=4JLARJgFf-B2eikneVk3hDtCo9WQdlmPCHOMIpOgcAw,2269
837
837
  langchain/prompts/__init__.py,sha256=VN5GIhoMK-ij50iLkN4WmuBTFE3Y_SriEh86uuNxjrY,3152
838
838
  langchain/prompts/base.py,sha256=QATYkT1NM2-QElHrC4qapaOm3FDxDOgPCdJixuziSbM,565
839
839
  langchain/prompts/chat.py,sha256=ohOf8VGpdG2FaEBCzSLB0YPdT_8LmBwQGnb1pYVlZFc,1045
@@ -851,7 +851,7 @@ langchain/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
851
851
  langchain/pydantic_v1/__init__.py,sha256=OZOjjRJYJm5UygRZOtxE7q-y81cxvbEh7j2gXkAN1Bs,912
852
852
  langchain/pydantic_v1/dataclasses.py,sha256=q_wsG5TxBrmLN9lCz1NZtK_OFvvG5Ar-4HEIJT59Zbg,149
853
853
  langchain/pydantic_v1/main.py,sha256=ojfN3YOtr50TrXBJrBOLx0TEd1tKMRcnnK-VoTk0H6s,135
854
- langchain/python.py,sha256=uWfB2YOktnaGO3OvUOMB6_3fRfaxMPGqOyKWgTjmSKA,462
854
+ langchain/python.py,sha256=8nodLRp-MiPoKtBp2IdfZ0iU2mQC2kKwTuu9Jkz8DD8,554
855
855
  langchain/requests.py,sha256=42NQEQIcnu3qpmiroYVR8b-DhdA6yqWpvndfRfyM9rs,905
856
856
  langchain/retrievers/__init__.py,sha256=uXZfMXwKEAQOXy76gEBEoO9_FA4Z4apLD6seNAF-RCU,6660
857
857
  langchain/retrievers/arcee.py,sha256=e9wEnHNjWWkcjPYuQfyQQEksqT0ZvERSGx4mohj9HYM,629
@@ -878,7 +878,7 @@ langchain/retrievers/document_compressors/embeddings_filter.py,sha256=znq71R5Qyn
878
878
  langchain/retrievers/document_compressors/flashrank_rerank.py,sha256=Eo86fJ_T2IbEEeCkI_5rb3Ao4gsdenv-_Ukt33MuMko,709
879
879
  langchain/retrievers/elastic_search_bm25.py,sha256=eRboOkRQj-_E53gUQIZzxQ1bX0-uEMv7LAQSD7K7Qf8,665
880
880
  langchain/retrievers/embedchain.py,sha256=IUnhr3QK7IJ4IMHZDrTBpZuVQ1kyxhG-bAjmOMXb5eA,644
881
- langchain/retrievers/ensemble.py,sha256=80kezQiWiibPSYSDQBWC5Uzm2Chv-A4sqwIjNy-tShY,9991
881
+ langchain/retrievers/ensemble.py,sha256=kwvgeIOYSdXJ9endDM5Rc-JVxmdOzgx5ZwgLhzMlju0,10512
882
882
  langchain/retrievers/google_cloud_documentai_warehouse.py,sha256=wJZu2kOHjrBOpTeaPBxyKMIA9OlMuiZ4kul2FG1lJ0k,695
883
883
  langchain/retrievers/google_vertex_ai_search.py,sha256=MlYVMne4jYU7lif0y5A-cQNC89DPnsCRljrQPm80GKQ,1040
884
884
  langchain/retrievers/kay.py,sha256=rvIPgoA7IrNsYeJ2B4J-gaviS84inzmlifKoNWKEgc8,629
@@ -888,18 +888,18 @@ langchain/retrievers/llama_index.py,sha256=TKuU8atpKcsoRuaK_iU5HLFOjHN8e3FxCe61s
888
888
  langchain/retrievers/merger_retriever.py,sha256=uzwpkarGfgByXbqCFYNHXL-mczqfTgJI--9Y6EmY63g,3601
889
889
  langchain/retrievers/metal.py,sha256=E9KmySjhmpq_kZhDhOLS8sH4KpbOnWUodR4-3Kd2E30,629
890
890
  langchain/retrievers/milvus.py,sha256=f_vi-uodWcS5PyYq-8QD8S7Bx1t_uVswQtqG2D35XnE,796
891
- langchain/retrievers/multi_query.py,sha256=a3_-0qXY4Lj57pPiKVvhFYJXHEIdEJ02lq4GMv2RcA0,6991
891
+ langchain/retrievers/multi_query.py,sha256=2G90v5RxXiqM5JWIz6k8cgSdcrJ4uSGR6cebbCYFhbU,7049
892
892
  langchain/retrievers/multi_vector.py,sha256=0bt0wTfm1Ha21fH3Ikoln-iXzbnyHIh6lWI1vrmZMaI,3920
893
893
  langchain/retrievers/outline.py,sha256=uNuqhoHkfDx73ZEYbHbFjVmJfW-eAdLUzyC9EuoV608,635
894
894
  langchain/retrievers/parent_document_retriever.py,sha256=Xhy2tnAl1dmrajt-iu78BiFFp2SEGoy0Zi2lIlljDFY,5236
895
895
  langchain/retrievers/pinecone_hybrid_search.py,sha256=oEbmHdKIZ86H1O8GhzNC1KVfKb_xAJdRJXpODMY6X3Y,674
896
896
  langchain/retrievers/pubmed.py,sha256=kbgj7U6x5YiXcVWobxIJDPnx3eiBAMK5HyRlELcIxsY,632
897
897
  langchain/retrievers/pupmed.py,sha256=kbgj7U6x5YiXcVWobxIJDPnx3eiBAMK5HyRlELcIxsY,632
898
- langchain/retrievers/re_phraser.py,sha256=A9kI_EL5N29UXi6ct__KZCZdVVLLi8RaLgligHmDrK4,2654
898
+ langchain/retrievers/re_phraser.py,sha256=tujIOQrkc5r_bQKVt7CxzI797wFb1TBwpngJLm2kxwE,2712
899
899
  langchain/retrievers/remote_retriever.py,sha256=f1jPII31IkNrhkH1LvlUlNLRQNMKNvgE_7qHa3o3P04,659
900
900
  langchain/retrievers/self_query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
901
901
  langchain/retrievers/self_query/astradb.py,sha256=lxlkYOr8xicH7MNyQKIg3Wc-XwhVpKGBn7maqYyR3Hk,670
902
- langchain/retrievers/self_query/base.py,sha256=kwmeMvTYqoIsORs4tm7oZbkhVN2KuQ1lvi3vuEE5Qnw,13006
902
+ langchain/retrievers/self_query/base.py,sha256=9zJ4MNeWBVsaFH5TS6nX7rMYNoIm-txlBkhpNCyyQFo,13096
903
903
  langchain/retrievers/self_query/chroma.py,sha256=F0u_3Id1J1hIYM2D8_oNL2JJVetTFDyqW6fuGhjZ0ew,665
904
904
  langchain/retrievers/self_query/dashvector.py,sha256=CJAJQuJYNmw_GUIwwlPx3Scu1uDESTnFF-CzZEwFRRg,685
905
905
  langchain/retrievers/self_query/databricks_vector_search.py,sha256=S9V-XRfG6taeW3yRx_NZs4h-R4TiyHLnuJTIZa5rsqM,782
@@ -1182,7 +1182,7 @@ langchain/tools/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
1182
1182
  langchain/tools/youtube/search.py,sha256=EpZPKchS1q9KFJeffMjAE2dfThbFwefWUZJTv6gCx8U,628
1183
1183
  langchain/tools/zapier/__init__.py,sha256=0huVqFnztFR6XGoZ7yQQwRFK8wW40VU6OnKbcsb3E-s,764
1184
1184
  langchain/tools/zapier/tool.py,sha256=GGyvSMzNG57HS0PQ1x7F-1a1qQWztAd7qb9WsuXJgSw,745
1185
- langchain/utilities/__init__.py,sha256=GK_pib3J6sbxbeCsy0FCGy7pUf1DyeStukJSgxcnGJ0,5891
1185
+ langchain/utilities/__init__.py,sha256=oruz1KexP7EwTPKsMy5WygboYg2WaD8n3UCTu_f3En4,6022
1186
1186
  langchain/utilities/alpha_vantage.py,sha256=OgO-VWunWKArZQxq7r4awzxf8-wCbQZmIpb9gvVuH0s,651
1187
1187
  langchain/utilities/anthropic.py,sha256=mBrkZ5DaeZepzdJaUkkGziD7m2fsMjx5paytoruLwOo,839
1188
1188
  langchain/utilities/apify.py,sha256=sFbnvcDDczN5o1xjU_k296GuwwZCtbPCfEKHbdzvlQw,621
@@ -1222,7 +1222,7 @@ langchain/utilities/outline.py,sha256=xlT8l23BPPTgeBirZ6PTRGuaq0FkOh6xByRQIH7EQp
1222
1222
  langchain/utilities/portkey.py,sha256=y-R0mWJeJL3Fk4AWMt79jW1BSQF0J4YWcYAXAqytECk,606
1223
1223
  langchain/utilities/powerbi.py,sha256=GZHYSwSmx6ONOIu0dOeucT8fedWAQBIqPkHkvIVGI84,627
1224
1224
  langchain/utilities/pubmed.py,sha256=O32mmI3xN0SQIFV38-wDh9WmhgWe3yDwIIAkkwZJqMA,633
1225
- langchain/utilities/python.py,sha256=uWfB2YOktnaGO3OvUOMB6_3fRfaxMPGqOyKWgTjmSKA,462
1225
+ langchain/utilities/python.py,sha256=8nodLRp-MiPoKtBp2IdfZ0iU2mQC2kKwTuu9Jkz8DD8,554
1226
1226
  langchain/utilities/reddit_search.py,sha256=ifhYqW0ocDJtj6wR39bBEdg0sm6M3j9b5boN2KfaK8E,685
1227
1227
  langchain/utilities/redis.py,sha256=ReyZTSsaJCqt5sagnDyvz8uwp_9HSU_QrDO55REDhz8,889
1228
1228
  langchain/utilities/requests.py,sha256=oQOanvlxXdm0t3d3WvpOpb3xa0Dhas7ozC9I0fbYlsw,712
@@ -1333,8 +1333,8 @@ langchain/vectorstores/xata.py,sha256=HW_Oi5Hz8rH2JaUhRNWQ-3hLYmNzD8eAz6K5YqPArm
1333
1333
  langchain/vectorstores/yellowbrick.py,sha256=-lnjGcRE8Q1nEPOTdbKYTw5noS2cy2ce1ePOU804-_o,624
1334
1334
  langchain/vectorstores/zep.py,sha256=RJ2auxoA6uHHLEZknw3_jeFmYJYVt-PWKMBcNMGV6TM,798
1335
1335
  langchain/vectorstores/zilliz.py,sha256=XhPPIUfKPFJw0_svCoBgCnNkkBLoRVVcyuMfOnE5IxU,609
1336
- langchain-0.2.4.dist-info/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
1337
- langchain-0.2.4.dist-info/METADATA,sha256=bf2FLs-wyfDFL1V_Nvws27-xRU12t0Lo06G2JEy_vyw,6956
1338
- langchain-0.2.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1339
- langchain-0.2.4.dist-info/entry_points.txt,sha256=IgKjoXnkkVC8Nm7ggiFMCNAk01ua6RVTb9cmZTVNm5w,58
1340
- langchain-0.2.4.dist-info/RECORD,,
1336
+ langchain-0.2.6.dist-info/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
1337
+ langchain-0.2.6.dist-info/METADATA,sha256=r15qswxkrTFswRs0JK8Punij-CkTDUsIspSx07IMcvE,6965
1338
+ langchain-0.2.6.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1339
+ langchain-0.2.6.dist-info/entry_points.txt,sha256=IgKjoXnkkVC8Nm7ggiFMCNAk01ua6RVTb9cmZTVNm5w,58
1340
+ langchain-0.2.6.dist-info/RECORD,,