File tree Expand file tree Collapse file tree 18 files changed +39
-72
lines changed
integration_tests/chat_models Expand file tree Collapse file tree 18 files changed +39
-72
lines changed Original file line number Diff line number Diff line change @@ -120,11 +120,11 @@ def __getattr__(name: str) -> Any:
120
120
"""Get attr name."""
121
121
if name in DEPRECATED_CODE :
122
122
# Get directory of langchain package
123
- HERE = Path (__file__ ).parents [1 ]
123
+ here = Path (__file__ ).parents [1 ]
124
124
relative_path = as_import_path (
125
125
Path (__file__ ).parent ,
126
126
suffix = name ,
127
- relative_to = HERE ,
127
+ relative_to = here ,
128
128
)
129
129
old_path = "langchain." + relative_path
130
130
new_path = "langchain_experimental." + relative_path
Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from typing import Any
3
2
4
- from langchain_core ._api .path import as_import_path
5
-
6
3
7
4
def __getattr__ (name : str ) -> Any :
8
5
"""Get attr name."""
9
6
10
7
if name == "create_csv_agent" :
11
- # Get directory of langchain package
12
- HERE = Path (__file__ ).parents [3 ]
13
- here = as_import_path (Path (__file__ ).parent , relative_to = HERE )
14
-
15
- old_path = "langchain." + here + "." + name
16
- new_path = "langchain_experimental." + here + "." + name
17
8
msg = (
18
9
"This agent has been moved to langchain experiment. "
19
10
"This agent relies on python REPL tool under the hood, so to use it "
20
11
"safely please sandbox the python REPL. "
21
12
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
22
13
"and https://github.com/langchain-ai/langchain/discussions/11680"
23
14
"To keep using this code as is, install langchain experimental and "
24
- f"update your import statement from:\n `{ old_path } ` to `{ new_path } `."
15
+ "update your import statement from:\n "
16
+ f"`langchain.agents.agent_toolkits.csv.{ name } ` to "
17
+ f"`langchain_experimental.agents.agent_toolkits.{ name } `."
25
18
)
26
19
raise ImportError (msg )
27
20
msg = f"{ name } does not exist"
Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from typing import Any
3
2
4
- from langchain_core ._api .path import as_import_path
5
-
6
3
7
4
def __getattr__ (name : str ) -> Any :
8
5
"""Get attr name."""
9
6
10
7
if name == "create_pandas_dataframe_agent" :
11
- # Get directory of langchain package
12
- HERE = Path (__file__ ).parents [3 ]
13
- here = as_import_path (Path (__file__ ).parent , relative_to = HERE )
14
-
15
- old_path = "langchain." + here + "." + name
16
- new_path = "langchain_experimental." + here + "." + name
17
8
msg = (
18
9
"This agent has been moved to langchain experiment. "
19
10
"This agent relies on python REPL tool under the hood, so to use it "
20
11
"safely please sandbox the python REPL. "
21
12
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
22
13
"and https://github.com/langchain-ai/langchain/discussions/11680"
23
14
"To keep using this code as is, install langchain experimental and "
24
- f"update your import statement from:\n `{ old_path } ` to `{ new_path } `."
15
+ "update your import statement from:\n "
16
+ f"`langchain.agents.agent_toolkits.pandas.{ name } ` to "
17
+ f"`langchain_experimental.agents.agent_toolkits.{ name } `."
25
18
)
26
19
raise ImportError (msg )
27
20
msg = f"{ name } does not exist"
Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from typing import Any
3
2
4
- from langchain_core ._api .path import as_import_path
5
-
6
3
7
4
def __getattr__ (name : str ) -> Any :
8
5
"""Get attr name."""
9
6
10
7
if name == "create_python_agent" :
11
- # Get directory of langchain package
12
- HERE = Path (__file__ ).parents [3 ]
13
- here = as_import_path (Path (__file__ ).parent , relative_to = HERE )
14
-
15
- old_path = "langchain." + here + "." + name
16
- new_path = "langchain_experimental." + here + "." + name
17
8
msg = (
18
9
"This agent has been moved to langchain experiment. "
19
10
"This agent relies on python REPL tool under the hood, so to use it "
20
11
"safely please sandbox the python REPL. "
21
12
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
22
13
"and https://github.com/langchain-ai/langchain/discussions/11680"
23
14
"To keep using this code as is, install langchain experimental and "
24
- f"update your import statement from:\n `{ old_path } ` to `{ new_path } `."
15
+ "update your import statement from:\n "
16
+ f"`langchain.agents.agent_toolkits.python.{ name } ` to "
17
+ f"`langchain_experimental.agents.agent_toolkits.{ name } `."
25
18
)
26
19
raise ImportError (msg )
27
20
msg = f"{ name } does not exist"
Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from typing import Any
3
2
4
- from langchain_core ._api .path import as_import_path
5
-
6
3
7
4
def __getattr__ (name : str ) -> Any :
8
5
"""Get attr name."""
9
6
10
7
if name == "create_spark_dataframe_agent" :
11
- # Get directory of langchain package
12
- HERE = Path (__file__ ).parents [3 ]
13
- here = as_import_path (Path (__file__ ).parent , relative_to = HERE )
14
-
15
- old_path = "langchain." + here + "." + name
16
- new_path = "langchain_experimental." + here + "." + name
17
8
msg = (
18
9
"This agent has been moved to langchain experiment. "
19
10
"This agent relies on python REPL tool under the hood, so to use it "
20
11
"safely please sandbox the python REPL. "
21
12
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
22
13
"and https://github.com/langchain-ai/langchain/discussions/11680"
23
14
"To keep using this code as is, install langchain experimental and "
24
- f"update your import statement from:\n `{ old_path } ` to `{ new_path } `."
15
+ "update your import statement from:\n "
16
+ f"`langchain.agents.agent_toolkits.spark.{ name } ` to "
17
+ f"`langchain_experimental.agents.agent_toolkits.{ name } `."
25
18
)
26
19
raise ImportError (msg )
27
20
msg = f"{ name } does not exist"
Original file line number Diff line number Diff line change 1
- from pathlib import Path
2
1
from typing import Any
3
2
4
- from langchain_core ._api .path import as_import_path
5
-
6
3
7
4
def __getattr__ (name : str ) -> Any :
8
5
"""Get attr name."""
9
6
10
7
if name == "create_xorbits_agent" :
11
- # Get directory of langchain package
12
- HERE = Path (__file__ ).parents [3 ]
13
- here = as_import_path (Path (__file__ ).parent , relative_to = HERE )
14
-
15
- old_path = "langchain." + here + "." + name
16
- new_path = "langchain_experimental." + here + "." + name
17
8
msg = (
18
9
"This agent has been moved to langchain experiment. "
19
10
"This agent relies on python REPL tool under the hood, so to use it "
20
11
"safely please sandbox the python REPL. "
21
12
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
22
13
"and https://github.com/langchain-ai/langchain/discussions/11680"
23
14
"To keep using this code as is, install langchain experimental and "
24
- f"update your import statement from:\n `{ old_path } ` to `{ new_path } `."
15
+ "update your import statement from:\n "
16
+ f"`langchain.agents.agent_toolkits.xorbits.{ name } ` to "
17
+ f"`langchain_experimental.agents.agent_toolkits.{ name } `."
25
18
)
26
19
raise ImportError (msg )
27
20
msg = f"{ name } does not exist"
Original file line number Diff line number Diff line change 9
9
from streamlit .delta_generator import DeltaGenerator
10
10
11
11
12
- def StreamlitCallbackHandler (
12
+ def StreamlitCallbackHandler ( # noqa: N802
13
13
parent_container : DeltaGenerator ,
14
14
* ,
15
15
max_thought_containers : int = 4 ,
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class LLMChain(Chain):
79
79
80
80
@classmethod
81
81
@override
82
- def is_lc_serializable (self ) -> bool :
82
+ def is_lc_serializable (cls ) -> bool :
83
83
return True
84
84
85
85
prompt : BasePromptTemplate
Original file line number Diff line number Diff line change @@ -645,6 +645,7 @@ def with_config(
645
645
)
646
646
647
647
@property
648
+ @override
648
649
def InputType (self ) -> TypeAlias :
649
650
"""Get the input type for this runnable."""
650
651
from langchain_core .prompt_values import (
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
97
97
Pinecone as CommunityPinecone ,
98
98
)
99
99
100
- BUILTIN_TRANSLATORS : dict [type [VectorStore ], type [Visitor ]] = {
100
+ builtin_translators : dict [type [VectorStore ], type [Visitor ]] = {
101
101
AstraDB : AstraDBTranslator ,
102
102
PGVector : PGVectorTranslator ,
103
103
CommunityPinecone : PineconeTranslator ,
@@ -128,8 +128,8 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
128
128
field .name for field in (vectorstore .meta_fields or []) if field .index
129
129
]
130
130
return TencentVectorDBTranslator (fields )
131
- if vectorstore .__class__ in BUILTIN_TRANSLATORS :
132
- return BUILTIN_TRANSLATORS [vectorstore .__class__ ]()
131
+ if vectorstore .__class__ in builtin_translators :
132
+ return builtin_translators [vectorstore .__class__ ]()
133
133
try :
134
134
from langchain_astradb .vectorstores import AstraDBVectorStore
135
135
except ImportError :
You can’t perform that action at this time.
0 commit comments