id
stringlengths 14
15
| text
stringlengths 35
2.07k
| embedding
sequence | source
stringlengths 61
154
|
---|---|---|---|
589559ef7bbf-4 | Cypher statement.\n\nThe question is:\n{question}', template_format='f-string', validate_template=True), **kwargs: Any) → KuzuQAChain[source]¶ | [
57815,
29182,
5224,
7255,
77,
1734,
791,
3488,
374,
7338,
77,
90,
7998,
17266,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
3146,
9872,
25,
5884,
8,
11651,
735,
87425,
48622,
19368,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html |
589559ef7bbf-5 | Initialize from LLM.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable. | [
10130,
505,
445,
11237,
627,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html |
589559ef7bbf-6 | property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html |
aceea0037fc2-0 | langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain¶
class langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, combine_docs_chain: BaseCombineDocumentsChain, question_generator: LLMChain, output_key: str = 'answer', return_source_documents: bool = False, return_generated_question: bool = False, get_chat_history: Optional[Callable[[Union[Tuple[str, str], BaseMessage]], str]] = None)[source]¶
Bases: Chain
Chain for chatting with an index.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param combine_docs_chain: BaseCombineDocumentsChain [Required]¶
param get_chat_history: Optional[Callable[[CHAT_TURN_TYPE], str]] = None¶
Return the source documents.
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes | [
5317,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
13316,
1128,
3078,
1697,
12289,
7379,
838,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
13316,
1128,
3078,
1697,
12289,
7379,
838,
19368,
4163,
11,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
16343,
50792,
31683,
25,
5464,
82214,
28242,
19368,
11,
3488,
26898,
25,
445,
11237,
19368,
11,
2612,
3173,
25,
610,
284,
364,
9399,
518,
471,
10561,
77027,
25,
1845,
284,
3641,
11,
471,
68413,
30015,
25,
1845,
284,
3641,
11,
636,
36153,
20389,
25,
12536,
58,
41510,
15873,
33758,
20961,
6189,
17752,
11,
610,
1145,
5464,
2097,
21128,
610,
5163,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
369,
52067,
449,
459,
1963,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
16343,
50792,
31683,
25,
5464,
82214,
28242,
19368,
510,
8327,
60,
55609,
198,
913,
636,
36153,
20389,
25,
12536,
58,
41510,
15873,
61817,
95683,
4283,
1145,
610,
5163,
284,
2290,
55609,
198,
5715,
279,
2592,
9477,
627,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
aceea0037fc2-1 | and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param output_key: str = 'answer'¶
param question_generator: LLMChain [Required]¶
param return_generated_question: bool = False¶
param return_source_documents: bool = False¶
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults | [
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
2612,
3173,
25,
610,
284,
364,
9399,
6,
55609,
198,
913,
3488,
26898,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
471,
68413,
30015,
25,
1845,
284,
3641,
55609,
198,
913,
471,
10561,
77027,
25,
1845,
284,
3641,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
aceea0037fc2-2 | include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs. | [
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
aceea0037fc2-3 | Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None[source]¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property input_keys: List[str]¶
Input keys.
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config[source]¶
Bases: object | [
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
76747,
60,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
1988,
12919,
25,
1796,
17752,
60,
55609,
198,
2566,
7039,
627,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
aceea0037fc2-4 | model Config[source]¶
Bases: object
Configuration for this pydantic object.
allow_population_by_field_name = True¶
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
7331,
75672,
3795,
5121,
1292,
284,
3082,
55609,
198,
277,
88951,
9962,
43255,
284,
3082,
55609,
198,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
3889c3fe0120-0 | langchain.chains.transform.TransformChain¶
class langchain.chains.transform.TransformChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, input_variables: List[str], output_variables: List[str], transform: Callable[[Dict[str, str]], Dict[str, str]])[source]¶
Bases: Chain
Chain transform chain output.
Example
from langchain import TransformChain
transform_chain = TransformChain(input_variables=["text"],
output_variables["entities"], transform=func())
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param input_variables: List[str] [Required]¶
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param output_variables: List[str] [Required]¶
param tags: Optional[List[str]] = None¶ | [
5317,
8995,
5442,
1771,
8297,
46265,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
8297,
46265,
19368,
4163,
11,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
1988,
29282,
25,
1796,
17752,
1145,
2612,
29282,
25,
1796,
17752,
1145,
5276,
25,
54223,
15873,
13755,
17752,
11,
610,
21128,
30226,
17752,
11,
610,
30716,
58,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
5276,
8957,
2612,
627,
13617,
198,
1527,
8859,
8995,
1179,
15583,
19368,
198,
4806,
31683,
284,
15583,
19368,
5498,
29282,
29065,
1342,
8257,
2612,
29282,
1204,
10720,
8073,
5276,
28,
2900,
2455,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
1988,
29282,
25,
1796,
17752,
60,
510,
8327,
60,
55609,
198,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
2612,
29282,
25,
1796,
17752,
60,
510,
8327,
60,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.transform.TransformChain.html |
3889c3fe0120-1 | param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param transform: Callable[[Dict[str, str]], Dict[str, str]] [Required]¶
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶ | [
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
5276,
25,
54223,
15873,
13755,
17752,
11,
610,
21128,
30226,
17752,
11,
610,
5163,
510,
8327,
60,
55609,
198,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.transform.TransformChain.html |
3889c3fe0120-2 | Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ | [
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.transform.TransformChain.html |
3889c3fe0120-3 | Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.transform.TransformChain.html |
8e84d039f837-0 | langchain.chains.openai_functions.openapi.get_openapi_chain¶
langchain.chains.openai_functions.openapi.get_openapi_chain(spec: Union[OpenAPISpec, str], llm: Optional[BaseLanguageModel] = None, prompt: Optional[BasePromptTemplate] = None, request_chain: Optional[Chain] = None, llm_kwargs: Optional[Dict] = None, verbose: bool = False, headers: Optional[Dict] = None, params: Optional[Dict] = None, **kwargs: Any) → SequentialChain[source]¶
Create a chain for querying an API from a OpenAPI spec.
Parameters
spec – OpenAPISpec or url/file/text string corresponding to one.
llm – language model, should be an OpenAI function-calling model, e.g.
ChatOpenAI(model=”gpt-3.5-turbo-0613”).
prompt – Main prompt template to use.
request_chain – Chain for taking the functions output and executing the request. | [
5317,
8995,
5442,
1771,
5949,
2192,
32808,
59920,
673,
11563,
2113,
31683,
55609,
198,
5317,
8995,
5442,
1771,
5949,
2192,
32808,
59920,
673,
11563,
2113,
31683,
39309,
25,
9323,
58,
5109,
2599,
1669,
1007,
11,
610,
1145,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
10137,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
11,
1715,
31683,
25,
12536,
58,
19368,
60,
284,
2290,
11,
9507,
76,
37335,
25,
12536,
58,
13755,
60,
284,
2290,
11,
14008,
25,
1845,
284,
3641,
11,
7247,
25,
12536,
58,
13755,
60,
284,
2290,
11,
3712,
25,
12536,
58,
13755,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
60109,
19368,
76747,
60,
55609,
198,
4110,
264,
8957,
369,
82198,
459,
5446,
505,
264,
5377,
7227,
1424,
627,
9905,
198,
9727,
1389,
5377,
2599,
1669,
1007,
477,
2576,
24849,
37371,
925,
12435,
311,
832,
627,
657,
76,
1389,
4221,
1646,
11,
1288,
387,
459,
5377,
15836,
734,
1824,
17157,
1646,
11,
384,
1326,
627,
16047,
5109,
15836,
7790,
45221,
70,
418,
12,
18,
13,
20,
2442,
324,
754,
12,
23324,
18,
863,
4390,
41681,
1389,
4802,
10137,
3896,
311,
1005,
627,
2079,
31683,
1389,
29625,
369,
4737,
279,
5865,
2612,
323,
31320,
279,
1715,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.openai_functions.openapi.get_openapi_chain.html |
8db2ae8ae82f-0 | langchain.chains.query_constructor.ir.Comparison¶
class langchain.chains.query_constructor.ir.Comparison(*, comparator: Comparator, attribute: str, value: Any = None)[source]¶
Bases: FilterDirective
A comparison to a value.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param attribute: str [Required]¶
param comparator: langchain.chains.query_constructor.ir.Comparator [Required]¶
param value: Any = None¶
accept(visitor: Visitor) → Any¶ | [
5317,
8995,
5442,
1771,
4891,
67310,
64450,
3034,
36642,
55609,
198,
1058,
8859,
8995,
5442,
1771,
4891,
67310,
64450,
3034,
36642,
4163,
11,
53140,
25,
51641,
11,
7180,
25,
610,
11,
907,
25,
5884,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
12619,
63176,
198,
32,
12593,
311,
264,
907,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
7180,
25,
610,
510,
8327,
60,
55609,
198,
913,
53140,
25,
8859,
8995,
5442,
1771,
4891,
67310,
64450,
80357,
510,
8327,
60,
55609,
198,
913,
907,
25,
5884,
284,
2290,
55609,
198,
10543,
94416,
25,
56982,
8,
11651,
5884,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.query_constructor.ir.Comparison.html |
11b5ee43d3ac-0 | langchain.chains.llm_math.base.LLMMathChain¶
class langchain.chains.llm_math.base.LLMMathChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, llm_chain: LLMChain, llm: Optional[BaseLanguageModel] = None, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${{Question with math problem.}}\n```text\n${{single line mathematical expression that solves the problem}}\n```\n...numexpr.evaluate(text)...\n```output\n${{Output of running the code}}\n```\nAnswer: ${{Answer}}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n```text\n37593 * 67\n```\n...numexpr.evaluate("37593 * 67")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True), input_key: str = 'question', output_key: str = 'answer')[source]¶
Bases: Chain | [
5317,
8995,
5442,
1771,
60098,
76,
66661,
9105,
1236,
43,
8195,
589,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
60098,
76,
66661,
9105,
1236,
43,
8195,
589,
19368,
4163,
11,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
9507,
76,
31683,
25,
445,
11237,
19368,
11,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
10137,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
28573,
264,
7033,
3575,
1139,
264,
7645,
430,
649,
387,
16070,
1701,
13325,
10379,
82,
1661,
9600,
6875,
13,
5560,
279,
2612,
315,
4401,
420,
2082,
311,
4320,
279,
3488,
7255,
77,
1734,
14924,
25,
400,
3052,
14924,
449,
7033,
3575,
13,
3500,
59,
77,
74694,
1342,
1734,
2420,
90,
15698,
1584,
37072,
7645,
430,
68577,
279,
3575,
3500,
59,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
7383,
8,
31901,
77,
74694,
3081,
1734,
2420,
90,
5207,
315,
4401,
279,
2082,
3500,
59,
77,
14196,
62169,
77,
16533,
25,
400,
3052,
16533,
3500,
59,
77,
1734,
11382,
7255,
77,
1734,
14924,
25,
3639,
374,
220,
12935,
6365,
353,
220,
3080,
33720,
77,
74694,
1342,
1734,
12935,
6365,
353,
220,
3080,
1734,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
353,
220,
3080,
909,
31901,
77,
74694,
3081,
1734,
13860,
25747,
16,
1734,
14196,
62169,
77,
16533,
25,
220,
13860,
25747,
16,
1734,
1734,
14924,
25,
220,
12935,
6365,
13571,
16,
14,
20,
10929,
77,
74694,
1342,
1734,
12935,
6365,
84825,
16,
14,
20,
10929,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
84825,
16,
14,
20,
69291,
31901,
77,
74694,
3081,
1734,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
14196,
62169,
77,
16533,
25,
220,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
1734,
14924,
25,
314,
7998,
11281,
77,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
1988,
3173,
25,
610,
284,
364,
7998,
518,
2612,
3173,
25,
610,
284,
364,
9399,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
29625
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-1 | Bases: Chain
Chain that interprets a prompt and executes python code to do math.
Example
from langchain import LLMMathChain, OpenAI
llm_math = LLMMathChain.from_llm(OpenAI())
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param llm: Optional[BaseLanguageModel] = None¶
[Deprecated] LLM wrapper to use.
param llm_chain: LLMChain [Required]¶
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog. | [
33,
2315,
25,
29625,
198,
19368,
430,
18412,
2641,
264,
10137,
323,
52535,
10344,
2082,
311,
656,
7033,
627,
13617,
198,
1527,
8859,
8995,
1179,
20072,
8195,
589,
19368,
11,
5377,
15836,
198,
657,
76,
66661,
284,
20072,
8195,
589,
19368,
6521,
44095,
76,
7,
5109,
15836,
2455,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
55609,
198,
58,
52444,
60,
445,
11237,
13564,
311,
1005,
627,
913,
9507,
76,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-2 | There are many different types of memory - please see memory docs
for the full catalog.
param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${{Question with math problem.}}\n```text\n${{single line mathematical expression that solves the problem}}\n```\n...numexpr.evaluate(text)...\n```output\n${{Output of running the code}}\n```\nAnswer: ${{Answer}}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n```text\n37593 * 67\n```\n...numexpr.evaluate("37593 * 67")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True)¶
[Deprecated] Prompt to use to translate to python if necessary.
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs | [
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
10137,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
28573,
264,
7033,
3575,
1139,
264,
7645,
430,
649,
387,
16070,
1701,
13325,
10379,
82,
1661,
9600,
6875,
13,
5560,
279,
2612,
315,
4401,
420,
2082,
311,
4320,
279,
3488,
7255,
77,
1734,
14924,
25,
400,
3052,
14924,
449,
7033,
3575,
13,
3500,
59,
77,
74694,
1342,
1734,
2420,
90,
15698,
1584,
37072,
7645,
430,
68577,
279,
3575,
3500,
59,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
7383,
8,
31901,
77,
74694,
3081,
1734,
2420,
90,
5207,
315,
4401,
279,
2082,
3500,
59,
77,
14196,
62169,
77,
16533,
25,
400,
3052,
16533,
3500,
59,
77,
1734,
11382,
7255,
77,
1734,
14924,
25,
3639,
374,
220,
12935,
6365,
353,
220,
3080,
33720,
77,
74694,
1342,
1734,
12935,
6365,
353,
220,
3080,
1734,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
353,
220,
3080,
909,
31901,
77,
74694,
3081,
1734,
13860,
25747,
16,
1734,
14196,
62169,
77,
16533,
25,
220,
13860,
25747,
16,
1734,
1734,
14924,
25,
220,
12935,
6365,
13571,
16,
14,
20,
10929,
77,
74694,
1342,
1734,
12935,
6365,
84825,
16,
14,
20,
10929,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
84825,
16,
14,
20,
69291,
31901,
77,
74694,
3081,
1734,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
14196,
62169,
77,
16533,
25,
220,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
1734,
14924,
25,
314,
7998,
11281,
77,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
8,
55609,
198,
58,
52444,
60,
60601,
311,
1005,
311,
15025,
311,
10344,
422,
5995,
627,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-3 | Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False. | [
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-4 | chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain. | [
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-5 | dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${{Question with math problem.}}\n```text\n${{single line mathematical expression that solves the problem}}\n```\n...numexpr.evaluate(text)...\n```output\n${{Output of running the code}}\n```\nAnswer: ${{Answer}}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n```text\n37593 * 67\n```\n...numexpr.evaluate("37593 * 67")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True), **kwargs: Any) → LLMMathChain[source]¶
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields, all fields[source]¶
Raise deprecation warning if callback_manager is used. | [
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
10137,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
28573,
264,
7033,
3575,
1139,
264,
7645,
430,
649,
387,
16070,
1701,
13325,
10379,
82,
1661,
9600,
6875,
13,
5560,
279,
2612,
315,
4401,
420,
2082,
311,
4320,
279,
3488,
7255,
77,
1734,
14924,
25,
400,
3052,
14924,
449,
7033,
3575,
13,
3500,
59,
77,
74694,
1342,
1734,
2420,
90,
15698,
1584,
37072,
7645,
430,
68577,
279,
3575,
3500,
59,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
7383,
8,
31901,
77,
74694,
3081,
1734,
2420,
90,
5207,
315,
4401,
279,
2082,
3500,
59,
77,
14196,
62169,
77,
16533,
25,
400,
3052,
16533,
3500,
59,
77,
1734,
11382,
7255,
77,
1734,
14924,
25,
3639,
374,
220,
12935,
6365,
353,
220,
3080,
33720,
77,
74694,
1342,
1734,
12935,
6365,
353,
220,
3080,
1734,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
353,
220,
3080,
909,
31901,
77,
74694,
3081,
1734,
13860,
25747,
16,
1734,
14196,
62169,
77,
16533,
25,
220,
13860,
25747,
16,
1734,
1734,
14924,
25,
220,
12935,
6365,
13571,
16,
14,
20,
10929,
77,
74694,
1342,
1734,
12935,
6365,
84825,
16,
14,
20,
10929,
77,
14196,
62169,
77,
1131,
2470,
9600,
37136,
446,
12935,
6365,
84825,
16,
14,
20,
69291,
31901,
77,
74694,
3081,
1734,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
14196,
62169,
77,
16533,
25,
220,
23,
13,
9716,
25009,
22638,
14590,
21982,
1734,
1734,
14924,
25,
314,
7998,
11281,
77,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
3146,
9872,
25,
5884,
8,
11651,
20072,
8195,
589,
19368,
76747,
60,
55609,
198,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
11,
682,
5151,
76747,
60,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
11b5ee43d3ac-6 | Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609,
198,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
5cdda38819e2-0 | langchain.chains.query_constructor.base.load_query_constructor_chain¶
langchain.chains.query_constructor.base.load_query_constructor_chain(llm: BaseLanguageModel, document_contents: str, attribute_info: List[AttributeInfo], examples: Optional[List] = None, allowed_comparators: Optional[Sequence[Comparator]] = None, allowed_operators: Optional[Sequence[Operator]] = None, enable_limit: bool = False, **kwargs: Any) → LLMChain[source]¶
Load a query constructor chain.
:param llm: BaseLanguageModel to use for the chain.
:param document_contents: The contents of the document to be queried.
:param attribute_info: A list of AttributeInfo objects describing
the attributes of the document.
Parameters
examples – Optional list of examples to use for the chain.
allowed_comparators – An optional list of allowed comparators.
allowed_operators – An optional list of allowed operators.
enable_limit – Whether to enable the limit operator. Defaults to False.
**kwargs –
Returns
A LLMChain that can be used to construct queries. | [
5317,
8995,
5442,
1771,
4891,
67310,
9105,
5214,
5857,
67310,
31683,
55609,
198,
5317,
8995,
5442,
1771,
4891,
67310,
9105,
5214,
5857,
67310,
31683,
36621,
76,
25,
5464,
14126,
1747,
11,
2246,
17096,
25,
610,
11,
7180,
3186,
25,
1796,
58,
3994,
1767,
1145,
10507,
25,
12536,
53094,
60,
284,
2290,
11,
5535,
3038,
1768,
3046,
25,
12536,
58,
14405,
58,
39758,
5163,
284,
2290,
11,
5535,
26716,
3046,
25,
12536,
58,
14405,
58,
18968,
5163,
284,
2290,
11,
7431,
15106,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
19368,
76747,
60,
55609,
198,
6003,
264,
3319,
4797,
8957,
627,
68416,
9507,
76,
25,
5464,
14126,
1747,
311,
1005,
369,
279,
8957,
627,
68416,
2246,
17096,
25,
578,
8970,
315,
279,
2246,
311,
387,
79002,
627,
68416,
7180,
3186,
25,
362,
1160,
315,
17170,
1767,
6302,
23524,
198,
1820,
8365,
315,
279,
2246,
627,
9905,
198,
52768,
1389,
12536,
1160,
315,
10507,
311,
1005,
369,
279,
8957,
627,
21642,
3038,
1768,
3046,
1389,
1556,
10309,
1160,
315,
5535,
7809,
3046,
627,
21642,
26716,
3046,
1389,
1556,
10309,
1160,
315,
5535,
20197,
627,
12837,
15106,
1389,
13440,
311,
7431,
279,
4017,
5793,
13,
37090,
311,
3641,
627,
334,
9872,
1389,
720,
16851,
198,
32,
445,
11237,
19368,
430,
649,
387,
1511,
311,
9429,
20126,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.query_constructor.base.load_query_constructor_chain.html |
3a09677d4f04-0 | langchain.chains.router.llm_router.LLMRouterChain¶
class langchain.chains.router.llm_router.LLMRouterChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, llm_chain: LLMChain)[source]¶
Bases: RouterChain
A router chain that uses an LLM chain to perform routing.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param llm_chain: LLMChain [Required]¶
LLM chain used to perform routing
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain, | [
5317,
8995,
5442,
1771,
22909,
60098,
76,
56687,
1236,
11237,
9713,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
22909,
60098,
76,
56687,
1236,
11237,
9713,
19368,
4163,
11,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
9507,
76,
31683,
25,
445,
11237,
19368,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
10777,
19368,
198,
32,
9457,
8957,
430,
5829,
459,
445,
11237,
8957,
311,
2804,
30158,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
9507,
76,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
4178,
44,
8957,
1511,
311,
2804,
30158,
198,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
11
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html |
3a09677d4f04-1 | These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the | [
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html |
3a09677d4f04-2 | only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async aroute(inputs: Dict[str, Any], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Route¶
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate, **kwargs: Any) → LLMRouterChain[source]¶
Convenience constructor.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used. | [
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
2182,
35099,
25,
30226,
17752,
11,
5884,
1145,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
9767,
55609,
198,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
10137,
25,
5464,
55715,
7423,
11,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
9713,
19368,
76747,
60,
55609,
198,
1128,
40647,
4797,
627,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html |
3a09677d4f04-3 | Raise deprecation warning if callback_manager is used.
route(inputs: Dict[str, Any], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Route¶
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
validator validate_prompt » all fields[source]¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
property output_keys: List[str]¶
Output keys this chain expects.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
9143,
35099,
25,
30226,
17752,
11,
5884,
1145,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
9767,
55609,
198,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
16503,
9788,
62521,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
3784,
2612,
12919,
25,
1796,
17752,
60,
55609,
198,
5207,
7039,
420,
8957,
25283,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html |
3a09677d4f04-4 | Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html |
689fdb3244cb-0 | langchain.chains.question_answering.__init__.LoadingCallable¶
class langchain.chains.question_answering.__init__.LoadingCallable(*args, **kwargs)[source]¶
Bases: Protocol
Interface for loading the combine documents chain.
Methods
__init__(*args, **kwargs)
__call__(llm: BaseLanguageModel, **kwargs: Any) → BaseCombineDocumentsChain[source]¶
Callable to load the combine documents chain. | [
5317,
8995,
5442,
1771,
32846,
61901,
86,
4776,
4952,
2381,
19247,
8746,
41510,
55609,
198,
1058,
8859,
8995,
5442,
1771,
32846,
61901,
86,
4776,
4952,
2381,
19247,
8746,
41510,
4163,
2164,
11,
3146,
9872,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
25590,
198,
5160,
369,
8441,
279,
16343,
9477,
8957,
627,
18337,
198,
565,
2381,
69106,
2164,
11,
4194,
334,
9872,
340,
565,
6797,
3889,
657,
76,
25,
5464,
14126,
1747,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
82214,
28242,
19368,
76747,
60,
55609,
198,
41510,
311,
2865,
279,
16343,
9477,
8957,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.question_answering.__init__.LoadingCallable.html |
298873de4d41-0 | langchain.chains.openai_functions.qa_with_structure.AnswerWithSources¶
class langchain.chains.openai_functions.qa_with_structure.AnswerWithSources(*, answer: str, sources: List[str])[source]¶
Bases: BaseModel
An answer to the question being asked, with sources.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param answer: str [Required]¶
Answer to the question that was asked
param sources: List[str] [Required]¶
List of sources used to answer the question | [
5317,
8995,
5442,
1771,
5949,
2192,
32808,
11608,
64,
6753,
39383,
8794,
3643,
2409,
33300,
55609,
198,
1058,
8859,
8995,
5442,
1771,
5949,
2192,
32808,
11608,
64,
6753,
39383,
8794,
3643,
2409,
33300,
4163,
11,
4320,
25,
610,
11,
8336,
25,
1796,
17752,
41105,
2484,
60,
55609,
198,
33,
2315,
25,
65705,
198,
2127,
4320,
311,
279,
3488,
1694,
4691,
11,
449,
8336,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4320,
25,
610,
510,
8327,
60,
55609,
198,
16533,
311,
279,
3488,
430,
574,
4691,
198,
913,
8336,
25,
1796,
17752,
60,
510,
8327,
60,
55609,
198,
861,
315,
8336,
1511,
311,
4320,
279,
3488
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.AnswerWithSources.html |
cd8c1407eec7-0 | langchain.chains.query_constructor.parser.get_parser¶
langchain.chains.query_constructor.parser.get_parser(allowed_comparators: Optional[Sequence[Comparator]] = None, allowed_operators: Optional[Sequence[Operator]] = None) → object[source]¶
Returns a parser for the query language.
Parameters
allowed_comparators – Optional[Sequence[Comparator]]
allowed_operators – Optional[Sequence[Operator]]
Returns
Lark parser for the query language. | [
5317,
8995,
5442,
1771,
4891,
67310,
26699,
673,
19024,
55609,
198,
5317,
8995,
5442,
1771,
4891,
67310,
26699,
673,
19024,
7,
21642,
3038,
1768,
3046,
25,
12536,
58,
14405,
58,
39758,
5163,
284,
2290,
11,
5535,
26716,
3046,
25,
12536,
58,
14405,
58,
18968,
5163,
284,
2290,
8,
11651,
1665,
76747,
60,
55609,
198,
16851,
264,
6871,
369,
279,
3319,
4221,
627,
9905,
198,
21642,
3038,
1768,
3046,
1389,
12536,
58,
14405,
58,
39758,
14623,
21642,
26716,
3046,
1389,
12536,
58,
14405,
58,
18968,
14623,
16851,
198,
43,
847,
6871,
369,
279,
3319,
4221,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.query_constructor.parser.get_parser.html |
78be251f38c2-0 | langchain.chains.flare.prompts.FinishedOutputParser¶
class langchain.chains.flare.prompts.FinishedOutputParser(*, finished_value: str = 'FINISHED')[source]¶
Bases: BaseOutputParser[Tuple[str, bool]]
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param finished_value: str = 'FINISHED'¶
dict(**kwargs: Any) → Dict¶
Return dictionary representation of output parser.
get_format_instructions() → str¶
Instructions on how the LLM output should be formatted.
parse(text: str) → Tuple[str, bool][source]¶
Parse the output of an LLM call.
A method which takes in a string (assumed output of a language model )
and parses it into some structure.
Parameters
text – output of language model
Returns
structured output
parse_result(result: List[Generation]) → T¶
Parse LLM Result.
parse_with_prompt(completion: str, prompt: PromptValue) → Any¶
Optional method to parse the output of an LLM call with a prompt.
The prompt is largely provided in the event the OutputParser wants
to retry or fix the output in some way, and needs information from
the prompt to do so.
Parameters
completion – output of language model
prompt – prompt value
Returns
structured output
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object. | [
5317,
8995,
5442,
1771,
8265,
548,
61848,
13044,
1006,
25682,
5207,
6707,
55609,
198,
1058,
8859,
8995,
5442,
1771,
8265,
548,
61848,
13044,
1006,
25682,
5207,
6707,
4163,
11,
8220,
3220,
25,
610,
284,
364,
17167,
39979,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
5207,
6707,
20961,
6189,
17752,
11,
1845,
14623,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
8220,
3220,
25,
610,
284,
364,
17167,
39979,
6,
55609,
198,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
2612,
6871,
627,
456,
9132,
83527,
368,
11651,
610,
55609,
198,
56391,
389,
1268,
279,
445,
11237,
2612,
1288,
387,
24001,
627,
6534,
7383,
25,
610,
8,
11651,
25645,
17752,
11,
1845,
1483,
2484,
60,
55609,
198,
14802,
279,
2612,
315,
459,
445,
11237,
1650,
627,
32,
1749,
902,
5097,
304,
264,
925,
320,
395,
39255,
2612,
315,
264,
4221,
1646,
1763,
438,
71935,
433,
1139,
1063,
6070,
627,
9905,
198,
1342,
1389,
2612,
315,
4221,
1646,
198,
16851,
198,
52243,
2612,
198,
6534,
5400,
4556,
25,
1796,
58,
38238,
2526,
11651,
350,
55609,
198,
14802,
445,
11237,
5832,
627,
6534,
6753,
62521,
91868,
25,
610,
11,
10137,
25,
60601,
1150,
8,
11651,
5884,
55609,
198,
15669,
1749,
311,
4820,
279,
2612,
315,
459,
445,
11237,
1650,
449,
264,
10137,
627,
791,
10137,
374,
14090,
3984,
304,
279,
1567,
279,
9442,
6707,
6944,
198,
998,
23515,
477,
5155,
279,
2612,
304,
1063,
1648,
11,
323,
3966,
2038,
505,
198,
1820,
10137,
311,
656,
779,
627,
9905,
198,
44412,
1389,
2612,
315,
4221,
1646,
198,
41681,
1389,
10137,
907,
198,
16851,
198,
52243,
2612,
198,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html |
78be251f38c2-1 | property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
extra = 'ignore'¶ | [
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
15824,
284,
364,
13431,
6,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html |
fe1b62630f1e-0 | langchain.chains.qa_generation.base.QAGenerationChain¶
class langchain.chains.qa_generation.base.QAGenerationChain(*, memory: ~typing.Optional[~langchain.schema.BaseMemory] = None, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, verbose: bool = None, tags: ~typing.Optional[~typing.List[str]] = None, llm_chain: ~langchain.chains.llm.LLMChain, text_splitter: ~langchain.text_splitter.TextSplitter = <langchain.text_splitter.RecursiveCharacterTextSplitter object>, input_key: str = 'text', output_key: str = 'questions', k: ~typing.Optional[int] = None)[source]¶
Bases: Chain
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param input_key: str = 'text'¶
param k: Optional[int] = None¶
param llm_chain: LLMChain [Required]¶
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start | [
5317,
8995,
5442,
1771,
11608,
64,
65291,
9105,
10208,
1929,
17699,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
11608,
64,
65291,
9105,
10208,
1929,
17699,
19368,
4163,
11,
5044,
25,
4056,
90902,
37464,
58,
93,
5317,
8995,
31992,
13316,
10869,
60,
284,
2290,
11,
27777,
25,
4056,
90902,
37464,
58,
93,
90902,
10840,
290,
58,
93,
90902,
5937,
58,
93,
5317,
8995,
72134,
9105,
13316,
7646,
3126,
1145,
4056,
5317,
8995,
72134,
9105,
13316,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
4056,
90902,
37464,
58,
93,
5317,
8995,
72134,
9105,
13316,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
4056,
90902,
37464,
58,
93,
90902,
5937,
17752,
5163,
284,
2290,
11,
9507,
76,
31683,
25,
4056,
5317,
8995,
5442,
1771,
60098,
76,
1236,
11237,
19368,
11,
1495,
17489,
466,
25,
4056,
5317,
8995,
2858,
17489,
466,
2021,
20805,
466,
284,
366,
5317,
8995,
2858,
17489,
466,
21259,
16921,
12686,
1199,
20805,
466,
1665,
8226,
1988,
3173,
25,
610,
284,
364,
1342,
518,
2612,
3173,
25,
610,
284,
364,
17800,
518,
597,
25,
4056,
90902,
37464,
19155,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
1988,
3173,
25,
610,
284,
364,
1342,
6,
55609,
198,
913,
597,
25,
12536,
19155,
60,
284,
2290,
55609,
198,
913,
9507,
76,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
fe1b62630f1e-1 | Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param output_key: str = 'questions'¶
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param text_splitter: TextSplitter = <langchain.text_splitter.RecursiveCharacterTextSplitter object>¶
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain. | [
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
2612,
3173,
25,
610,
284,
364,
17800,
6,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
1495,
17489,
466,
25,
2991,
20805,
466,
284,
366,
5317,
8995,
2858,
17489,
466,
21259,
16921,
12686,
1199,
20805,
466,
1665,
29,
55609,
198,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
fe1b62630f1e-2 | use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, prompt: Optional[BasePromptTemplate] = None, **kwargs: Any) → QAGenerationChain[source]¶ | [
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
10137,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
1229,
1929,
17699,
19368,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
fe1b62630f1e-3 | prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property input_keys: List[str]¶
Input keys this chain expects.
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶ | [
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
1988,
12919,
25,
1796,
17752,
60,
55609,
198,
2566,
7039,
420,
8957,
25283,
627,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
fe1b62630f1e-4 | property lc_serializable: bool¶
Return whether or not the class is serializable.
property output_keys: List[str]¶
Output keys this chain expects.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | [
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
3784,
2612,
12919,
25,
1796,
17752,
60,
55609,
198,
5207,
7039,
420,
8957,
25283,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
64419ae1ac1f-0 | langchain.chains.openai_functions.extraction.create_extraction_chain¶
langchain.chains.openai_functions.extraction.create_extraction_chain(schema: dict, llm: BaseLanguageModel) → Chain[source]¶
Creates a chain that extracts information from a passage.
Parameters
schema – The schema of the entities to extract.
llm – The language model to use.
Returns
Chain that can be used to extract information from a passage. | [
5317,
8995,
5442,
1771,
5949,
2192,
32808,
2272,
27523,
2581,
95942,
31683,
55609,
198,
5317,
8995,
5442,
1771,
5949,
2192,
32808,
2272,
27523,
2581,
95942,
31683,
43835,
25,
6587,
11,
9507,
76,
25,
5464,
14126,
1747,
8,
11651,
29625,
76747,
60,
55609,
198,
55968,
264,
8957,
430,
49062,
2038,
505,
264,
21765,
627,
9905,
198,
17801,
1389,
578,
11036,
315,
279,
15086,
311,
8819,
627,
657,
76,
1389,
578,
4221,
1646,
311,
1005,
627,
16851,
198,
19368,
430,
649,
387,
1511,
311,
8819,
2038,
505,
264,
21765,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.openai_functions.extraction.create_extraction_chain.html |
a1b82147205d-0 | langchain.chains.graph_qa.cypher.extract_cypher¶
langchain.chains.graph_qa.cypher.extract_cypher(text: str) → str[source]¶
Extract Cypher code from a text.
:param text: Text to extract Cypher code from.
Returns
Cypher code extracted from the text. | [
5317,
8995,
5442,
1771,
10996,
9153,
64,
57786,
29182,
38458,
669,
88,
29182,
55609,
198,
5317,
8995,
5442,
1771,
10996,
9153,
64,
57786,
29182,
38458,
669,
88,
29182,
7383,
25,
610,
8,
11651,
610,
76747,
60,
55609,
198,
30059,
18221,
29182,
2082,
505,
264,
1495,
627,
68416,
1495,
25,
2991,
311,
8819,
18221,
29182,
2082,
505,
627,
16851,
198,
57815,
29182,
2082,
28532,
505,
279,
1495,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.cypher.extract_cypher.html |
5ea8c0fbf14e-0 | langchain.chains.conversational_retrieval.base.ChatVectorDBChain¶
class langchain.chains.conversational_retrieval.base.ChatVectorDBChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, combine_docs_chain: BaseCombineDocumentsChain, question_generator: LLMChain, output_key: str = 'answer', return_source_documents: bool = False, return_generated_question: bool = False, get_chat_history: Optional[Callable[[Union[Tuple[str, str], BaseMessage]], str]] = None, vectorstore: VectorStore, top_k_docs_for_context: int = 4, search_kwargs: dict = None)[source]¶
Bases: BaseConversationalRetrievalChain
Chain for chatting with a vector database.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated, use callbacks instead.
param callbacks: Callbacks = None¶
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param combine_docs_chain: BaseCombineDocumentsChain [Required]¶
param get_chat_history: Optional[Callable[[CHAT_TURN_TYPE], str]] = None¶
Return the source documents.
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None. | [
5317,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
59944,
3866,
3590,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
59944,
3866,
3590,
19368,
4163,
11,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
11,
14008,
25,
1845,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
16343,
50792,
31683,
25,
5464,
82214,
28242,
19368,
11,
3488,
26898,
25,
445,
11237,
19368,
11,
2612,
3173,
25,
610,
284,
364,
9399,
518,
471,
10561,
77027,
25,
1845,
284,
3641,
11,
471,
68413,
30015,
25,
1845,
284,
3641,
11,
636,
36153,
20389,
25,
12536,
58,
41510,
15873,
33758,
20961,
6189,
17752,
11,
610,
1145,
5464,
2097,
21128,
610,
5163,
284,
2290,
11,
4724,
4412,
25,
4290,
6221,
11,
1948,
4803,
50792,
5595,
8634,
25,
528,
284,
220,
19,
11,
2778,
37335,
25,
6587,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
1128,
3078,
1697,
12289,
7379,
838,
19368,
198,
19368,
369,
52067,
449,
264,
4724,
4729,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
52444,
11,
1005,
27777,
4619,
627,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
15669,
1160,
315,
4927,
25050,
320,
269,
4927,
6783,
570,
37090,
311,
2290,
627,
7646,
25050,
527,
2663,
6957,
279,
48608,
315,
264,
1650,
311,
264,
8957,
345,
40389,
449,
389,
31683,
5011,
11,
13696,
449,
389,
31683,
6345,
477,
389,
31683,
4188,
627,
4959,
2587,
8957,
649,
46624,
1650,
5217,
4927,
5528,
11,
1518,
23499,
27437,
198,
2000,
2539,
3649,
627,
913,
16343,
50792,
31683,
25,
5464,
82214,
28242,
19368,
510,
8327,
60,
55609,
198,
913,
636,
36153,
20389,
25,
12536,
58,
41510,
15873,
61817,
95683,
4283,
1145,
610,
5163,
284,
2290,
55609,
198,
5715,
279,
2592,
9477,
627,
913,
5044,
25,
12536,
58,
4066,
10869,
60,
284,
2290,
55609,
198,
15669,
5044,
1665,
13,
37090,
311,
2290,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
5ea8c0fbf14e-1 | Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param output_key: str = 'answer'¶
param question_generator: LLMChain [Required]¶
param return_generated_question: bool = False¶
param return_source_documents: bool = False¶
param search_kwargs: dict [Optional]¶
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param top_k_docs_for_context: int = 4¶
param vectorstore: VectorStore [Required]¶
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be | [
15669,
5044,
1665,
13,
37090,
311,
2290,
627,
10869,
374,
264,
538,
430,
5334,
2663,
520,
279,
1212,
198,
438,
520,
279,
842,
315,
1475,
8957,
13,
2468,
279,
1212,
11,
5044,
21577,
7482,
323,
16609,
198,
49818,
3235,
304,
279,
8957,
13,
2468,
279,
842,
11,
433,
27024,
904,
6052,
7482,
627,
3947,
527,
1690,
2204,
4595,
315,
5044,
482,
4587,
1518,
5044,
27437,
198,
2000,
279,
2539,
16808,
627,
913,
2612,
3173,
25,
610,
284,
364,
9399,
6,
55609,
198,
913,
3488,
26898,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
471,
68413,
30015,
25,
1845,
284,
3641,
55609,
198,
913,
471,
10561,
77027,
25,
1845,
284,
3641,
55609,
198,
913,
2778,
37335,
25,
6587,
510,
15669,
60,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
15669,
1160,
315,
9681,
5938,
449,
279,
8957,
13,
37090,
311,
2290,
198,
9673,
9681,
690,
387,
5938,
449,
1855,
1650,
311,
420,
8957,
345,
438,
5946,
439,
6105,
311,
279,
25050,
4613,
304,
27777,
627,
2675,
649,
1005,
1521,
311,
8866,
10765,
264,
3230,
2937,
315,
264,
8957,
449,
1202,
1005,
1162,
627,
913,
1948,
4803,
50792,
5595,
8634,
25,
528,
284,
220,
19,
55609,
198,
913,
4724,
4412,
25,
4290,
6221,
510,
8327,
60,
55609,
198,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
477,
539,
1629,
304,
14008,
3941,
13,
763,
14008,
3941,
11,
1063,
29539,
18929,
198,
14724,
387,
17124,
311,
279,
2393,
13,
37090,
311,
8859,
8995,
45749,
907,
627,
565,
6797,
3889,
25986,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
5ea8c0fbf14e-2 | response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out. | [
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
7847,
1645,
543,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2997,
14334,
3186,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
5884,
60,
55609,
198,
6869,
279,
12496,
315,
420,
8957,
323,
923,
311,
2612,
422,
12974,
627,
9905,
198,
25986,
1389,
10685,
315,
11374,
11,
477,
3254,
1988,
422,
8957,
25283,
198,
3323,
832,
1719,
627,
693,
18917,
36289,
1389,
2777,
369,
3508,
311,
471,
1193,
16674,
304,
279,
198,
2376,
13,
1442,
3082,
11,
1193,
502,
7039,
8066,
555,
420,
8957,
690,
387,
198,
78691,
13,
1442,
3641,
11,
2225,
1988,
7039,
323,
502,
7039,
8066,
555,
420,
198,
8995,
690,
387,
6052,
13,
37090,
311,
3641,
627,
69411,
1389,
23499,
82,
311,
1005,
369,
420,
8957,
1629,
13,
1442,
539,
3984,
11,
690,
198,
817,
279,
27777,
3984,
311,
279,
8957,
627,
1012,
14334,
3186,
1389,
13440,
311,
2997,
1629,
3630,
304,
279,
2077,
13,
37090,
198,
998,
3641,
627,
10492,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
8,
11651,
1796,
58,
13755,
17752,
11,
610,
5163,
55609,
198,
7368,
279,
8957,
389,
682,
11374,
304,
279,
1160,
627,
7847,
802,
359,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
5ea8c0fbf14e-3 | Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, vectorstore: VectorStore, condense_question_prompt: BasePromptTemplate = PromptTemplate(input_variables=['chat_history', 'question'], output_parser=None, partial_variables={}, template='Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language.\n\nChat History:\n{chat_history}\nFollow Up Input: {question}\nStandalone question:', template_format='f-string', validate_template=True), chain_type: str = 'stuff', combine_docs_chain_kwargs: Optional[Dict] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → BaseConversationalRetrievalChain[source]¶
Load chain from LLM.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields[source]¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python | [
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
8957,
627,
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
4724,
4412,
25,
4290,
6221,
11,
9955,
1137,
30015,
62521,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
9884,
20389,
518,
364,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
22818,
279,
2768,
10652,
323,
264,
1833,
709,
3488,
11,
312,
28810,
279,
1833,
709,
3488,
311,
387,
264,
44488,
3488,
11,
304,
1202,
4113,
4221,
7255,
77,
1734,
16047,
11346,
7338,
77,
90,
9884,
20389,
11281,
77,
12763,
3216,
5688,
25,
314,
7998,
11281,
77,
626,
85212,
3488,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
8957,
1857,
25,
610,
284,
364,
58404,
518,
16343,
50792,
31683,
37335,
25,
12536,
58,
13755,
60,
284,
2290,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
1128,
3078,
1697,
12289,
7379,
838,
19368,
76747,
60,
55609,
198,
6003,
8957,
505,
445,
11237,
627,
72874,
29657,
35099,
25,
9323,
58,
13755,
17752,
11,
5884,
1145,
5884,
2526,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
11374,
627,
72874,
36289,
35099,
25,
30226,
17752,
11,
610,
1145,
16674,
25,
30226,
17752,
11,
610,
1145,
471,
18917,
36289,
25,
1845,
284,
3641,
8,
11651,
30226,
17752,
11,
610,
60,
55609,
198,
18409,
323,
22033,
16674,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6236,
4163,
2164,
25,
5884,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
6869,
279,
8957,
439,
1495,
304,
11,
1495,
704,
477,
5361,
7482,
11,
1495,
704,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
8957,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
8957,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
5ea8c0fbf14e-4 | Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property input_keys: List[str]¶
Input keys.
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
Configuration for this pydantic object.
allow_population_by_field_name = True¶
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
13617,
512,
497,
2082,
9612,
487,
10344,
198,
8995,
5799,
4971,
2703,
45221,
2398,
14,
8995,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
627,
2028,
6276,
3932,
311,
1522,
304,
2290,
439,
14008,
311,
2680,
279,
3728,
6376,
627,
998,
9643,
368,
11651,
9323,
58,
78621,
13591,
11,
92572,
2688,
18804,
60,
55609,
198,
998,
9643,
8072,
18377,
14565,
368,
11651,
92572,
2688,
18804,
55609,
198,
3784,
1988,
12919,
25,
1796,
17752,
60,
55609,
198,
2566,
7039,
627,
3784,
37313,
18741,
25,
30226,
55609,
198,
5715,
264,
1160,
315,
7180,
5144,
430,
1288,
387,
5343,
304,
279,
198,
76377,
16901,
13,
4314,
8365,
2011,
387,
11928,
555,
279,
198,
22602,
627,
3784,
37313,
42671,
25,
1796,
17752,
60,
55609,
198,
5715,
279,
4573,
315,
279,
8859,
8995,
1665,
627,
797,
13,
510,
2118,
5317,
8995,
9520,
1054,
657,
1026,
9520,
1054,
2569,
2192,
863,
933,
3784,
37313,
3537,
53810,
25,
30226,
17752,
11,
610,
60,
55609,
198,
5715,
264,
2472,
315,
4797,
5811,
5144,
311,
6367,
14483,
627,
797,
13,
314,
2118,
2569,
2192,
11959,
3173,
57633,
1054,
32033,
15836,
11669,
6738,
863,
534,
3784,
37313,
26684,
8499,
25,
1845,
55609,
198,
5715,
3508,
477,
539,
279,
538,
374,
6275,
8499,
627,
2590,
5649,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
7331,
75672,
3795,
5121,
1292,
284,
3082,
55609,
198,
277,
88951,
9962,
43255,
284,
3082,
55609,
198,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
9ea9b22391a2-0 | langchain.client.runner_utils.run_on_dataset¶
langchain.client.runner_utils.run_on_dataset(dataset_name: str, llm_or_chain_factory: Union[Callable[[], Chain], BaseLanguageModel], *, num_repetitions: int = 1, project_name: Optional[str] = None, verbose: bool = False, client: Optional[LangChainPlusClient] = None, tags: Optional[List[str]] = None, run_evaluators: Optional[Sequence[RunEvaluator]] = None, input_mapper: Optional[Callable[[Dict], Any]] = None) → Dict[str, Any][source]¶
Run the Chain or language model on a dataset and store traces
to the specified project name.
Parameters
dataset_name – Name of the dataset to run the chain on.
llm_or_chain_factory – Language model or Chain constructor to run
over the dataset. The Chain constructor is used to permit
independent calls on each example without carrying over state.
concurrency_level – Number of async workers to run in parallel.
num_repetitions – Number of times to run the model on each example.
This is useful when testing success rates or generating confidence
intervals.
project_name – Name of the project to store the traces in.
Defaults to {dataset_name}-{chain class name}-{datetime}.
verbose – Whether to print progress.
client – Client to use to access the dataset. If None, a new client
will be created using the credentials in the environment.
tags – Tags to add to each run in the project.
run_evaluators – Evaluators to run on the results of the chain.
input_mapper – A function to map to the inputs dictionary from an Example
to the format expected by the model to be evaluated. This is useful if
your model needs to deserialize more complex schema or if your dataset
has inputs with keys that differ from what is expected by your chain | [
5317,
8995,
6718,
42328,
17758,
7789,
4570,
19536,
55609,
198,
5317,
8995,
6718,
42328,
17758,
7789,
4570,
19536,
31635,
1292,
25,
610,
11,
9507,
76,
8908,
31683,
25255,
25,
9323,
58,
41510,
58,
13292,
29625,
1145,
5464,
14126,
1747,
1145,
12039,
1661,
1311,
7005,
6055,
25,
528,
284,
220,
16,
11,
2447,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
14008,
25,
1845,
284,
3641,
11,
3016,
25,
12536,
58,
27317,
19368,
22560,
3032,
60,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
1629,
22001,
84,
3046,
25,
12536,
58,
14405,
58,
6869,
90142,
5163,
284,
2290,
11,
1988,
77764,
25,
12536,
58,
41510,
15873,
13755,
1145,
5884,
5163,
284,
2290,
8,
11651,
30226,
17752,
11,
5884,
1483,
2484,
60,
55609,
198,
6869,
279,
29625,
477,
4221,
1646,
389,
264,
10550,
323,
3637,
35483,
198,
998,
279,
5300,
2447,
836,
627,
9905,
198,
22090,
1292,
1389,
4076,
315,
279,
10550,
311,
1629,
279,
8957,
389,
627,
657,
76,
8908,
31683,
25255,
1389,
11688,
1646,
477,
29625,
4797,
311,
1629,
198,
2017,
279,
10550,
13,
578,
29625,
4797,
374,
1511,
311,
11810,
198,
258,
38655,
6880,
389,
1855,
3187,
2085,
15691,
927,
1614,
627,
444,
16353,
8438,
1389,
5742,
315,
3393,
7487,
311,
1629,
304,
15638,
627,
2470,
1311,
7005,
6055,
1389,
5742,
315,
3115,
311,
1629,
279,
1646,
389,
1855,
3187,
627,
2028,
374,
5505,
994,
7649,
2450,
7969,
477,
24038,
12410,
198,
396,
43298,
627,
5094,
1292,
1389,
4076,
315,
279,
2447,
311,
3637,
279,
35483,
304,
627,
16672,
311,
314,
22090,
1292,
73113,
8995,
538,
836,
73113,
15814,
28374,
15228,
1389,
13440,
311,
1194,
5208,
627,
3045,
1389,
8589,
311,
1005,
311,
2680,
279,
10550,
13,
1442,
2290,
11,
264,
502,
3016,
198,
14724,
387,
3549,
1701,
279,
16792,
304,
279,
4676,
627,
14412,
1389,
28783,
311,
923,
311,
1855,
1629,
304,
279,
2447,
627,
6236,
22001,
84,
3046,
1389,
76198,
3046,
311,
1629,
389,
279,
3135,
315,
279,
8957,
627,
1379,
77764,
1389,
362,
734,
311,
2472,
311,
279,
11374,
11240,
505,
459,
13688,
198,
998,
279,
3645,
3685,
555,
279,
1646,
311,
387,
26126,
13,
1115,
374,
5505,
422,
198,
22479,
1646,
3966,
311,
36340,
810,
6485,
11036,
477,
422,
701,
10550,
198,
4752,
11374,
449,
7039,
430,
1782,
505,
1148,
374,
3685,
555,
701,
8957
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_on_dataset.html |
9ea9b22391a2-1 | has inputs with keys that differ from what is expected by your chain
or agent.
Returns
A dictionary containing the run’s project name and the resulting model outputs. | [
4752,
11374,
449,
7039,
430,
1782,
505,
1148,
374,
3685,
555,
701,
8957,
198,
269,
8479,
627,
16851,
198,
32,
11240,
8649,
279,
1629,
753,
2447,
836,
323,
279,
13239,
1646,
16674,
13
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_on_dataset.html |
5612462dd545-0 | langchain.client.runner_utils.run_llm¶
langchain.client.runner_utils.run_llm(llm: BaseLanguageModel, inputs: Dict[str, Any], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]], *, tags: Optional[List[str]] = None, input_mapper: Optional[Callable[[Dict], Any]] = None) → Union[LLMResult, ChatResult][source]¶
Run the language model on the example.
Parameters
llm – The language model to run.
inputs – The input dictionary.
callbacks – The callbacks to use during the run.
tags – Optional tags to add to the run.
input_mapper – function to map to the inputs dictionary from an Example
Returns
The LLMResult or ChatResult.
Raises
ValueError – If the LLM type is unsupported.
InputFormatError – If the input format is invalid. | [
5317,
8995,
6718,
42328,
17758,
7789,
44095,
76,
55609,
198,
5317,
8995,
6718,
42328,
17758,
7789,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
11374,
25,
30226,
17752,
11,
5884,
1145,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
21128,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
1988,
77764,
25,
12536,
58,
41510,
15873,
13755,
1145,
5884,
5163,
284,
2290,
8,
11651,
9323,
58,
4178,
44,
2122,
11,
13149,
2122,
1483,
2484,
60,
55609,
198,
6869,
279,
4221,
1646,
389,
279,
3187,
627,
9905,
198,
657,
76,
1389,
578,
4221,
1646,
311,
1629,
627,
25986,
1389,
578,
1988,
11240,
627,
69411,
1389,
578,
27777,
311,
1005,
2391,
279,
1629,
627,
14412,
1389,
12536,
9681,
311,
923,
311,
279,
1629,
627,
1379,
77764,
1389,
734,
311,
2472,
311,
279,
11374,
11240,
505,
459,
13688,
198,
16851,
198,
791,
445,
11237,
2122,
477,
13149,
2122,
627,
36120,
198,
1150,
1480,
1389,
1442,
279,
445,
11237,
955,
374,
41509,
627,
2566,
4152,
1480,
1389,
1442,
279,
1988,
3645,
374,
8482,
13
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_llm.html |
9cdfacbccf5d-0 | langchain.client.runner_utils.run_llm_or_chain¶
langchain.client.runner_utils.run_llm_or_chain(example: Example, llm_or_chain_factory: Union[Callable[[], Chain], BaseLanguageModel], n_repetitions: int, *, tags: Optional[List[str]] = None, callbacks: Optional[List[BaseCallbackHandler]] = None, input_mapper: Optional[Callable[[Dict], Any]] = None) → Union[List[dict], List[str], List[LLMResult], List[ChatResult]][source]¶
Run the Chain or language model synchronously.
Parameters
example – The example to run.
llm_or_chain_factory – The Chain or language model constructor to run.
n_repetitions – The number of times to run the model on each example.
tags – Optional tags to add to the run.
callbacks – Optional callbacks to use during the run.
Returns
A list of outputs. | [
5317,
8995,
6718,
42328,
17758,
7789,
44095,
76,
8908,
31683,
55609,
198,
5317,
8995,
6718,
42328,
17758,
7789,
44095,
76,
8908,
31683,
67303,
25,
13688,
11,
9507,
76,
8908,
31683,
25255,
25,
9323,
58,
41510,
58,
13292,
29625,
1145,
5464,
14126,
1747,
1145,
308,
1311,
7005,
6055,
25,
528,
11,
12039,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
27777,
25,
12536,
53094,
58,
4066,
7646,
3126,
5163,
284,
2290,
11,
1988,
77764,
25,
12536,
58,
41510,
15873,
13755,
1145,
5884,
5163,
284,
2290,
8,
11651,
9323,
53094,
58,
8644,
1145,
1796,
17752,
1145,
1796,
58,
4178,
44,
2122,
1145,
1796,
58,
16047,
2122,
28819,
2484,
60,
55609,
198,
6869,
279,
29625,
477,
4221,
1646,
14453,
7162,
627,
9905,
198,
8858,
1389,
578,
3187,
311,
1629,
627,
657,
76,
8908,
31683,
25255,
1389,
578,
29625,
477,
4221,
1646,
4797,
311,
1629,
627,
77,
1311,
7005,
6055,
1389,
578,
1396,
315,
3115,
311,
1629,
279,
1646,
389,
1855,
3187,
627,
14412,
1389,
12536,
9681,
311,
923,
311,
279,
1629,
627,
69411,
1389,
12536,
27777,
311,
1005,
2391,
279,
1629,
627,
16851,
198,
32,
1160,
315,
16674,
13
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_llm_or_chain.html |
489af4c02858-0 | langchain.client.runner_utils.InputFormatError¶
class langchain.client.runner_utils.InputFormatError[source]¶
Bases: Exception
Raised when the input format is invalid.
add_note()¶
Exception.add_note(note) –
add a note to the exception
with_traceback()¶
Exception.with_traceback(tb) –
set self.__traceback__ to tb and return self.
args¶ | [
5317,
8995,
6718,
42328,
17758,
16521,
4152,
1480,
55609,
198,
1058,
8859,
8995,
6718,
42328,
17758,
16521,
4152,
1480,
76747,
60,
55609,
198,
33,
2315,
25,
4204,
198,
96014,
994,
279,
1988,
3645,
374,
8482,
627,
723,
28306,
368,
55609,
198,
1378,
1388,
28306,
45151,
8,
1389,
198,
723,
264,
5296,
311,
279,
4788,
198,
4291,
24489,
1445,
368,
55609,
198,
1378,
18662,
24489,
1445,
62514,
8,
1389,
198,
751,
659,
4952,
15417,
1445,
565,
311,
16767,
323,
471,
659,
627,
2164,
55609
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.InputFormatError.html |
491e941042de-0 | langchain.client.runner_utils.run_on_examples¶
langchain.client.runner_utils.run_on_examples(examples: Iterator[Example], llm_or_chain_factory: Union[Callable[[], Chain], BaseLanguageModel], *, num_repetitions: int = 1, project_name: Optional[str] = None, verbose: bool = False, client: Optional[LangChainPlusClient] = None, tags: Optional[List[str]] = None, run_evaluators: Optional[Sequence[RunEvaluator]] = None, input_mapper: Optional[Callable[[Dict], Any]] = None) → Dict[str, Any][source]¶
Run the Chain or language model on examples and store
traces to the specified project name.
Parameters
examples – Examples to run the model or chain over.
llm_or_chain_factory – Language model or Chain constructor to run
over the dataset. The Chain constructor is used to permit
independent calls on each example without carrying over state.
num_repetitions – Number of times to run the model on each example.
This is useful when testing success rates or generating confidence
intervals.
project_name – Name of the project to store the traces in.
Defaults to {dataset_name}-{chain class name}-{datetime}.
verbose – Whether to print progress.
client – Client to use to access the dataset. If None, a new client
will be created using the credentials in the environment.
tags – Tags to add to each run in the project.
run_evaluators – Evaluators to run on the results of the chain.
input_mapper – A function to map to the inputs dictionary from an Example
to the format expected by the model to be evaluated. This is useful if
your model needs to deserialize more complex schema or if your dataset
has inputs with keys that differ from what is expected by your chain
or agent.
Returns | [
5317,
8995,
6718,
42328,
17758,
7789,
4570,
46379,
55609,
198,
5317,
8995,
6718,
42328,
17758,
7789,
4570,
46379,
5580,
4112,
25,
23887,
58,
13617,
1145,
9507,
76,
8908,
31683,
25255,
25,
9323,
58,
41510,
58,
13292,
29625,
1145,
5464,
14126,
1747,
1145,
12039,
1661,
1311,
7005,
6055,
25,
528,
284,
220,
16,
11,
2447,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
14008,
25,
1845,
284,
3641,
11,
3016,
25,
12536,
58,
27317,
19368,
22560,
3032,
60,
284,
2290,
11,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
1629,
22001,
84,
3046,
25,
12536,
58,
14405,
58,
6869,
90142,
5163,
284,
2290,
11,
1988,
77764,
25,
12536,
58,
41510,
15873,
13755,
1145,
5884,
5163,
284,
2290,
8,
11651,
30226,
17752,
11,
5884,
1483,
2484,
60,
55609,
198,
6869,
279,
29625,
477,
4221,
1646,
389,
10507,
323,
3637,
198,
376,
2492,
311,
279,
5300,
2447,
836,
627,
9905,
198,
52768,
1389,
26379,
311,
1629,
279,
1646,
477,
8957,
927,
627,
657,
76,
8908,
31683,
25255,
1389,
11688,
1646,
477,
29625,
4797,
311,
1629,
198,
2017,
279,
10550,
13,
578,
29625,
4797,
374,
1511,
311,
11810,
198,
258,
38655,
6880,
389,
1855,
3187,
2085,
15691,
927,
1614,
627,
2470,
1311,
7005,
6055,
1389,
5742,
315,
3115,
311,
1629,
279,
1646,
389,
1855,
3187,
627,
2028,
374,
5505,
994,
7649,
2450,
7969,
477,
24038,
12410,
198,
396,
43298,
627,
5094,
1292,
1389,
4076,
315,
279,
2447,
311,
3637,
279,
35483,
304,
627,
16672,
311,
314,
22090,
1292,
73113,
8995,
538,
836,
73113,
15814,
28374,
15228,
1389,
13440,
311,
1194,
5208,
627,
3045,
1389,
8589,
311,
1005,
311,
2680,
279,
10550,
13,
1442,
2290,
11,
264,
502,
3016,
198,
14724,
387,
3549,
1701,
279,
16792,
304,
279,
4676,
627,
14412,
1389,
28783,
311,
923,
311,
1855,
1629,
304,
279,
2447,
627,
6236,
22001,
84,
3046,
1389,
76198,
3046,
311,
1629,
389,
279,
3135,
315,
279,
8957,
627,
1379,
77764,
1389,
362,
734,
311,
2472,
311,
279,
11374,
11240,
505,
459,
13688,
198,
998,
279,
3645,
3685,
555,
279,
1646,
311,
387,
26126,
13,
1115,
374,
5505,
422,
198,
22479,
1646,
3966,
311,
36340,
810,
6485,
11036,
477,
422,
701,
10550,
198,
4752,
11374,
449,
7039,
430,
1782,
505,
1148,
374,
3685,
555,
701,
8957,
198,
269,
8479,
627,
16851
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_on_examples.html |
491e941042de-1 | has inputs with keys that differ from what is expected by your chain
or agent.
Returns
A dictionary mapping example ids to the model outputs. | [
4752,
11374,
449,
7039,
430,
1782,
505,
1148,
374,
3685,
555,
701,
8957,
198,
269,
8479,
627,
16851,
198,
32,
11240,
13021,
3187,
14483,
311,
279,
1646,
16674,
13
] | https://langchain.readthedocs.io/en/latest/client/langchain.client.runner_utils.run_on_examples.html |
4889591e3728-0 | langchain.indexes.vectorstore.VectorstoreIndexCreator¶
class langchain.indexes.vectorstore.VectorstoreIndexCreator(*, vectorstore_cls: ~typing.Type[~langchain.vectorstores.base.VectorStore] = <class 'langchain.vectorstores.chroma.Chroma'>, embedding: ~langchain.embeddings.base.Embeddings = None, text_splitter: ~langchain.text_splitter.TextSplitter = None, vectorstore_kwargs: dict = None)[source]¶
Bases: BaseModel
Logic for creating indexes.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param embedding: langchain.embeddings.base.Embeddings [Optional]¶
param text_splitter: langchain.text_splitter.TextSplitter [Optional]¶
param vectorstore_cls: Type[langchain.vectorstores.base.VectorStore] = <class 'langchain.vectorstores.chroma.Chroma'>¶
param vectorstore_kwargs: dict [Optional]¶
from_documents(documents: List[Document]) → VectorStoreIndexWrapper[source]¶
Create a vectorstore index from documents.
from_loaders(loaders: List[BaseLoader]) → VectorStoreIndexWrapper[source]¶
Create a vectorstore index from loaders.
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
5317,
8995,
5265,
288,
48203,
4412,
14621,
4412,
1581,
32965,
55609,
198,
1058,
8859,
8995,
5265,
288,
48203,
4412,
14621,
4412,
1581,
32965,
4163,
11,
4724,
4412,
39756,
25,
4056,
90902,
10394,
58,
93,
5317,
8995,
48203,
44569,
9105,
14621,
6221,
60,
284,
366,
1058,
364,
5317,
8995,
48203,
44569,
5442,
58084,
6487,
58084,
6404,
11,
40188,
25,
4056,
5317,
8995,
41541,
25624,
9105,
58955,
25624,
284,
2290,
11,
1495,
17489,
466,
25,
4056,
5317,
8995,
2858,
17489,
466,
2021,
20805,
466,
284,
2290,
11,
4724,
4412,
37335,
25,
6587,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
65705,
198,
27849,
369,
6968,
25998,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
40188,
25,
8859,
8995,
41541,
25624,
9105,
58955,
25624,
510,
15669,
60,
55609,
198,
913,
1495,
17489,
466,
25,
8859,
8995,
2858,
17489,
466,
2021,
20805,
466,
510,
15669,
60,
55609,
198,
913,
4724,
4412,
39756,
25,
4078,
58,
5317,
8995,
48203,
44569,
9105,
14621,
6221,
60,
284,
366,
1058,
364,
5317,
8995,
48203,
44569,
5442,
58084,
6487,
58084,
6404,
55609,
198,
913,
4724,
4412,
37335,
25,
6587,
510,
15669,
60,
55609,
198,
1527,
77027,
19702,
2901,
25,
1796,
58,
7676,
2526,
11651,
4290,
6221,
1581,
11803,
76747,
60,
55609,
198,
4110,
264,
4724,
4412,
1963,
505,
9477,
627,
1527,
12693,
388,
50192,
388,
25,
1796,
58,
4066,
9360,
2526,
11651,
4290,
6221,
1581,
11803,
76747,
60,
55609,
198,
4110,
264,
4724,
4412,
1963,
505,
69674,
627,
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609,
198,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/indexes/langchain.indexes.vectorstore.VectorstoreIndexCreator.html |
d019cf9811fd-0 | langchain.indexes.graph.GraphIndexCreator¶
class langchain.indexes.graph.GraphIndexCreator(*, llm: ~typing.Optional[~langchain.base_language.BaseLanguageModel] = None, graph_type: ~typing.Type[~langchain.graphs.networkx_graph.NetworkxEntityGraph] = <class 'langchain.graphs.networkx_graph.NetworkxEntityGraph'>)[source]¶
Bases: BaseModel
Functionality to create graph index.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param graph_type: Type[langchain.graphs.networkx_graph.NetworkxEntityGraph] = <class 'langchain.graphs.networkx_graph.NetworkxEntityGraph'>¶
param llm: Optional[langchain.base_language.BaseLanguageModel] = None¶
async afrom_text(text: str) → NetworkxEntityGraph[source]¶
Create graph index from text asynchronously.
from_text(text: str) → NetworkxEntityGraph[source]¶
Create graph index from text. | [
5317,
8995,
5265,
288,
10996,
41337,
1581,
32965,
55609,
198,
1058,
8859,
8995,
5265,
288,
10996,
41337,
1581,
32965,
4163,
11,
9507,
76,
25,
4056,
90902,
37464,
58,
93,
5317,
8995,
9105,
30121,
13316,
14126,
1747,
60,
284,
2290,
11,
4876,
1857,
25,
4056,
90902,
10394,
58,
93,
5317,
8995,
10996,
82,
21216,
87,
15080,
31249,
87,
3106,
11461,
60,
284,
366,
1058,
364,
5317,
8995,
10996,
82,
21216,
87,
15080,
31249,
87,
3106,
11461,
6404,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
65705,
198,
5263,
2786,
311,
1893,
4876,
1963,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4876,
1857,
25,
4078,
58,
5317,
8995,
10996,
82,
21216,
87,
15080,
31249,
87,
3106,
11461,
60,
284,
366,
1058,
364,
5317,
8995,
10996,
82,
21216,
87,
15080,
31249,
87,
3106,
11461,
6404,
55609,
198,
913,
9507,
76,
25,
12536,
58,
5317,
8995,
9105,
30121,
13316,
14126,
1747,
60,
284,
2290,
55609,
198,
7847,
264,
1527,
4424,
7383,
25,
610,
8,
11651,
8304,
87,
3106,
11461,
76747,
60,
55609,
198,
4110,
4876,
1963,
505,
1495,
68881,
627,
1527,
4424,
7383,
25,
610,
8,
11651,
8304,
87,
3106,
11461,
76747,
60,
55609,
198,
4110,
4876,
1963,
505,
1495,
13
] | https://langchain.readthedocs.io/en/latest/indexes/langchain.indexes.graph.GraphIndexCreator.html |
26946e447c22-0 | langchain.indexes.vectorstore.VectorStoreIndexWrapper¶
class langchain.indexes.vectorstore.VectorStoreIndexWrapper(*, vectorstore: VectorStore)[source]¶
Bases: BaseModel
Wrapper around a vectorstore for easy access.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param vectorstore: langchain.vectorstores.base.VectorStore [Required]¶
query(question: str, llm: Optional[BaseLanguageModel] = None, **kwargs: Any) → str[source]¶
Query the vectorstore.
query_with_sources(question: str, llm: Optional[BaseLanguageModel] = None, **kwargs: Any) → dict[source]¶
Query the vectorstore and get back sources.
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
5317,
8995,
5265,
288,
48203,
4412,
14621,
6221,
1581,
11803,
55609,
198,
1058,
8859,
8995,
5265,
288,
48203,
4412,
14621,
6221,
1581,
11803,
4163,
11,
4724,
4412,
25,
4290,
6221,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
65705,
198,
11803,
2212,
264,
4724,
4412,
369,
4228,
2680,
627,
4110,
264,
502,
1646,
555,
23115,
323,
69772,
1988,
828,
505,
16570,
6105,
627,
36120,
54129,
422,
279,
1988,
828,
4250,
387,
16051,
311,
1376,
264,
2764,
1646,
627,
913,
4724,
4412,
25,
8859,
8995,
48203,
44569,
9105,
14621,
6221,
510,
8327,
60,
55609,
198,
1663,
41157,
25,
610,
11,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
76747,
60,
55609,
198,
2929,
279,
4724,
4412,
627,
1663,
6753,
53996,
41157,
25,
610,
11,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
6587,
76747,
60,
55609,
198,
2929,
279,
4724,
4412,
323,
636,
1203,
8336,
627,
2590,
5649,
76747,
60,
55609,
198,
33,
2315,
25,
1665,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
277,
88951,
9962,
43255,
284,
3082,
55609,
198,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/indexes/langchain.indexes.vectorstore.VectorStoreIndexWrapper.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.