id
stringlengths 14
15
| text
stringlengths 35
2.07k
| embedding
sequence | source
stringlengths 61
154
|
---|---|---|---|
3b5b0ea9f568-3 | Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Take in a list of prompt values and return an LLMResult.
get_num_tokens(text: str) → int[source]¶
Calculate number of tokens.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the message.
get_token_ids(text: str) → List[int]¶
Get the token present in the text.
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Predict text from text.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Predict message from messages.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
validator raise_warning » all fields[source]¶
Raise warning that this class is deprecated.
save(file_path: Union[Path, str]) → None¶
Save the LLM.
Parameters
file_path – Path to file to save the LLM to.
Example:
.. code-block:: python
llm.save(file_path=”path/llm.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.
stream(prompt: str, stop: Optional[List[str]] = None) → Generator[source]¶
Call Anthropic completion_stream and return the resulting generator.
BETA: this is a beta feature while we figure out the right abstraction. | [
6869,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
19927,
62521,
84432,
13044,
25,
1796,
43447,
15091,
1150,
1145,
3009,
25,
12536,
53094,
17752,
5163,
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,
445,
11237,
2122,
55609,
198,
18293,
304,
264,
1160,
315,
10137,
2819,
323,
471,
459,
445,
11237,
2122,
627,
456,
4369,
29938,
7383,
25,
610,
8,
11651,
528,
76747,
60,
55609,
198,
48966,
1396,
315,
11460,
627,
456,
4369,
29938,
5791,
24321,
56805,
25,
1796,
58,
4066,
2097,
2526,
11651,
528,
55609,
198,
1991,
279,
1396,
315,
11460,
304,
279,
1984,
627,
456,
6594,
8237,
7383,
25,
610,
8,
11651,
1796,
19155,
60,
55609,
198,
1991,
279,
4037,
3118,
304,
279,
1495,
627,
35798,
7383,
25,
610,
11,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
54644,
1495,
505,
1495,
627,
35798,
24321,
56805,
25,
1796,
58,
4066,
2097,
1145,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
2097,
55609,
198,
54644,
1984,
505,
6743,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
16503,
4933,
39495,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
94201,
10163,
430,
420,
538,
374,
32690,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
445,
11237,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
445,
11237,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
657,
76,
5799,
4971,
2703,
45221,
2398,
14,
657,
76,
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,
4116,
73353,
25,
610,
11,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
8,
11651,
29458,
76747,
60,
55609,
198,
7368,
16989,
45036,
9954,
12962,
323,
471,
279,
13239,
14143,
627,
33,
21352,
25,
420,
374,
264,
13746,
4668,
1418,
584,
7216,
704,
279,
1314,
59851,
13
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.anthropic.Anthropic.html |
3b5b0ea9f568-4 | BETA: this is a beta feature while we figure out the right abstraction.
Once that happens, this interface could change.
Parameters
prompt – The prompt to pass into the model.
stop – Optional list of stop words to use when generating.
Returns
A generator representing the stream of tokens from Anthropic.
Example
prompt = "Write a poem about a stream."
prompt = f"\n\nHuman: {prompt}\n\nAssistant:"
generator = anthropic.stream(prompt)
for token in generator:
yield token
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
validator validate_environment » all fields¶
Validate that api key and python package exists in environment.
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¶ | [
33,
21352,
25,
420,
374,
264,
13746,
4668,
1418,
584,
7216,
704,
279,
1314,
59851,
627,
12805,
430,
8741,
11,
420,
3834,
1436,
2349,
627,
9905,
198,
41681,
1389,
578,
10137,
311,
1522,
1139,
279,
1646,
627,
9684,
1389,
12536,
1160,
315,
3009,
4339,
311,
1005,
994,
24038,
627,
16851,
198,
32,
14143,
14393,
279,
4365,
315,
11460,
505,
16989,
45036,
627,
13617,
198,
41681,
284,
330,
8144,
264,
33894,
922,
264,
4365,
10246,
41681,
284,
282,
12200,
77,
1734,
35075,
25,
314,
41681,
11281,
77,
1734,
72803,
35400,
36951,
284,
41416,
292,
15307,
73353,
340,
2000,
4037,
304,
14143,
512,
262,
7692,
4037,
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,
16503,
9788,
52874,
4194,
8345,
4194,
682,
5151,
55609,
198,
18409,
430,
6464,
1401,
323,
10344,
6462,
6866,
304,
4676,
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,
277,
88951,
9962,
43255,
284,
3082,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.anthropic.Anthropic.html |
9bdca0347dbd-0 | langchain.llms.clarifai.Clarifai¶
class langchain.llms.clarifai.Clarifai(*, cache: Optional[bool] = None, verbose: bool = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, tags: Optional[List[str]] = None, stub: Any = None, metadata: Any = None, userDataObject: Any = None, model_id: Optional[str] = None, model_version_id: Optional[str] = None, app_id: Optional[str] = None, user_id: Optional[str] = None, clarifai_pat_key: Optional[str] = None, api_base: str = 'https://api.clarifai.com', stop: Optional[List[str]] = None)[source]¶
Bases: LLM
Wrapper around Clarifai’s large language models.
To use, you should have an account on the Clarifai platform,
the clarifai python package installed, and the
environment variable CLARIFAI_PAT_KEY set with your PAT key,
or pass it as a named parameter to the constructor.
Example
from langchain.llms import Clarifai
clarifai_llm = Clarifai(clarifai_pat_key=CLARIFAI_PAT_KEY, user_id=USER_ID, app_id=APP_ID, model_id=MODEL_ID)
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 api_base: str = 'https://api.clarifai.com'¶
param app_id: Optional[str] = None¶
Clarifai application id to use.
param cache: Optional[bool] = None¶ | [
5317,
8995,
60098,
1026,
6894,
277,
333,
2192,
732,
14115,
333,
2192,
55609,
198,
1058,
8859,
8995,
60098,
1026,
6894,
277,
333,
2192,
732,
14115,
333,
2192,
4163,
11,
6636,
25,
12536,
58,
2707,
60,
284,
2290,
11,
14008,
25,
1845,
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,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
13947,
25,
5884,
284,
2290,
11,
11408,
25,
5884,
284,
2290,
11,
35485,
1211,
25,
5884,
284,
2290,
11,
1646,
851,
25,
12536,
17752,
60,
284,
2290,
11,
1646,
9625,
851,
25,
12536,
17752,
60,
284,
2290,
11,
917,
851,
25,
12536,
17752,
60,
284,
2290,
11,
1217,
851,
25,
12536,
17752,
60,
284,
2290,
11,
20064,
333,
2192,
56924,
3173,
25,
12536,
17752,
60,
284,
2290,
11,
6464,
7806,
25,
610,
284,
364,
2485,
1129,
2113,
6894,
277,
333,
2192,
916,
518,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
445,
11237,
198,
11803,
2212,
31181,
333,
2192,
753,
3544,
4221,
4211,
627,
1271,
1005,
11,
499,
1288,
617,
459,
2759,
389,
279,
31181,
333,
2192,
5452,
345,
1820,
20064,
333,
2192,
10344,
6462,
10487,
11,
323,
279,
198,
24175,
3977,
7121,
946,
2843,
15836,
1106,
835,
6738,
743,
449,
701,
45470,
1401,
345,
269,
1522,
433,
439,
264,
7086,
5852,
311,
279,
4797,
627,
13617,
198,
1527,
8859,
8995,
60098,
1026,
1179,
31181,
333,
2192,
198,
13115,
333,
2192,
44095,
76,
284,
31181,
333,
2192,
10050,
277,
333,
2192,
56924,
3173,
28,
3218,
946,
2843,
15836,
1106,
835,
6738,
11,
338,
1217,
851,
28,
6584,
3533,
11,
917,
851,
28,
15049,
3533,
11,
1646,
851,
28,
61537,
3533,
340,
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,
6464,
7806,
25,
610,
284,
364,
2485,
1129,
2113,
6894,
277,
333,
2192,
916,
6,
55609,
198,
913,
917,
851,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
100069,
333,
2192,
3851,
887,
311,
1005,
627,
913,
6636,
25,
12536,
58,
2707,
60,
284,
2290,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.clarifai.Clarifai.html |
9bdca0347dbd-1 | Clarifai application id to use.
param cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
param callbacks: Callbacks = None¶
param clarifai_pat_key: Optional[str] = None¶
param metadata: Any = None¶
param model_id: Optional[str] = None¶
Model id to use.
param model_version_id: Optional[str] = None¶
Model version id to use.
param stop: Optional[List[str]] = None¶
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param userDataObject: Any = None¶
param user_id: Optional[str] = None¶
Clarifai user id to use.
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → str¶
Check Cache and run the LLM on the given prompt and input.
async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → LLMResult¶
Run the LLM on the given prompt and input.
async agenerate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Take in a list of prompt values and return an LLMResult.
classmethod all_required_field_names() → Set¶ | [
100069,
333,
2192,
3851,
887,
311,
1005,
627,
913,
6636,
25,
12536,
58,
2707,
60,
284,
2290,
55609,
198,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
913,
20064,
333,
2192,
56924,
3173,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
913,
11408,
25,
5884,
284,
2290,
55609,
198,
913,
1646,
851,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
1747,
887,
311,
1005,
627,
913,
1646,
9625,
851,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
1747,
2373,
887,
311,
1005,
627,
913,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
16309,
311,
923,
311,
279,
1629,
11917,
627,
913,
35485,
1211,
25,
5884,
284,
2290,
55609,
198,
913,
1217,
851,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
100069,
333,
2192,
1217,
887,
311,
1005,
627,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
311,
1194,
704,
2077,
1495,
627,
565,
6797,
3889,
41681,
25,
610,
11,
3009,
25,
12536,
53094,
17752,
5163,
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,
610,
55609,
198,
4061,
20044,
323,
1629,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
7847,
945,
13523,
84432,
13044,
25,
1796,
17752,
1145,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
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,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
2122,
55609,
198,
6869,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
7847,
945,
13523,
62521,
84432,
13044,
25,
1796,
43447,
15091,
1150,
1145,
3009,
25,
12536,
53094,
17752,
5163,
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,
445,
11237,
2122,
55609,
198,
18293,
304,
264,
1160,
315,
10137,
2819,
323,
471,
459,
445,
11237,
2122,
627,
27853,
682,
19265,
5121,
9366,
368,
11651,
2638,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.clarifai.Clarifai.html |
9bdca0347dbd-2 | classmethod all_required_field_names() → Set¶
async apredict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Predict text from text.
async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Predict message from messages.
dict(**kwargs: Any) → Dict¶
Return a dictionary of the LLM.
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → LLMResult¶
Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Take in a list of prompt values and return an LLMResult.
get_num_tokens(text: str) → int¶
Get the number of tokens present in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the message.
get_token_ids(text: str) → List[int]¶
Get the token present in the text.
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Predict text from text.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Predict message from messages.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used. | [
27853,
682,
19265,
5121,
9366,
368,
11651,
2638,
55609,
198,
7847,
1469,
9037,
7383,
25,
610,
11,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
54644,
1495,
505,
1495,
627,
7847,
1469,
9037,
24321,
56805,
25,
1796,
58,
4066,
2097,
1145,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
2097,
55609,
198,
54644,
1984,
505,
6743,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
264,
11240,
315,
279,
445,
11237,
627,
19927,
84432,
13044,
25,
1796,
17752,
1145,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
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,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
2122,
55609,
198,
6869,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
19927,
62521,
84432,
13044,
25,
1796,
43447,
15091,
1150,
1145,
3009,
25,
12536,
53094,
17752,
5163,
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,
445,
11237,
2122,
55609,
198,
18293,
304,
264,
1160,
315,
10137,
2819,
323,
471,
459,
445,
11237,
2122,
627,
456,
4369,
29938,
7383,
25,
610,
8,
11651,
528,
55609,
198,
1991,
279,
1396,
315,
11460,
3118,
304,
279,
1495,
627,
456,
4369,
29938,
5791,
24321,
56805,
25,
1796,
58,
4066,
2097,
2526,
11651,
528,
55609,
198,
1991,
279,
1396,
315,
11460,
304,
279,
1984,
627,
456,
6594,
8237,
7383,
25,
610,
8,
11651,
1796,
19155,
60,
55609,
198,
1991,
279,
4037,
3118,
304,
279,
1495,
627,
35798,
7383,
25,
610,
11,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
54644,
1495,
505,
1495,
627,
35798,
24321,
56805,
25,
1796,
58,
4066,
2097,
1145,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
2097,
55609,
198,
54644,
1984,
505,
6743,
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/llms/langchain.llms.clarifai.Clarifai.html |
9bdca0347dbd-3 | Raise deprecation warning if callback_manager is used.
save(file_path: Union[Path, str]) → None¶
Save the LLM.
Parameters
file_path – Path to file to save the LLM to.
Example:
.. code-block:: python
llm.save(file_path=”path/llm.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_environment » all fields[source]¶
Validate that we have all required info to access Clarifai
platform and python package exists in environment.
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.
extra = 'forbid'¶ | [
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
445,
11237,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
445,
11237,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
657,
76,
5799,
4971,
2703,
45221,
2398,
14,
657,
76,
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,
52874,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
18409,
430,
584,
617,
682,
2631,
3630,
311,
2680,
31181,
333,
2192,
198,
16111,
323,
10344,
6462,
6866,
304,
4676,
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,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.clarifai.Clarifai.html |
f582aec3101f-0 | langchain.llms.vertexai.is_codey_model¶
langchain.llms.vertexai.is_codey_model(model_name: str) → bool[source]¶ | [
5317,
8995,
60098,
1026,
48375,
2192,
2124,
4229,
88,
5156,
55609,
198,
5317,
8995,
60098,
1026,
48375,
2192,
2124,
4229,
88,
5156,
7790,
1292,
25,
610,
8,
11651,
1845,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.vertexai.is_codey_model.html |
07c54ab6f300-0 | langchain.llms.ai21.AI21PenaltyData¶
class langchain.llms.ai21.AI21PenaltyData(*, scale: int = 0, applyToWhitespaces: bool = True, applyToPunctuations: bool = True, applyToNumbers: bool = True, applyToStopwords: bool = True, applyToEmojis: bool = True)[source]¶
Bases: BaseModel
Parameters for AI21 penalty data.
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 applyToEmojis: bool = True¶
param applyToNumbers: bool = True¶
param applyToPunctuations: bool = True¶
param applyToStopwords: bool = True¶
param applyToWhitespaces: bool = True¶
param scale: int = 0¶ | [
5317,
8995,
60098,
1026,
41483,
1691,
89878,
1691,
29305,
10231,
1061,
55609,
198,
1058,
8859,
8995,
60098,
1026,
41483,
1691,
89878,
1691,
29305,
10231,
1061,
4163,
11,
5569,
25,
528,
284,
220,
15,
11,
3881,
1271,
1671,
3695,
28438,
25,
1845,
284,
3082,
11,
3881,
1271,
47,
20526,
38170,
25,
1845,
284,
3082,
11,
3881,
1271,
28336,
25,
1845,
284,
3082,
11,
3881,
1271,
10903,
5880,
25,
1845,
284,
3082,
11,
3881,
1271,
2321,
84528,
25,
1845,
284,
3082,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
65705,
198,
9905,
369,
15592,
1691,
16750,
828,
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,
3881,
1271,
2321,
84528,
25,
1845,
284,
3082,
55609,
198,
913,
3881,
1271,
28336,
25,
1845,
284,
3082,
55609,
198,
913,
3881,
1271,
47,
20526,
38170,
25,
1845,
284,
3082,
55609,
198,
913,
3881,
1271,
10903,
5880,
25,
1845,
284,
3082,
55609,
198,
913,
3881,
1271,
1671,
3695,
28438,
25,
1845,
284,
3082,
55609,
198,
913,
5569,
25,
528,
284,
220,
15,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.ai21.AI21PenaltyData.html |
e532257c97ca-0 | langchain.llms.predictionguard.PredictionGuard¶
class langchain.llms.predictionguard.PredictionGuard(*, cache: Optional[bool] = None, verbose: bool = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, tags: Optional[List[str]] = None, client: Any = None, model: Optional[str] = 'MPT-7B-Instruct', output: Optional[Dict[str, Any]] = None, max_tokens: int = 256, temperature: float = 0.75, token: Optional[str] = None, stop: Optional[List[str]] = None)[source]¶
Bases: LLM
Wrapper around Prediction Guard large language models.
To use, you should have the predictionguard python package installed, and the
environment variable PREDICTIONGUARD_TOKEN set with your access token, or pass
it as a named parameter to the constructor. To use Prediction Guard’s API along
with OpenAI models, set the environment variable OPENAI_API_KEY with your
OpenAI API key as well.
Example
pgllm = PredictionGuard(model="MPT-7B-Instruct",
token="my-access-token",
output={
"type": "boolean"
})
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 cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
param callbacks: Callbacks = None¶
param max_tokens: int = 256¶
Denotes the number of tokens to predict per generation.
param model: Optional[str] = 'MPT-7B-Instruct'¶
Model name to use. | [
5317,
8995,
60098,
1026,
75195,
2538,
27190,
1087,
1171,
2538,
21471,
55609,
198,
1058,
8859,
8995,
60098,
1026,
75195,
2538,
27190,
1087,
1171,
2538,
21471,
4163,
11,
6636,
25,
12536,
58,
2707,
60,
284,
2290,
11,
14008,
25,
1845,
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,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
3016,
25,
5884,
284,
2290,
11,
1646,
25,
12536,
17752,
60,
284,
364,
44,
2898,
12,
22,
33,
32600,
1257,
518,
2612,
25,
12536,
58,
13755,
17752,
11,
5884,
5163,
284,
2290,
11,
1973,
29938,
25,
528,
284,
220,
4146,
11,
9499,
25,
2273,
284,
220,
15,
13,
2075,
11,
4037,
25,
12536,
17752,
60,
284,
2290,
11,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
445,
11237,
198,
11803,
2212,
62965,
12542,
3544,
4221,
4211,
627,
1271,
1005,
11,
499,
1288,
617,
279,
20212,
27190,
10344,
6462,
10487,
11,
323,
279,
198,
24175,
3977,
393,
6641,
40,
3664,
55795,
7527,
19199,
743,
449,
701,
2680,
4037,
11,
477,
1522,
198,
275,
439,
264,
7086,
5852,
311,
279,
4797,
13,
2057,
1005,
62965,
12542,
753,
5446,
3235,
198,
4291,
5377,
15836,
4211,
11,
743,
279,
4676,
3977,
30941,
15836,
11669,
6738,
449,
701,
198,
5109,
15836,
5446,
1401,
439,
1664,
627,
13617,
198,
3601,
657,
76,
284,
62965,
21471,
7790,
429,
44,
2898,
12,
22,
33,
32600,
1257,
761,
667,
4037,
429,
2465,
43256,
35941,
761,
667,
2612,
18013,
1014,
330,
1337,
794,
330,
6245,
702,
667,
2820,
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,
6636,
25,
12536,
58,
2707,
60,
284,
2290,
55609,
198,
913,
4927,
12418,
25,
12536,
58,
4066,
7646,
2087,
60,
284,
2290,
55609,
198,
913,
27777,
25,
23499,
82,
284,
2290,
55609,
198,
913,
1973,
29938,
25,
528,
284,
220,
4146,
55609,
198,
24539,
6429,
279,
1396,
315,
11460,
311,
7168,
824,
9659,
627,
913,
1646,
25,
12536,
17752,
60,
284,
364,
44,
2898,
12,
22,
33,
32600,
1257,
6,
55609,
198,
1747,
836,
311,
1005,
13
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.predictionguard.PredictionGuard.html |
e532257c97ca-1 | Model name to use.
param output: Optional[Dict[str, Any]] = None¶
The output type or structure for controlling the LLM output.
param stop: Optional[List[str]] = None¶
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param temperature: float = 0.75¶
A non-negative float that tunes the degree of randomness in generation.
param token: Optional[str] = None¶
Your Prediction Guard access token.
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → str¶
Check Cache and run the LLM on the given prompt and input.
async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → LLMResult¶
Run the LLM on the given prompt and input.
async agenerate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Take in a list of prompt values and return an LLMResult.
classmethod all_required_field_names() → Set¶
async apredict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Predict text from text.
async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Predict message from messages. | [
1747,
836,
311,
1005,
627,
913,
2612,
25,
12536,
58,
13755,
17752,
11,
5884,
5163,
284,
2290,
55609,
198,
791,
2612,
955,
477,
6070,
369,
26991,
279,
445,
11237,
2612,
627,
913,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609,
198,
16309,
311,
923,
311,
279,
1629,
11917,
627,
913,
9499,
25,
2273,
284,
220,
15,
13,
2075,
55609,
198,
32,
2536,
62035,
2273,
430,
55090,
279,
8547,
315,
87790,
304,
9659,
627,
913,
4037,
25,
12536,
17752,
60,
284,
2290,
55609,
198,
7927,
62965,
12542,
2680,
4037,
627,
913,
14008,
25,
1845,
510,
15669,
60,
55609,
198,
25729,
311,
1194,
704,
2077,
1495,
627,
565,
6797,
3889,
41681,
25,
610,
11,
3009,
25,
12536,
53094,
17752,
5163,
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,
610,
55609,
198,
4061,
20044,
323,
1629,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
7847,
945,
13523,
84432,
13044,
25,
1796,
17752,
1145,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
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,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
2122,
55609,
198,
6869,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
7847,
945,
13523,
62521,
84432,
13044,
25,
1796,
43447,
15091,
1150,
1145,
3009,
25,
12536,
53094,
17752,
5163,
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,
445,
11237,
2122,
55609,
198,
18293,
304,
264,
1160,
315,
10137,
2819,
323,
471,
459,
445,
11237,
2122,
627,
27853,
682,
19265,
5121,
9366,
368,
11651,
2638,
55609,
198,
7847,
1469,
9037,
7383,
25,
610,
11,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
54644,
1495,
505,
1495,
627,
7847,
1469,
9037,
24321,
56805,
25,
1796,
58,
4066,
2097,
1145,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
2097,
55609,
198,
54644,
1984,
505,
6743,
13
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.predictionguard.PredictionGuard.html |
e532257c97ca-2 | Predict message from messages.
dict(**kwargs: Any) → Dict¶
Return a dictionary of the LLM.
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → LLMResult¶
Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Take in a list of prompt values and return an LLMResult.
get_num_tokens(text: str) → int¶
Get the number of tokens present in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the message.
get_token_ids(text: str) → List[int]¶
Get the token present in the text.
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Predict text from text.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Predict message from messages.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
save(file_path: Union[Path, str]) → None¶
Save the LLM.
Parameters
file_path – Path to file to save the LLM to.
Example:
.. code-block:: python
llm.save(file_path=”path/llm.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it. | [
54644,
1984,
505,
6743,
627,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
264,
11240,
315,
279,
445,
11237,
627,
19927,
84432,
13044,
25,
1796,
17752,
1145,
3009,
25,
12536,
53094,
17752,
5163,
284,
2290,
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,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
2122,
55609,
198,
6869,
279,
445,
11237,
389,
279,
2728,
10137,
323,
1988,
627,
19927,
62521,
84432,
13044,
25,
1796,
43447,
15091,
1150,
1145,
3009,
25,
12536,
53094,
17752,
5163,
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,
445,
11237,
2122,
55609,
198,
18293,
304,
264,
1160,
315,
10137,
2819,
323,
471,
459,
445,
11237,
2122,
627,
456,
4369,
29938,
7383,
25,
610,
8,
11651,
528,
55609,
198,
1991,
279,
1396,
315,
11460,
3118,
304,
279,
1495,
627,
456,
4369,
29938,
5791,
24321,
56805,
25,
1796,
58,
4066,
2097,
2526,
11651,
528,
55609,
198,
1991,
279,
1396,
315,
11460,
304,
279,
1984,
627,
456,
6594,
8237,
7383,
25,
610,
8,
11651,
1796,
19155,
60,
55609,
198,
1991,
279,
4037,
3118,
304,
279,
1495,
627,
35798,
7383,
25,
610,
11,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
54644,
1495,
505,
1495,
627,
35798,
24321,
56805,
25,
1796,
58,
4066,
2097,
1145,
12039,
3009,
25,
12536,
58,
14405,
17752,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5464,
2097,
55609,
198,
54644,
1984,
505,
6743,
627,
16503,
4933,
2310,
70693,
4194,
8345,
4194,
682,
5151,
55609,
198,
94201,
409,
70693,
10163,
422,
4927,
12418,
374,
1511,
627,
6766,
4971,
2703,
25,
9323,
58,
1858,
11,
610,
2526,
11651,
2290,
55609,
198,
8960,
279,
445,
11237,
627,
9905,
198,
1213,
2703,
1389,
8092,
311,
1052,
311,
3665,
279,
445,
11237,
311,
627,
13617,
512,
497,
2082,
9612,
487,
10344,
198,
657,
76,
5799,
4971,
2703,
45221,
2398,
14,
657,
76,
34506,
863,
340,
16503,
743,
69021,
4194,
8345,
4194,
14008,
55609,
198,
2746,
14008,
374,
2290,
11,
743,
433,
13
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.predictionguard.PredictionGuard.html |
e532257c97ca-3 | 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_environment » all fields[source]¶
Validate that the access token and python package exists in environment.
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.
extra = 'forbid'¶ | [
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,
52874,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
18409,
430,
279,
2680,
4037,
323,
10344,
6462,
6866,
304,
4676,
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,
198,
7843,
369,
420,
4611,
67,
8322,
1665,
627,
15824,
284,
364,
2000,
21301,
6,
55609
] | https://langchain.readthedocs.io/en/latest/llms/langchain.llms.predictionguard.PredictionGuard.html |
bde6afc79613-0 | langchain.text_splitter.LatexTextSplitter¶
class langchain.text_splitter.LatexTextSplitter(**kwargs: Any)[source]¶
Bases: RecursiveCharacterTextSplitter
Attempts to split the text along Latex-formatted layout elements.
Initialize a LatexTextSplitter.
Methods
__init__(**kwargs)
Initialize a LatexTextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_language(language, **kwargs)
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
get_separators_for_language(language)
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶ | [
5317,
8995,
2858,
17489,
466,
1236,
266,
327,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
1236,
266,
327,
1199,
20805,
466,
22551,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
86996,
12686,
1199,
20805,
466,
198,
82617,
311,
6859,
279,
1495,
3235,
10128,
327,
8627,
12400,
6932,
5540,
627,
10130,
264,
10128,
327,
1199,
20805,
466,
627,
18337,
198,
565,
2381,
3889,
334,
9872,
340,
10130,
264,
10128,
327,
1199,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
30121,
61840,
11,
4194,
334,
9872,
340,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
456,
3537,
1768,
3046,
5595,
30121,
61840,
340,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.LatexTextSplitter.html |
bde6afc79613-1 | classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
static get_separators_for_language(language: Language) → List[str]¶
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609,
198,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
2020,
636,
3537,
1768,
3046,
5595,
30121,
61840,
25,
11688,
8,
11651,
1796,
17752,
60,
55609,
198,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.LatexTextSplitter.html |
a226eb68e11e-0 | langchain.text_splitter.MarkdownTextSplitter¶
class langchain.text_splitter.MarkdownTextSplitter(**kwargs: Any)[source]¶
Bases: RecursiveCharacterTextSplitter
Attempts to split the text along Markdown-formatted headings.
Initialize a MarkdownTextSplitter.
Methods
__init__(**kwargs)
Initialize a MarkdownTextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_language(language, **kwargs)
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
get_separators_for_language(language)
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶ | [
5317,
8995,
2858,
17489,
466,
76988,
2996,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
76988,
2996,
1199,
20805,
466,
22551,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
86996,
12686,
1199,
20805,
466,
198,
82617,
311,
6859,
279,
1495,
3235,
74292,
8627,
12400,
70552,
627,
10130,
264,
74292,
1199,
20805,
466,
627,
18337,
198,
565,
2381,
3889,
334,
9872,
340,
10130,
264,
74292,
1199,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
30121,
61840,
11,
4194,
334,
9872,
340,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
456,
3537,
1768,
3046,
5595,
30121,
61840,
340,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.MarkdownTextSplitter.html |
a226eb68e11e-1 | classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
static get_separators_for_language(language: Language) → List[str]¶
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609,
198,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
2020,
636,
3537,
1768,
3046,
5595,
30121,
61840,
25,
11688,
8,
11651,
1796,
17752,
60,
55609,
198,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.MarkdownTextSplitter.html |
4ff6a2f05fd2-0 | langchain.text_splitter.TextSplitter¶
class langchain.text_splitter.TextSplitter(chunk_size: int = 4000, chunk_overlap: int = 200, length_function: ~typing.Callable[[str], int] = <built-in function len>, keep_separator: bool = False, add_start_index: bool = False)[source]¶
Bases: BaseDocumentTransformer, ABC
Interface for splitting text into chunks.
Create a new TextSplitter.
Parameters
chunk_size – Maximum size of chunks to return
chunk_overlap – Overlap in characters between chunks
length_function – Function that measures the length of given chunks
keep_separator – Whether to keep the separator in the chunks
add_start_index – If True, includes chunk’s start index in metadata
Methods
__init__([chunk_size, chunk_overlap, ...])
Create a new TextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document][source]¶
Create documents from a list of texts. | [
5317,
8995,
2858,
17489,
466,
2021,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
2021,
20805,
466,
42677,
2424,
25,
528,
284,
220,
3443,
15,
11,
12143,
66894,
25,
528,
284,
220,
1049,
11,
3160,
9353,
25,
4056,
90902,
28115,
481,
15873,
496,
1145,
528,
60,
284,
366,
47339,
3502,
734,
2479,
8226,
2567,
59304,
25,
1845,
284,
3641,
11,
923,
5011,
3644,
25,
1845,
284,
3641,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
7676,
47458,
11,
19921,
198,
5160,
369,
45473,
1495,
1139,
27855,
627,
4110,
264,
502,
2991,
20805,
466,
627,
9905,
198,
27069,
2424,
1389,
27697,
1404,
315,
27855,
311,
471,
198,
27069,
66894,
1389,
6193,
16338,
304,
5885,
1990,
27855,
198,
4222,
9353,
1389,
5830,
430,
11193,
279,
3160,
315,
2728,
27855,
198,
13397,
59304,
1389,
13440,
311,
2567,
279,
25829,
304,
279,
27855,
198,
723,
5011,
3644,
1389,
1442,
3082,
11,
5764,
12143,
753,
1212,
1963,
304,
11408,
198,
18337,
198,
565,
2381,
565,
2625,
27069,
2424,
11,
4194,
27069,
66894,
11,
4194,
1131,
2608,
4110,
264,
502,
2991,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
1483,
2484,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.TextSplitter.html |
4ff6a2f05fd2-1 | Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter[source]¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS[source]¶
Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document][source]¶
Split documents.
abstract split_text(text: str) → List[str][source]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Transform sequence of documents by splitting them. | [
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
76747,
60,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
76747,
60,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
1483,
2484,
60,
55609,
198,
20805,
9477,
627,
16647,
6859,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
1483,
2484,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.TextSplitter.html |
7567ee29b493-0 | langchain.text_splitter.RecursiveCharacterTextSplitter¶
class langchain.text_splitter.RecursiveCharacterTextSplitter(separators: Optional[List[str]] = None, keep_separator: bool = True, **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at characters.
Recursively tries to split by different characters to find one
that works.
Create a new TextSplitter.
Methods
__init__([separators, keep_separator])
Create a new TextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_language(language, **kwargs)
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
get_separators_for_language(language)
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length. | [
5317,
8995,
2858,
17489,
466,
21259,
16921,
12686,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
21259,
16921,
12686,
1199,
20805,
466,
10698,
1768,
3046,
25,
12536,
53094,
17752,
5163,
284,
2290,
11,
2567,
59304,
25,
1845,
284,
3082,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
5885,
627,
3905,
80837,
16696,
311,
6859,
555,
2204,
5885,
311,
1505,
832,
198,
9210,
4375,
627,
4110,
264,
502,
2991,
20805,
466,
627,
18337,
198,
565,
2381,
565,
2625,
325,
1768,
3046,
11,
4194,
13397,
59304,
2608,
4110,
264,
502,
2991,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
30121,
61840,
11,
4194,
334,
9872,
340,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
456,
3537,
1768,
3046,
5595,
30121,
61840,
340,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.RecursiveCharacterTextSplitter.html |
7567ee29b493-1 | Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter[source]¶
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
static get_separators_for_language(language: Language) → List[str][source]¶
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
76747,
60,
55609,
198,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
2020,
636,
3537,
1768,
3046,
5595,
30121,
61840,
25,
11688,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.RecursiveCharacterTextSplitter.html |
b720c444b4b0-0 | langchain.text_splitter.HeaderType¶
class langchain.text_splitter.HeaderType[source]¶
Bases: TypedDict
Header type as typed dict.
Methods
__init__(*args, **kwargs)
clear()
copy()
fromkeys([value])
Create a new dictionary with keys from iterable and values set to value.
get(key[, default])
Return the value for key if key is in the dictionary, else default.
items()
keys()
pop(k[,d])
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()
Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])
Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
Attributes
level
name
data
clear() → None. Remove all items from D.¶
copy() → a shallow copy of D¶
fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
items() → a set-like object providing a view on D's items¶
keys() → a set-like object providing a view on D's keys¶ | [
5317,
8995,
2858,
17489,
466,
16130,
941,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
16130,
941,
76747,
60,
55609,
198,
33,
2315,
25,
51654,
13755,
198,
4137,
955,
439,
33069,
6587,
627,
18337,
198,
565,
2381,
69106,
2164,
11,
4194,
334,
9872,
340,
7574,
746,
8728,
746,
1527,
10786,
2625,
970,
2608,
4110,
264,
502,
11240,
449,
7039,
505,
51934,
323,
2819,
743,
311,
907,
627,
456,
4962,
38372,
4194,
2309,
2608,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
3699,
746,
10786,
746,
8539,
6097,
38372,
67,
2608,
2746,
279,
1401,
374,
539,
1766,
11,
471,
279,
1670,
422,
2728,
26,
6062,
11,
4933,
264,
39194,
627,
8539,
1224,
746,
13319,
323,
471,
264,
320,
798,
11,
907,
8,
6857,
439,
264,
220,
17,
2442,
6189,
627,
751,
2309,
4962,
38372,
4194,
2309,
2608,
14099,
1401,
449,
264,
907,
315,
1670,
422,
1401,
374,
539,
304,
279,
11240,
627,
2443,
2625,
36,
11,
4194,
79441,
37,
340,
2746,
469,
374,
3118,
323,
706,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
304,
469,
25,
423,
6874,
60,
284,
469,
6874,
60,
1442,
469,
374,
3118,
323,
37856,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
11,
348,
304,
469,
25,
423,
6874,
60,
284,
348,
763,
3060,
1162,
11,
420,
374,
8272,
555,
25,
369,
597,
304,
435,
25,
220,
423,
6874,
60,
284,
435,
6874,
933,
3745,
746,
10738,
198,
3374,
198,
609,
198,
695,
198,
7574,
368,
11651,
2290,
13,
4194,
11016,
682,
3673,
505,
423,
13,
55609,
198,
8728,
368,
11651,
264,
26682,
3048,
315,
423,
55609,
198,
1527,
10786,
3764,
5980,
11,
611,
8,
55609,
198,
4110,
264,
502,
11240,
449,
7039,
505,
51934,
323,
2819,
743,
311,
907,
627,
456,
4962,
11,
1670,
5980,
11,
611,
8,
55609,
198,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
3699,
368,
11651,
264,
743,
12970,
1665,
8405,
264,
1684,
389,
423,
596,
3673,
55609,
198,
10786,
368,
11651,
264,
743,
12970,
1665,
8405,
264,
1684,
389,
423,
596,
7039,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.HeaderType.html |
b720c444b4b0-1 | keys() → a set-like object providing a view on D's keys¶
pop(k[, d]) → v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise,
raise a KeyError.
popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
update([E, ]**F) → None. Update D from dict/iterable E and F.¶
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values() → an object providing a view on D's values¶
data: str¶
level: int¶
name: str¶ | [
10786,
368,
11651,
264,
743,
12970,
1665,
8405,
264,
1684,
389,
423,
596,
7039,
55609,
198,
8539,
6097,
38372,
294,
2526,
11651,
348,
11,
4148,
5300,
1401,
323,
471,
279,
12435,
907,
13,
55609,
198,
2746,
279,
1401,
374,
539,
1766,
11,
471,
279,
1670,
422,
2728,
26,
6062,
345,
19223,
264,
39194,
627,
8539,
1224,
368,
55609,
198,
13319,
323,
471,
264,
320,
798,
11,
907,
8,
6857,
439,
264,
220,
17,
2442,
6189,
627,
55328,
527,
6052,
304,
445,
27088,
320,
4354,
3502,
11,
1176,
9994,
8,
2015,
627,
36120,
39194,
422,
279,
6587,
374,
4384,
627,
751,
2309,
4962,
11,
1670,
5980,
11,
611,
8,
55609,
198,
14099,
1401,
449,
264,
907,
315,
1670,
422,
1401,
374,
539,
304,
279,
11240,
627,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
2443,
2625,
36,
11,
2331,
334,
37,
8,
11651,
2290,
13,
4194,
5666,
423,
505,
6587,
14,
2058,
481,
469,
323,
435,
13,
55609,
198,
2746,
469,
374,
3118,
323,
706,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
304,
469,
25,
423,
6874,
60,
284,
469,
6874,
933,
2746,
469,
374,
3118,
323,
37856,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
11,
348,
304,
469,
25,
423,
6874,
60,
284,
348,
198,
644,
3060,
1162,
11,
420,
374,
8272,
555,
25,
369,
597,
304,
435,
25,
220,
423,
6874,
60,
284,
435,
6874,
933,
3745,
368,
11651,
459,
1665,
8405,
264,
1684,
389,
423,
596,
2819,
55609,
198,
695,
25,
610,
55609,
198,
3374,
25,
528,
55609,
198,
609,
25,
610,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.HeaderType.html |
aa69414d9b19-0 | langchain.text_splitter.TokenTextSplitter¶
class langchain.text_splitter.TokenTextSplitter(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at tokens.
Create a new TextSplitter.
Methods
__init__([encoding_name, model_name, ...])
Create a new TextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length. | [
5317,
8995,
2858,
17489,
466,
33377,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
33377,
1199,
20805,
466,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
11460,
627,
4110,
264,
502,
2991,
20805,
466,
627,
18337,
198,
565,
2381,
565,
2625,
17600,
1292,
11,
4194,
2590,
1292,
11,
4194,
1131,
2608,
4110,
264,
502,
2991,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.TokenTextSplitter.html |
aa69414d9b19-1 | Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.TokenTextSplitter.html |
49581d4f460c-0 | langchain.text_splitter.split_text_on_tokens¶
langchain.text_splitter.split_text_on_tokens(*, text: str, tokenizer: Tokenizer) → List[str][source]¶
Split incoming text and return chunks. | [
5317,
8995,
2858,
17489,
466,
5402,
4424,
4570,
29938,
55609,
198,
5317,
8995,
2858,
17489,
466,
5402,
4424,
4570,
29938,
4163,
11,
1495,
25,
610,
11,
47058,
25,
9857,
3213,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
19957,
1495,
323,
471,
27855,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.split_text_on_tokens.html |
e9ec391f0578-0 | langchain.text_splitter.SpacyTextSplitter¶
class langchain.text_splitter.SpacyTextSplitter(separator: str = '\n\n', pipeline: str = 'en_core_web_sm', **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at sentences using Spacy.
Initialize the spacy text splitter.
Methods
__init__([separator, pipeline])
Initialize the spacy text splitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split incoming text and return chunks.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length. | [
5317,
8995,
2858,
17489,
466,
49401,
2826,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
49401,
2826,
1199,
20805,
466,
78806,
25,
610,
284,
5307,
77,
1734,
518,
15660,
25,
610,
284,
364,
268,
15834,
27050,
16253,
518,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
23719,
1701,
3165,
2826,
627,
10130,
279,
993,
2826,
1495,
74086,
627,
18337,
198,
565,
2381,
565,
2625,
41220,
11,
4194,
52358,
2608,
10130,
279,
993,
2826,
1495,
74086,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.SpacyTextSplitter.html |
e9ec391f0578-1 | Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split incoming text and return chunks.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.SpacyTextSplitter.html |
51009c53bd98-0 | langchain.text_splitter.PythonCodeTextSplitter¶
class langchain.text_splitter.PythonCodeTextSplitter(**kwargs: Any)[source]¶
Bases: RecursiveCharacterTextSplitter
Attempts to split the text along Python syntax.
Initialize a PythonCodeTextSplitter.
Methods
__init__(**kwargs)
Initialize a PythonCodeTextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_language(language, **kwargs)
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
get_separators_for_language(language)
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶ | [
5317,
8995,
2858,
17489,
466,
1087,
27993,
2123,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
1087,
27993,
2123,
1199,
20805,
466,
22551,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
86996,
12686,
1199,
20805,
466,
198,
82617,
311,
6859,
279,
1495,
3235,
13325,
20047,
627,
10130,
264,
13325,
2123,
1199,
20805,
466,
627,
18337,
198,
565,
2381,
3889,
334,
9872,
340,
10130,
264,
13325,
2123,
1199,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
30121,
61840,
11,
4194,
334,
9872,
340,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
456,
3537,
1768,
3046,
5595,
30121,
61840,
340,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.PythonCodeTextSplitter.html |
51009c53bd98-1 | classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
static get_separators_for_language(language: Language) → List[str]¶
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
27853,
505,
30121,
61840,
25,
11688,
11,
3146,
9872,
25,
5884,
8,
11651,
86996,
12686,
1199,
20805,
466,
55609,
198,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
2020,
636,
3537,
1768,
3046,
5595,
30121,
61840,
25,
11688,
8,
11651,
1796,
17752,
60,
55609,
198,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.PythonCodeTextSplitter.html |
f1f2a270b5fa-0 | langchain.text_splitter.LineType¶
class langchain.text_splitter.LineType[source]¶
Bases: TypedDict
Line type as typed dict.
Methods
__init__(*args, **kwargs)
clear()
copy()
fromkeys([value])
Create a new dictionary with keys from iterable and values set to value.
get(key[, default])
Return the value for key if key is in the dictionary, else default.
items()
keys()
pop(k[,d])
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()
Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])
Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
Attributes
metadata
content
clear() → None. Remove all items from D.¶
copy() → a shallow copy of D¶
fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
items() → a set-like object providing a view on D's items¶
keys() → a set-like object providing a view on D's keys¶
pop(k[, d]) → v, remove specified key and return the corresponding value.¶ | [
5317,
8995,
2858,
17489,
466,
16825,
941,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
16825,
941,
76747,
60,
55609,
198,
33,
2315,
25,
51654,
13755,
198,
2519,
955,
439,
33069,
6587,
627,
18337,
198,
565,
2381,
69106,
2164,
11,
4194,
334,
9872,
340,
7574,
746,
8728,
746,
1527,
10786,
2625,
970,
2608,
4110,
264,
502,
11240,
449,
7039,
505,
51934,
323,
2819,
743,
311,
907,
627,
456,
4962,
38372,
4194,
2309,
2608,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
3699,
746,
10786,
746,
8539,
6097,
38372,
67,
2608,
2746,
279,
1401,
374,
539,
1766,
11,
471,
279,
1670,
422,
2728,
26,
6062,
11,
4933,
264,
39194,
627,
8539,
1224,
746,
13319,
323,
471,
264,
320,
798,
11,
907,
8,
6857,
439,
264,
220,
17,
2442,
6189,
627,
751,
2309,
4962,
38372,
4194,
2309,
2608,
14099,
1401,
449,
264,
907,
315,
1670,
422,
1401,
374,
539,
304,
279,
11240,
627,
2443,
2625,
36,
11,
4194,
79441,
37,
340,
2746,
469,
374,
3118,
323,
706,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
304,
469,
25,
423,
6874,
60,
284,
469,
6874,
60,
1442,
469,
374,
3118,
323,
37856,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
11,
348,
304,
469,
25,
423,
6874,
60,
284,
348,
763,
3060,
1162,
11,
420,
374,
8272,
555,
25,
369,
597,
304,
435,
25,
220,
423,
6874,
60,
284,
435,
6874,
933,
3745,
746,
10738,
198,
18103,
198,
1834,
198,
7574,
368,
11651,
2290,
13,
4194,
11016,
682,
3673,
505,
423,
13,
55609,
198,
8728,
368,
11651,
264,
26682,
3048,
315,
423,
55609,
198,
1527,
10786,
3764,
5980,
11,
611,
8,
55609,
198,
4110,
264,
502,
11240,
449,
7039,
505,
51934,
323,
2819,
743,
311,
907,
627,
456,
4962,
11,
1670,
5980,
11,
611,
8,
55609,
198,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
3699,
368,
11651,
264,
743,
12970,
1665,
8405,
264,
1684,
389,
423,
596,
3673,
55609,
198,
10786,
368,
11651,
264,
743,
12970,
1665,
8405,
264,
1684,
389,
423,
596,
7039,
55609,
198,
8539,
6097,
38372,
294,
2526,
11651,
348,
11,
4148,
5300,
1401,
323,
471,
279,
12435,
907,
13,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.LineType.html |
f1f2a270b5fa-1 | pop(k[, d]) → v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise,
raise a KeyError.
popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
update([E, ]**F) → None. Update D from dict/iterable E and F.¶
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values() → an object providing a view on D's values¶
content: str¶
metadata: Dict[str, str]¶ | [
8539,
6097,
38372,
294,
2526,
11651,
348,
11,
4148,
5300,
1401,
323,
471,
279,
12435,
907,
13,
55609,
198,
2746,
279,
1401,
374,
539,
1766,
11,
471,
279,
1670,
422,
2728,
26,
6062,
345,
19223,
264,
39194,
627,
8539,
1224,
368,
55609,
198,
13319,
323,
471,
264,
320,
798,
11,
907,
8,
6857,
439,
264,
220,
17,
2442,
6189,
627,
55328,
527,
6052,
304,
445,
27088,
320,
4354,
3502,
11,
1176,
9994,
8,
2015,
627,
36120,
39194,
422,
279,
6587,
374,
4384,
627,
751,
2309,
4962,
11,
1670,
5980,
11,
611,
8,
55609,
198,
14099,
1401,
449,
264,
907,
315,
1670,
422,
1401,
374,
539,
304,
279,
11240,
627,
5715,
279,
907,
369,
1401,
422,
1401,
374,
304,
279,
11240,
11,
775,
1670,
627,
2443,
2625,
36,
11,
2331,
334,
37,
8,
11651,
2290,
13,
4194,
5666,
423,
505,
6587,
14,
2058,
481,
469,
323,
435,
13,
55609,
198,
2746,
469,
374,
3118,
323,
706,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
304,
469,
25,
423,
6874,
60,
284,
469,
6874,
933,
2746,
469,
374,
3118,
323,
37856,
264,
662,
10786,
368,
1749,
11,
1243,
1587,
25,
220,
369,
597,
11,
348,
304,
469,
25,
423,
6874,
60,
284,
348,
198,
644,
3060,
1162,
11,
420,
374,
8272,
555,
25,
369,
597,
304,
435,
25,
220,
423,
6874,
60,
284,
435,
6874,
933,
3745,
368,
11651,
459,
1665,
8405,
264,
1684,
389,
423,
596,
2819,
55609,
198,
1834,
25,
610,
55609,
198,
18103,
25,
30226,
17752,
11,
610,
60,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.LineType.html |
bfb4bd8ef527-0 | langchain.text_splitter.NLTKTextSplitter¶
class langchain.text_splitter.NLTKTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at sentences using NLTK.
Initialize the NLTK splitter.
Methods
__init__([separator])
Initialize the NLTK splitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split incoming text and return chunks.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶ | [
5317,
8995,
2858,
17489,
466,
2112,
43,
16155,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
2112,
43,
16155,
1199,
20805,
466,
78806,
25,
610,
284,
5307,
77,
1734,
518,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
23719,
1701,
33260,
16155,
627,
10130,
279,
33260,
16155,
74086,
627,
18337,
198,
565,
2381,
565,
2625,
41220,
2608,
10130,
279,
33260,
16155,
74086,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.NLTKTextSplitter.html |
bfb4bd8ef527-1 | Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split incoming text and return chunks.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.NLTKTextSplitter.html |
f8886f307106-0 | langchain.text_splitter.Language¶
class langchain.text_splitter.Language(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases: str, Enum
Methods
__init__(*args, **kwds)
capitalize()
Return a capitalized version of the string.
casefold()
Return a version of the string suitable for caseless comparisons.
center(width[, fillchar])
Return a centered string of length width.
count(sub[, start[, end]])
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
encode([encoding, errors])
Encode the string using the codec registered for encoding.
endswith(suffix[, start[, end]])
Return True if S ends with the specified suffix, False otherwise.
expandtabs([tabsize])
Return a copy where all tab characters are expanded using spaces.
find(sub[, start[, end]])
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
format(*args, **kwargs)
Return a formatted version of S, using substitutions from args and kwargs.
format_map(mapping)
Return a formatted version of S, using substitutions from mapping.
index(sub[, start[, end]])
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
isalnum()
Return True if the string is an alpha-numeric string, False otherwise.
isalpha()
Return True if the string is an alphabetic string, False otherwise.
isascii()
Return True if all characters in the string are ASCII, False otherwise.
isdecimal()
Return True if the string is a decimal string, False otherwise.
isdigit() | [
5317,
8995,
2858,
17489,
466,
58058,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
58058,
3764,
11,
5144,
5980,
11,
12039,
4793,
5980,
11,
5965,
609,
5980,
11,
955,
5980,
11,
1212,
28,
16,
11,
19254,
5980,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
610,
11,
14416,
198,
18337,
198,
565,
2381,
69106,
2164,
11,
4194,
334,
29700,
5469,
340,
82441,
746,
5715,
264,
98421,
2373,
315,
279,
925,
627,
5756,
20557,
746,
5715,
264,
2373,
315,
279,
925,
14791,
369,
1162,
1752,
36595,
627,
3133,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
31288,
925,
315,
3160,
2430,
627,
1868,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
1396,
315,
2536,
29352,
91719,
57115,
315,
39549,
1207,
304,
925,
328,
29563,
26874,
27218,
6311,
2625,
17600,
11,
4194,
7805,
2608,
33635,
279,
925,
1701,
279,
35747,
9879,
369,
11418,
627,
1438,
4291,
97566,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
3082,
422,
328,
10548,
449,
279,
5300,
21166,
11,
3641,
6062,
627,
33417,
32093,
2625,
6323,
2190,
2608,
5715,
264,
3048,
1405,
682,
5769,
5885,
527,
17626,
1701,
12908,
627,
3990,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
2293,
4163,
2164,
11,
4194,
334,
9872,
340,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
2897,
323,
16901,
627,
2293,
5489,
82157,
340,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
13021,
627,
1275,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
285,
94462,
746,
5715,
3082,
422,
279,
925,
374,
459,
8451,
12,
20173,
925,
11,
3641,
6062,
627,
285,
7288,
746,
5715,
3082,
422,
279,
925,
374,
459,
65695,
45938,
925,
11,
3641,
6062,
627,
285,
24207,
746,
5715,
3082,
422,
682,
5885,
304,
279,
925,
527,
40416,
11,
3641,
6062,
627,
285,
24170,
746,
5715,
3082,
422,
279,
925,
374,
264,
12395,
925,
11,
3641,
6062,
627,
70929,
368
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-1 | Return True if the string is a decimal string, False otherwise.
isdigit()
Return True if the string is a digit string, False otherwise.
isidentifier()
Return True if the string is a valid Python identifier, False otherwise.
islower()
Return True if the string is a lowercase string, False otherwise.
isnumeric()
Return True if the string is a numeric string, False otherwise.
isprintable()
Return True if the string is printable, False otherwise.
isspace()
Return True if the string is a whitespace string, False otherwise.
istitle()
Return True if the string is a title-cased string, False otherwise.
isupper()
Return True if the string is an uppercase string, False otherwise.
join(iterable, /)
Concatenate any number of strings.
ljust(width[, fillchar])
Return a left-justified string of length width.
lower()
Return a copy of the string converted to lowercase.
lstrip([chars])
Return a copy of the string with leading whitespace removed.
maketrans
Return a translation table usable for str.translate().
partition(sep, /)
Partition the string into three parts using the given separator.
removeprefix(prefix, /)
Return a str with the given prefix string removed if present.
removesuffix(suffix, /)
Return a str with the given suffix string removed if present.
replace(old, new[, count])
Return a copy with all occurrences of substring old replaced by new.
rfind(sub[, start[, end]])
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindex(sub[, start[, end]])
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. | [
5715,
3082,
422,
279,
925,
374,
264,
12395,
925,
11,
3641,
6062,
627,
70929,
746,
5715,
3082,
422,
279,
925,
374,
264,
16099,
925,
11,
3641,
6062,
627,
285,
16288,
746,
5715,
3082,
422,
279,
925,
374,
264,
2764,
13325,
13110,
11,
3641,
6062,
627,
285,
15115,
746,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
627,
285,
20173,
746,
5715,
3082,
422,
279,
925,
374,
264,
25031,
925,
11,
3641,
6062,
627,
285,
1374,
481,
746,
5715,
3082,
422,
279,
925,
374,
43095,
11,
3641,
6062,
627,
82870,
746,
5715,
3082,
422,
279,
925,
374,
264,
37472,
925,
11,
3641,
6062,
627,
380,
1017,
746,
5715,
3082,
422,
279,
925,
374,
264,
2316,
1824,
1503,
925,
11,
3641,
6062,
627,
285,
13886,
746,
5715,
3082,
422,
279,
925,
374,
459,
40582,
925,
11,
3641,
6062,
627,
6115,
28169,
481,
11,
4194,
54660,
79540,
32223,
904,
1396,
315,
9246,
627,
75,
4345,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
2163,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
15115,
746,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
627,
75,
13406,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
6522,
37472,
7108,
627,
49662,
17820,
598,
198,
5715,
264,
14807,
2007,
41030,
369,
610,
26998,
26914,
42098,
10698,
79,
11,
4194,
54660,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
5514,
12113,
30018,
11,
4194,
54660,
5715,
264,
610,
449,
279,
2728,
9436,
925,
7108,
422,
3118,
627,
1864,
10296,
13866,
97566,
11,
4194,
54660,
5715,
264,
610,
449,
279,
2728,
21166,
925,
7108,
422,
3118,
627,
8319,
22739,
11,
4194,
943,
38372,
4194,
1868,
2608,
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
627,
81,
3990,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
27218,
81,
1275,
10849,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
11,
1778,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-2 | rjust(width[, fillchar])
Return a right-justified string of length width.
rpartition(sep, /)
Partition the string into three parts using the given separator.
rsplit([sep, maxsplit])
Return a list of the substrings in the string, using sep as the separator string.
rstrip([chars])
Return a copy of the string with trailing whitespace removed.
split([sep, maxsplit])
Return a list of the substrings in the string, using sep as the separator string.
splitlines([keepends])
Return a list of the lines in the string, breaking at line boundaries.
startswith(prefix[, start[, end]])
Return True if S starts with the specified prefix, False otherwise.
strip([chars])
Return a copy of the string with leading and trailing whitespace removed.
swapcase()
Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()
Return a version of the string where each word is titlecased.
translate(table, /)
Replace each character in the string using the given translation table.
upper()
Return a copy of the string converted to uppercase.
zfill(width, /)
Pad a numeric string with zeros on the left, to fill a field of the given width.
Attributes
CPP
GO
JAVA
JS
PHP
PROTO
PYTHON
RST
RUBY
RUST
SCALA
SWIFT
MARKDOWN
LATEX
HTML
SOL
capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower
case.
casefold()¶
Return a version of the string suitable for caseless comparisons.
center(width, fillchar=' ', /)¶
Return a centered string of length width. | [
81,
4345,
16830,
38372,
4194,
7712,
1799,
2608,
5715,
264,
1314,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
81,
42098,
10698,
79,
11,
4194,
54660,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
5544,
2344,
2625,
29136,
11,
4194,
2880,
7105,
2608,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
71498,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
28848,
37472,
7108,
627,
7105,
2625,
29136,
11,
4194,
2880,
7105,
2608,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
7105,
8128,
2625,
13397,
1438,
2608,
5715,
264,
1160,
315,
279,
5238,
304,
279,
925,
11,
15061,
520,
1584,
23546,
627,
70425,
30018,
38372,
4194,
2527,
38372,
4194,
408,
27829,
5715,
3082,
422,
328,
8638,
449,
279,
5300,
9436,
11,
3641,
6062,
627,
13406,
2625,
19811,
2608,
5715,
264,
3048,
315,
279,
925,
449,
6522,
323,
28848,
37472,
7108,
627,
26825,
5756,
746,
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
746,
5715,
264,
2373,
315,
279,
925,
1405,
1855,
3492,
374,
2316,
92226,
627,
14372,
16138,
11,
4194,
54660,
23979,
1855,
3752,
304,
279,
925,
1701,
279,
2728,
14807,
2007,
627,
13886,
746,
5715,
264,
3048,
315,
279,
925,
16489,
311,
40582,
627,
89,
7712,
16830,
11,
4194,
54660,
14047,
264,
25031,
925,
449,
17975,
389,
279,
2163,
11,
311,
5266,
264,
2115,
315,
279,
2728,
2430,
627,
10738,
198,
16234,
198,
15881,
198,
71568,
198,
12830,
198,
15510,
198,
94954,
198,
94240,
198,
49,
790,
198,
49,
85370,
198,
49,
8721,
198,
3624,
98865,
198,
17268,
14627,
198,
24995,
23370,
198,
43,
2390,
55,
198,
5959,
198,
50,
1971,
198,
82441,
368,
55609,
198,
5715,
264,
98421,
2373,
315,
279,
925,
627,
7816,
11951,
11,
1304,
279,
1176,
3752,
617,
8582,
1162,
323,
279,
2800,
4827,
198,
5756,
627,
5756,
20557,
368,
55609,
198,
5715,
264,
2373,
315,
279,
925,
14791,
369,
1162,
1752,
36595,
627,
3133,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
31288,
925,
315,
3160,
2430,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-3 | center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
count(sub[, start[, end]]) → int¶
Return the number of non-overlapping occurrences of substring sub in
string S[start:end]. Optional arguments start and end are
interpreted as in slice notation.
encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
encodingThe encoding in which to encode the string.
errorsThe error handling scheme to use for encoding errors.
The default is ‘strict’ meaning that encoding errors raise a
UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle UnicodeEncodeErrors.
endswith(suffix[, start[, end]]) → bool¶
Return True if S ends with the specified suffix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
suffix can also be a tuple of strings to try.
expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
find(sub[, start[, end]]) → int¶
Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
format(*args, **kwargs) → str¶
Return a formatted version of S, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).
format_map(mapping) → str¶ | [
3133,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
31288,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
1868,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
1396,
315,
2536,
29352,
91719,
57115,
315,
39549,
1207,
304,
198,
928,
328,
29563,
26874,
948,
220,
12536,
6105,
1212,
323,
842,
527,
198,
94561,
439,
304,
16363,
45297,
627,
6311,
86963,
1151,
4867,
12,
23,
518,
6103,
1151,
6765,
873,
55609,
198,
33635,
279,
925,
1701,
279,
35747,
9879,
369,
11418,
627,
17600,
791,
11418,
304,
902,
311,
16559,
279,
925,
627,
7805,
791,
1493,
11850,
13155,
311,
1005,
369,
11418,
6103,
627,
791,
1670,
374,
3451,
6765,
529,
7438,
430,
11418,
6103,
4933,
264,
198,
35020,
33635,
1480,
13,
220,
7089,
3284,
2819,
527,
3451,
13431,
20182,
3451,
8319,
529,
323,
198,
14336,
6591,
1799,
1116,
8319,
529,
439,
1664,
439,
904,
1023,
836,
9879,
449,
198,
1889,
4942,
10131,
4188,
430,
649,
3790,
36997,
33635,
14199,
627,
1438,
4291,
97566,
38372,
1212,
38372,
842,
30716,
11651,
1845,
55609,
198,
5715,
3082,
422,
328,
10548,
449,
279,
5300,
21166,
11,
3641,
6062,
627,
2409,
10309,
1212,
11,
1296,
328,
7314,
520,
430,
2361,
627,
2409,
10309,
842,
11,
3009,
27393,
328,
520,
430,
2361,
627,
27884,
649,
1101,
387,
264,
14743,
315,
9246,
311,
1456,
627,
33417,
32093,
28945,
2190,
28,
23,
8,
55609,
198,
5715,
264,
3048,
1405,
682,
5769,
5885,
527,
17626,
1701,
12908,
627,
2746,
5769,
2190,
374,
539,
2728,
11,
264,
5769,
1404,
315,
220,
23,
5885,
374,
19655,
627,
3990,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
5715,
482,
16,
389,
8060,
627,
2293,
4163,
2164,
11,
3146,
9872,
8,
11651,
610,
55609,
198,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
2897,
323,
16901,
627,
791,
94750,
527,
11054,
555,
60291,
320,
14336,
90,
529,
323,
3451,
92,
529,
4390,
2293,
5489,
82157,
8,
11651,
610,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-4 | format_map(mapping) → str¶
Return a formatted version of S, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).
index(sub[, start[, end]]) → int¶
Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and
there is at least one character in the string.
isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there
is at least one character in the string.
isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.
isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and
there is at least one character in the string.
isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there
is at least one character in the string.
isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
such as “def” or “class”.
islower()¶
Return True if the string is a lowercase string, False otherwise. | [
2293,
5489,
82157,
8,
11651,
610,
55609,
198,
5715,
264,
24001,
2373,
315,
328,
11,
1701,
94750,
505,
13021,
627,
791,
94750,
527,
11054,
555,
60291,
320,
14336,
90,
529,
323,
3451,
92,
529,
4390,
1275,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
15821,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
36120,
15764,
994,
279,
39549,
374,
539,
1766,
627,
285,
94462,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
8451,
12,
20173,
925,
11,
3641,
6062,
627,
32,
925,
374,
8451,
12,
20173,
422,
682,
5885,
304,
279,
925,
527,
8451,
12,
20173,
323,
198,
19041,
374,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
7288,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
65695,
45938,
925,
11,
3641,
6062,
627,
32,
925,
374,
65695,
45938,
422,
682,
5885,
304,
279,
925,
527,
65695,
45938,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
24207,
368,
55609,
198,
5715,
3082,
422,
682,
5885,
304,
279,
925,
527,
40416,
11,
3641,
6062,
627,
57550,
5885,
617,
2082,
3585,
304,
279,
2134,
549,
10,
931,
15,
35681,
10,
11194,
37,
627,
3606,
925,
374,
40416,
2288,
627,
285,
24170,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
12395,
925,
11,
3641,
6062,
627,
32,
925,
374,
264,
12395,
925,
422,
682,
5885,
304,
279,
925,
527,
12395,
323,
198,
19041,
374,
520,
3325,
832,
3752,
304,
279,
925,
627,
70929,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
16099,
925,
11,
3641,
6062,
627,
32,
925,
374,
264,
16099,
925,
422,
682,
5885,
304,
279,
925,
527,
19016,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
285,
16288,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
2764,
13325,
13110,
11,
3641,
6062,
627,
7368,
16570,
2124,
20454,
1161,
8,
311,
1296,
3508,
925,
274,
374,
264,
4694,
13110,
345,
21470,
439,
1054,
755,
863,
477,
1054,
1058,
863,
627,
285,
15115,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-5 | islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.
isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at
least one character in the string.
isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in
repr() or if it is empty.
isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there
is at least one character in the string.
istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.
isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.
join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string.
The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
lower()¶
Return a copy of the string converted to lowercase. | [
285,
15115,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
43147,
925,
11,
3641,
6062,
627,
32,
925,
374,
43147,
422,
682,
272,
1503,
5885,
304,
279,
925,
527,
43147,
323,
198,
19041,
374,
520,
3325,
832,
272,
1503,
3752,
304,
279,
925,
627,
285,
20173,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
25031,
925,
11,
3641,
6062,
627,
32,
925,
374,
25031,
422,
682,
5885,
304,
279,
925,
527,
25031,
323,
1070,
374,
520,
198,
56371,
832,
3752,
304,
279,
925,
627,
285,
1374,
481,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
43095,
11,
3641,
6062,
627,
32,
925,
374,
43095,
422,
682,
315,
1202,
5885,
527,
6646,
43095,
304,
198,
31937,
368,
477,
422,
433,
374,
4384,
627,
82870,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
37472,
925,
11,
3641,
6062,
627,
32,
925,
374,
37472,
422,
682,
5885,
304,
279,
925,
527,
37472,
323,
1070,
198,
285,
520,
3325,
832,
3752,
304,
279,
925,
627,
380,
1017,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
264,
2316,
1824,
1503,
925,
11,
3641,
6062,
627,
644,
264,
2316,
1824,
1503,
925,
11,
8582,
12,
323,
2316,
39585,
5885,
1253,
1193,
198,
19070,
21482,
1503,
5885,
323,
43147,
5885,
1193,
272,
1503,
6305,
627,
285,
13886,
368,
55609,
198,
5715,
3082,
422,
279,
925,
374,
459,
40582,
925,
11,
3641,
6062,
627,
32,
925,
374,
40582,
422,
682,
272,
1503,
5885,
304,
279,
925,
527,
40582,
323,
198,
19041,
374,
520,
3325,
832,
272,
1503,
3752,
304,
279,
925,
627,
6115,
28169,
481,
11,
611,
8,
55609,
198,
79540,
32223,
904,
1396,
315,
9246,
627,
791,
925,
6832,
1749,
374,
2663,
374,
22306,
304,
1990,
1855,
2728,
925,
627,
791,
1121,
374,
6052,
439,
264,
502,
925,
627,
13617,
25,
3451,
14639,
13,
6115,
2625,
14336,
370,
20182,
3451,
65116,
20182,
3451,
5544,
529,
2526,
1492,
3451,
370,
558,
80,
26721,
529,
198,
75,
4345,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
2163,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
15115,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-6 | lower()¶
Return a copy of the string converted to lowercase.
lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters to Unicode ordinals, strings or None.
Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.
partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string
and two empty strings.
removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):].
Otherwise, return a copy of the original string.
removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string.
replace(old, new, count=- 1, /)¶
Return a copy with all occurrences of substring old replaced by new. | [
15115,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
43147,
627,
75,
13406,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
6522,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
2020,
52016,
17820,
598,
368,
55609,
198,
5715,
264,
14807,
2007,
41030,
369,
610,
26998,
26914,
2746,
1070,
374,
1193,
832,
5811,
11,
433,
2011,
387,
264,
11240,
13021,
36997,
198,
541,
24624,
320,
396,
68692,
8,
477,
5885,
311,
36997,
6141,
24624,
11,
9246,
477,
2290,
627,
12686,
7039,
690,
387,
1243,
16489,
311,
6141,
24624,
627,
2746,
1070,
527,
1403,
6105,
11,
814,
2011,
387,
9246,
315,
6273,
3160,
11,
323,
198,
258,
279,
13239,
11240,
11,
1855,
3752,
304,
865,
690,
387,
24784,
311,
279,
198,
19740,
520,
279,
1890,
2361,
304,
379,
13,
1442,
1070,
374,
264,
4948,
5811,
11,
433,
198,
25849,
387,
264,
925,
11,
6832,
5885,
690,
387,
24784,
311,
2290,
304,
279,
1121,
627,
42098,
10698,
79,
11,
611,
8,
55609,
198,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
2028,
690,
2778,
369,
279,
25829,
304,
279,
925,
13,
220,
1442,
279,
25829,
374,
1766,
345,
4310,
264,
220,
18,
2442,
6189,
8649,
279,
961,
1603,
279,
25829,
11,
279,
25829,
198,
275,
726,
11,
323,
279,
961,
1306,
433,
627,
2746,
279,
25829,
374,
539,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
279,
4113,
925,
198,
438,
1403,
4384,
9246,
627,
5514,
12113,
30018,
11,
611,
8,
55609,
198,
5715,
264,
610,
449,
279,
2728,
9436,
925,
7108,
422,
3118,
627,
2746,
279,
925,
8638,
449,
279,
9436,
925,
11,
471,
925,
25721,
30018,
1680,
27218,
81556,
11,
471,
264,
3048,
315,
279,
4113,
925,
627,
1864,
10296,
13866,
97566,
11,
611,
8,
55609,
198,
5715,
264,
610,
449,
279,
2728,
21166,
925,
7108,
422,
3118,
627,
2746,
279,
925,
10548,
449,
279,
21166,
925,
323,
430,
21166,
374,
539,
4384,
345,
693,
925,
27141,
2963,
97566,
27261,
18715,
11,
471,
264,
3048,
315,
279,
4113,
198,
928,
627,
8319,
22739,
11,
502,
11,
1797,
11065,
220,
16,
11,
611,
8,
55609,
198,
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-7 | Return a copy with all occurrences of substring old replaced by new.
countMaximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are
replaced.
rfind(sub[, start[, end]]) → int¶
Return the highest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
rindex(sub[, start[, end]]) → int¶
Return the highest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If
the separator is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings
and the original string.
rsplit(sep=None, maxsplit=- 1)¶
Return a list of the substrings in the string, using sep as the separator string.
sepThe separator used to split the string.
When set to None (the default value), will split on any whitespace
character (including \n \r \t \f and spaces) and will discard
empty strings from the result.
maxsplitMaximum number of splits (starting from the left). | [
5715,
264,
3048,
449,
682,
57115,
315,
39549,
2362,
12860,
555,
502,
627,
1868,
28409,
1396,
315,
57115,
311,
8454,
627,
12,
16,
320,
1820,
1670,
907,
8,
3445,
8454,
682,
57115,
627,
2746,
279,
10309,
5811,
1797,
374,
2728,
11,
1193,
279,
1176,
1797,
57115,
527,
198,
265,
37469,
627,
81,
3990,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
5715,
482,
16,
389,
8060,
627,
81,
1275,
10849,
38372,
1212,
38372,
842,
30716,
11651,
528,
55609,
198,
5715,
279,
8592,
1963,
304,
328,
1405,
39549,
1207,
374,
1766,
345,
21470,
430,
1207,
374,
13282,
2949,
328,
29563,
26874,
948,
220,
12536,
198,
16774,
1212,
323,
842,
527,
33398,
439,
304,
16363,
45297,
627,
36120,
15764,
994,
279,
39549,
374,
539,
1766,
627,
81,
4345,
16830,
11,
5266,
1799,
1151,
6752,
611,
8,
55609,
198,
5715,
264,
1314,
12,
4345,
1908,
925,
315,
3160,
2430,
627,
22344,
374,
2884,
1701,
279,
5300,
5266,
3752,
320,
2309,
374,
264,
3634,
4390,
81,
42098,
10698,
79,
11,
611,
8,
55609,
198,
51078,
279,
925,
1139,
2380,
5596,
1701,
279,
2728,
25829,
627,
2028,
690,
2778,
369,
279,
25829,
304,
279,
925,
11,
6041,
520,
279,
842,
13,
1442,
198,
1820,
25829,
374,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
279,
961,
1603,
279,
198,
41220,
11,
279,
25829,
5196,
11,
323,
279,
961,
1306,
433,
627,
2746,
279,
25829,
374,
539,
1766,
11,
4780,
264,
220,
18,
2442,
6189,
8649,
1403,
4384,
9246,
198,
438,
279,
4113,
925,
627,
5544,
2344,
10698,
79,
5980,
11,
1973,
7105,
11065,
220,
16,
8,
55609,
198,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
29136,
791,
25829,
1511,
311,
6859,
279,
925,
627,
4599,
743,
311,
2290,
320,
1820,
1670,
907,
705,
690,
6859,
389,
904,
37472,
198,
19740,
320,
16564,
1144,
77,
1144,
81,
1144,
83,
1144,
69,
323,
12908,
8,
323,
690,
38967,
198,
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
570
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-8 | empty strings from the result.
maxsplitMaximum number of splits (starting from the left).
-1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
split(sep=None, maxsplit=- 1)¶
Return a list of the substrings in the string, using sep as the separator string.
sepThe separator used to split the string.
When set to None (the default value), will split on any whitespace
character (including \n \r \t \f and spaces) and will discard
empty strings from the result.
maxsplitMaximum number of splits (starting from the left).
-1 (the default value) means no limit.
Note, str.split() is mainly useful for data that has been intentionally
delimited. With natural text that includes punctuation, consider using
the regular expression module.
splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and
true.
startswith(prefix[, start[, end]]) → bool¶
Return True if S starts with the specified prefix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
prefix can also be a tuple of strings to try.
strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()¶ | [
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
4390,
12,
16,
320,
1820,
1670,
907,
8,
3445,
912,
4017,
627,
20805,
1303,
8638,
520,
279,
842,
315,
279,
925,
323,
4375,
311,
279,
4156,
627,
71498,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
28848,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
7105,
10698,
79,
5980,
11,
1973,
7105,
11065,
220,
16,
8,
55609,
198,
5715,
264,
1160,
315,
279,
16146,
826,
304,
279,
925,
11,
1701,
21693,
439,
279,
25829,
925,
627,
29136,
791,
25829,
1511,
311,
6859,
279,
925,
627,
4599,
743,
311,
2290,
320,
1820,
1670,
907,
705,
690,
6859,
389,
904,
37472,
198,
19740,
320,
16564,
1144,
77,
1144,
81,
1144,
83,
1144,
69,
323,
12908,
8,
323,
690,
38967,
198,
3274,
9246,
505,
279,
1121,
627,
2880,
7105,
28409,
1396,
315,
41567,
320,
40389,
505,
279,
2163,
4390,
12,
16,
320,
1820,
1670,
907,
8,
3445,
912,
4017,
627,
9290,
11,
610,
5402,
368,
374,
14918,
5505,
369,
828,
430,
706,
1027,
37304,
198,
9783,
32611,
13,
220,
3161,
5933,
1495,
430,
5764,
62603,
11,
2980,
1701,
198,
1820,
5912,
7645,
4793,
627,
7105,
8128,
7,
13397,
1438,
5725,
8,
55609,
198,
5715,
264,
1160,
315,
279,
5238,
304,
279,
925,
11,
15061,
520,
1584,
23546,
627,
2519,
18808,
527,
539,
5343,
304,
279,
13239,
1160,
7389,
2567,
1438,
374,
2728,
323,
198,
1904,
627,
70425,
30018,
38372,
1212,
38372,
842,
30716,
11651,
1845,
55609,
198,
5715,
3082,
422,
328,
8638,
449,
279,
5300,
9436,
11,
3641,
6062,
627,
2409,
10309,
1212,
11,
1296,
328,
7314,
520,
430,
2361,
627,
2409,
10309,
842,
11,
3009,
27393,
328,
520,
430,
2361,
627,
12113,
649,
1101,
387,
264,
14743,
315,
9246,
311,
1456,
627,
13406,
77306,
5980,
11,
611,
8,
55609,
198,
5715,
264,
3048,
315,
279,
925,
449,
6522,
323,
28848,
37472,
7108,
627,
2746,
23861,
374,
2728,
323,
539,
2290,
11,
4148,
5885,
304,
23861,
4619,
627,
26825,
5756,
368,
55609,
198,
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
368,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
f8886f307106-9 | Convert uppercase characters to lowercase and lowercase characters to uppercase.
title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining
cased characters have lower case.
translate(table, /)¶
Replace each character in the string using the given translation table.
tableTranslation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a
dictionary or list. If this operation raises LookupError, the character is
left untouched. Characters mapped to None are deleted.
upper()¶
Return a copy of the string converted to uppercase.
zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
CPP = 'cpp'¶
GO = 'go'¶
HTML = 'html'¶
JAVA = 'java'¶
JS = 'js'¶
LATEX = 'latex'¶
MARKDOWN = 'markdown'¶
PHP = 'php'¶
PROTO = 'proto'¶
PYTHON = 'python'¶
RST = 'rst'¶
RUBY = 'ruby'¶
RUST = 'rust'¶
SCALA = 'scala'¶
SOL = 'sol'¶
SWIFT = 'swift'¶ | [
12281,
40582,
5885,
311,
43147,
323,
43147,
5885,
311,
40582,
627,
2150,
368,
55609,
198,
5715,
264,
2373,
315,
279,
925,
1405,
1855,
3492,
374,
2316,
92226,
627,
7816,
11951,
11,
4339,
1212,
449,
8582,
92226,
5885,
323,
682,
9861,
198,
92226,
5885,
617,
4827,
1162,
627,
14372,
16138,
11,
611,
8,
55609,
198,
23979,
1855,
3752,
304,
279,
925,
1701,
279,
2728,
14807,
2007,
627,
2048,
25416,
2007,
11,
902,
2011,
387,
264,
13021,
315,
36997,
6141,
24624,
311,
198,
35020,
6141,
24624,
11,
9246,
11,
477,
2290,
627,
791,
2007,
2011,
4305,
19128,
9199,
287,
4669,
1328,
61012,
10662,
369,
2937,
264,
198,
36771,
477,
1160,
13,
220,
1442,
420,
5784,
25930,
51411,
1480,
11,
279,
3752,
374,
198,
2414,
68622,
13,
220,
45616,
24784,
311,
2290,
527,
11309,
627,
13886,
368,
55609,
198,
5715,
264,
3048,
315,
279,
925,
16489,
311,
40582,
627,
89,
7712,
16830,
11,
611,
8,
55609,
198,
14047,
264,
25031,
925,
449,
17975,
389,
279,
2163,
11,
311,
5266,
264,
2115,
315,
279,
2728,
2430,
627,
791,
925,
374,
2646,
60856,
627,
16234,
284,
364,
11055,
6,
55609,
198,
15881,
284,
364,
3427,
6,
55609,
198,
5959,
284,
364,
1580,
6,
55609,
198,
71568,
284,
364,
10248,
6,
55609,
198,
12830,
284,
364,
2580,
6,
55609,
198,
43,
2390,
55,
284,
364,
65780,
6,
55609,
198,
24995,
23370,
284,
364,
61173,
6,
55609,
198,
15510,
284,
364,
1230,
6,
55609,
198,
94954,
284,
364,
15461,
6,
55609,
198,
94240,
284,
364,
12958,
6,
55609,
198,
49,
790,
284,
364,
59125,
6,
55609,
198,
49,
85370,
284,
364,
47375,
6,
55609,
198,
49,
8721,
284,
364,
36888,
6,
55609,
198,
3624,
98865,
284,
364,
27920,
6,
55609,
198,
50,
1971,
284,
364,
39298,
6,
55609,
198,
17268,
14627,
284,
364,
71742,
6,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.Language.html |
bce4998b1609-0 | langchain.text_splitter.CharacterTextSplitter¶
class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at characters.
Create a new TextSplitter.
Methods
__init__([separator])
Create a new TextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split incoming text and return chunks.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶ | [
5317,
8995,
2858,
17489,
466,
52562,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
52562,
1199,
20805,
466,
78806,
25,
610,
284,
5307,
77,
1734,
518,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
5885,
627,
4110,
264,
502,
2991,
20805,
466,
627,
18337,
198,
565,
2381,
565,
2625,
41220,
2608,
4110,
264,
502,
2991,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.CharacterTextSplitter.html |
bce4998b1609-1 | Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split incoming text and return chunks.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
19957,
1495,
323,
471,
27855,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.CharacterTextSplitter.html |
e6ad74d8b542-0 | langchain.text_splitter.SentenceTransformersTokenTextSplitter¶
class langchain.text_splitter.SentenceTransformersTokenTextSplitter(chunk_overlap: int = 50, model_name: str = 'sentence-transformers/all-mpnet-base-v2', tokens_per_chunk: Optional[int] = None, **kwargs: Any)[source]¶
Bases: TextSplitter
Implementation of splitting text that looks at tokens.
Create a new TextSplitter.
Methods
__init__([chunk_overlap, model_name, ...])
Create a new TextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a sequence of documents by splitting them.
count_tokens(*, text)
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a sequence of documents by splitting them.
count_tokens(*, text: str) → int[source]¶
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶
Text splitter that uses HuggingFace tokenizer to count length. | [
5317,
8995,
2858,
17489,
466,
815,
18886,
9140,
388,
3404,
1199,
20805,
466,
55609,
198,
1058,
8859,
8995,
2858,
17489,
466,
815,
18886,
9140,
388,
3404,
1199,
20805,
466,
42677,
66894,
25,
528,
284,
220,
1135,
11,
1646,
1292,
25,
610,
284,
364,
52989,
33952,
388,
32506,
12,
1331,
4816,
31113,
8437,
17,
518,
11460,
5796,
31639,
25,
12536,
19155,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
2991,
20805,
466,
198,
37950,
315,
45473,
1495,
430,
5992,
520,
11460,
627,
4110,
264,
502,
2991,
20805,
466,
627,
18337,
198,
565,
2381,
565,
2625,
27069,
66894,
11,
4194,
2590,
1292,
11,
4194,
1131,
2608,
4110,
264,
502,
2991,
20805,
466,
627,
266,
34489,
630,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
1868,
29938,
4163,
11,
4194,
1342,
340,
3261,
77027,
7383,
82,
38372,
4194,
4150,
329,
19907,
2608,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
1527,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
11,
4194,
334,
9872,
340,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
1527,
530,
1609,
5963,
40168,
2625,
17600,
1292,
11,
4194,
1131,
2608,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
340,
20805,
9477,
627,
7105,
4424,
7383,
340,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
11,
4194,
334,
9872,
340,
9140,
8668,
315,
9477,
555,
45473,
1124,
627,
7847,
264,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
2170,
55294,
5276,
264,
8668,
315,
9477,
555,
45473,
1124,
627,
1868,
29938,
4163,
11,
1495,
25,
610,
8,
11651,
528,
76747,
60,
55609,
198,
3261,
77027,
7383,
82,
25,
1796,
17752,
1145,
2322,
329,
19907,
25,
12536,
53094,
58,
8644,
5163,
284,
2290,
8,
11651,
1796,
58,
7676,
60,
55609,
198,
4110,
9477,
505,
264,
1160,
315,
22755,
627,
27853,
505,
1552,
36368,
1594,
6594,
3213,
13577,
3213,
25,
5884,
11,
3146,
9872,
25,
5884,
8,
11651,
2991,
20805,
466,
55609,
198,
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.SentenceTransformersTokenTextSplitter.html |
e6ad74d8b542-1 | Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktoken encoder to count length.
split_documents(documents: Iterable[Document]) → List[Document]¶
Split documents.
split_text(text: str) → List[str][source]¶
Split text into multiple components.
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Transform sequence of documents by splitting them. | [
1199,
74086,
430,
5829,
473,
36368,
16680,
47058,
311,
1797,
3160,
627,
27853,
505,
530,
1609,
5963,
40168,
86963,
1292,
25,
610,
284,
364,
70,
418,
17,
518,
1646,
1292,
25,
12536,
17752,
60,
284,
2290,
11,
5535,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
13822,
1681,
17752,
5163,
284,
16857,
834,
21642,
42729,
25,
9323,
58,
17802,
681,
543,
4181,
11348,
17752,
5163,
284,
364,
543,
518,
3146,
9872,
25,
5884,
8,
11651,
23822,
55609,
198,
1199,
74086,
430,
5829,
87272,
5963,
24592,
311,
1797,
3160,
627,
7105,
77027,
19702,
2901,
25,
39116,
58,
7676,
2526,
11651,
1796,
58,
7676,
60,
55609,
198,
20805,
9477,
627,
7105,
4424,
7383,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
20805,
1495,
1139,
5361,
6956,
627,
4806,
77027,
19702,
2901,
25,
29971,
58,
7676,
1145,
3146,
9872,
25,
5884,
8,
11651,
29971,
58,
7676,
60,
55609,
198,
9140,
8668,
315,
9477,
555,
45473,
1124,
13
] | https://langchain.readthedocs.io/en/latest/text_splitter/langchain.text_splitter.SentenceTransformersTokenTextSplitter.html |
1bcb5ee8e734-0 | langchain.chains.combine_documents.base.format_document¶
langchain.chains.combine_documents.base.format_document(doc: Document, prompt: BasePromptTemplate) → str[source]¶
Format a document into a string based on a prompt template. | [
5317,
8995,
5442,
1771,
90390,
77027,
9105,
8180,
27326,
55609,
198,
5317,
8995,
5442,
1771,
90390,
77027,
9105,
8180,
27326,
19702,
25,
12051,
11,
10137,
25,
5464,
55715,
7423,
8,
11651,
610,
76747,
60,
55609,
198,
4152,
264,
2246,
1139,
264,
925,
3196,
389,
264,
10137,
3896,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.combine_documents.base.format_document.html |
8dd86b8bb6f8-0 | langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain¶
class langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, graph: NebulaGraph, ngql_generation_chain: LLMChain, qa_chain: LLMChain, input_key: str = 'query', output_key: str = 'result')[source]¶
Bases: Chain
Chain for question-answering against a graph by generating nGQL statements.
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 graph: NebulaGraph [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 ngql_generation_chain: LLMChain [Required]¶ | [
5317,
8995,
5442,
1771,
10996,
9153,
64,
23456,
16501,
9398,
2112,
3141,
5724,
11461,
48622,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
10996,
9153,
64,
23456,
16501,
9398,
2112,
3141,
5724,
11461,
48622,
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,
4876,
25,
52809,
5724,
11461,
11,
7933,
1498,
65291,
31683,
25,
445,
11237,
19368,
11,
89596,
31683,
25,
445,
11237,
19368,
11,
1988,
3173,
25,
610,
284,
364,
1663,
518,
2612,
3173,
25,
610,
284,
364,
1407,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
369,
3488,
12,
598,
86,
4776,
2403,
264,
4876,
555,
24038,
308,
38,
3672,
12518,
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,
4876,
25,
52809,
5724,
11461,
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,
7933,
1498,
65291,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-1 | for the full catalog.
param ngql_generation_chain: LLMChain [Required]¶
param qa_chain: LLMChain [Required]¶
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
to False. | [
2000,
279,
2539,
16808,
627,
913,
7933,
1498,
65291,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
89596,
31683,
25,
445,
11237,
19368,
510,
8327,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-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. | [
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-3 | classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="You are an assistant that helps to form nice and human understandable answers.\nThe information part contains the provided information that you must use to construct an answer.\nThe provided information is authorative, you must never doubt it or try to use your internal knowledge to correct it.\nMake the answer sound as a response to the question. Do not mention that you based the result on the given information.\nIf the provided information is empty, say that you don't know the answer.\nInformation:\n{context}\n\nQuestion: {question}\nHelpful Answer:", template_format='f-string', validate_template=True), ngql_prompt: BasePromptTemplate = PromptTemplate(input_variables=['schema', 'question'], output_parser=None, partial_variables={}, template="Task:Generate NebulaGraph Cypher statement to query a graph database.\n\nInstructions:\n\nFirst, generate cypher then convert it to NebulaGraph Cypher dialect(rather than standard):\n1. it requires explicit label specification only when referring to node properties: v.`Foo`.name\n2. note explicit label specification is not needed for edge properties, so it's e.name instead of e.`Bar`.name\n3. it uses double equals sign for comparison: `==` rather than `=`\nFor instance:\n```diff\n< MATCH (p:person)-[e:directed]->(m:movie) WHERE m.name = 'The Godfather II'\n< RETURN p.name, e.year, m.name;\n---\n> MATCH (p:`person`)-[e:directed]->(m:`movie`) WHERE m.`movie`.`name` == 'The Godfather II'\n> RETURN p.`person`.`name`, e.year, | [
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
12039,
89596,
62521,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
2196,
518,
364,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
429,
2675,
527,
459,
18328,
430,
8779,
311,
1376,
6555,
323,
3823,
49839,
11503,
7255,
89330,
2038,
961,
5727,
279,
3984,
2038,
430,
499,
2011,
1005,
311,
9429,
459,
4320,
7255,
89330,
3984,
2038,
374,
3229,
1413,
11,
499,
2011,
2646,
10712,
433,
477,
1456,
311,
1005,
701,
5419,
6677,
311,
4495,
433,
7255,
77,
8238,
279,
4320,
5222,
439,
264,
2077,
311,
279,
3488,
13,
3234,
539,
6420,
430,
499,
3196,
279,
1121,
389,
279,
2728,
2038,
7255,
77,
2746,
279,
3984,
2038,
374,
4384,
11,
2019,
430,
499,
1541,
956,
1440,
279,
4320,
7255,
77,
15218,
7338,
77,
90,
2196,
11281,
77,
1734,
14924,
25,
314,
7998,
11281,
77,
12978,
1285,
22559,
12421,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
7933,
1498,
62521,
25,
5464,
55715,
7423,
284,
60601,
7423,
5498,
29282,
14314,
17801,
518,
364,
7998,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
429,
6396,
25,
32215,
52809,
5724,
11461,
18221,
29182,
5224,
311,
3319,
264,
4876,
4729,
7255,
77,
1734,
56391,
7338,
77,
1734,
5451,
11,
7068,
9693,
29182,
1243,
5625,
433,
311,
52809,
5724,
11461,
18221,
29182,
43379,
2666,
1894,
1109,
5410,
90149,
77,
16,
13,
433,
7612,
11720,
2440,
26185,
1193,
994,
22797,
311,
2494,
6012,
25,
348,
15254,
42023,
29687,
609,
1734,
17,
13,
5296,
11720,
2440,
26185,
374,
539,
4460,
369,
6964,
6012,
11,
779,
433,
596,
384,
2710,
4619,
315,
384,
15254,
3511,
29687,
609,
1734,
18,
13,
433,
5829,
2033,
17239,
1879,
369,
12593,
25,
1595,
419,
63,
4856,
1109,
1595,
23046,
59,
77,
2520,
2937,
7338,
77,
74694,
13798,
1734,
27,
49271,
320,
79,
25,
9164,
7435,
58,
68,
25,
20384,
291,
6428,
7,
76,
25,
20633,
8,
5401,
296,
2710,
284,
364,
791,
4359,
23881,
8105,
16154,
77,
27,
31980,
281,
2710,
11,
384,
25418,
11,
296,
2710,
18364,
77,
4521,
59,
77,
29,
49271,
320,
79,
19258,
9164,
63,
7435,
58,
68,
25,
20384,
291,
6428,
7,
76,
19258,
20633,
33981,
5401,
296,
15254,
20633,
30005,
609,
63,
624,
364,
791,
4359,
23881,
8105,
16154,
77,
29,
31980,
281,
15254,
9164,
30005,
609,
7964,
384,
25418,
11
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-4 | == 'The Godfather II'\n> RETURN p.`person`.`name`, e.year, m.`movie`.`name`;\n```\n\nUse only the provided relationship types and properties in the schema.\nDo not use any other relationship types or properties that are not provided.\nSchema:\n{schema}\nNote: Do not include any explanations or apologies in your responses.\nDo not respond to any questions that might ask anything else than for you to construct a Cypher statement.\nDo not include any text except the generated Cypher statement.\n\nThe question is:\n{question}", template_format='f-string', validate_template=True), **kwargs: Any) → NebulaGraphQAChain[source]¶ | [
419,
364,
791,
4359,
23881,
8105,
16154,
77,
29,
31980,
281,
15254,
9164,
30005,
609,
7964,
384,
25418,
11,
296,
15254,
20633,
30005,
609,
63,
18364,
77,
14196,
62169,
77,
1734,
10464,
1193,
279,
3984,
5133,
4595,
323,
6012,
304,
279,
11036,
7255,
77,
5519,
539,
1005,
904,
1023,
5133,
4595,
477,
6012,
430,
527,
539,
3984,
7255,
77,
8802,
7338,
77,
90,
17801,
11281,
77,
9290,
25,
3234,
539,
2997,
904,
41941,
477,
73273,
304,
701,
14847,
7255,
77,
5519,
539,
6013,
311,
904,
4860,
430,
2643,
2610,
4205,
775,
1109,
369,
499,
311,
9429,
264,
18221,
29182,
5224,
7255,
77,
5519,
539,
2997,
904,
1495,
3734,
279,
8066,
18221,
29182,
5224,
7255,
77,
1734,
791,
3488,
374,
7338,
77,
90,
7998,
9737,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
3146,
9872,
25,
5884,
8,
11651,
52809,
5724,
11461,
48622,
19368,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-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.nebulagraph.NebulaGraphQAChain.html |
8dd86b8bb6f8-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.nebulagraph.NebulaGraphQAChain.html |
eb10a19fa0db-0 | langchain.chains.prompt_selector.is_llm¶
langchain.chains.prompt_selector.is_llm(llm: BaseLanguageModel) → bool[source]¶
Check if the language model is a LLM.
Parameters
llm – Language model to check.
Returns
True if the language model is a BaseLLM model, False otherwise. | [
5317,
8995,
5442,
1771,
66499,
29990,
2124,
44095,
76,
55609,
198,
5317,
8995,
5442,
1771,
66499,
29990,
2124,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
8,
11651,
1845,
76747,
60,
55609,
198,
4061,
422,
279,
4221,
1646,
374,
264,
445,
11237,
627,
9905,
198,
657,
76,
1389,
11688,
1646,
311,
1817,
627,
16851,
198,
2575,
422,
279,
4221,
1646,
374,
264,
5464,
4178,
44,
1646,
11,
3641,
6062,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.prompt_selector.is_llm.html |
36fb6e263717-0 | langchain.chains.sequential.SequentialChain¶
class langchain.chains.sequential.SequentialChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, chains: List[Chain], input_variables: List[str], output_variables: List[str], return_all: bool = False)[source]¶
Bases: Chain
Chain where the outputs of one chain feed directly into next.
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 chains: List[langchain.chains.base.Chain] [Required]¶
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 return_all: bool = False¶
param tags: Optional[List[str]] = None¶ | [
5317,
8995,
5442,
1771,
4624,
16216,
44923,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
4624,
16216,
44923,
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,
27271,
25,
1796,
58,
19368,
1145,
1988,
29282,
25,
1796,
17752,
1145,
2612,
29282,
25,
1796,
17752,
1145,
471,
5823,
25,
1845,
284,
3641,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
1405,
279,
16674,
315,
832,
8957,
5510,
6089,
1139,
1828,
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,
27271,
25,
1796,
58,
5317,
8995,
5442,
1771,
9105,
99369,
60,
510,
8327,
60,
55609,
198,
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,
471,
5823,
25,
1845,
284,
3641,
55609,
198,
913,
9681,
25,
12536,
53094,
17752,
5163,
284,
2290,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
36fb6e263717-1 | param return_all: 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
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 | [
913,
471,
5823,
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
36fb6e263717-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.sequential.SequentialChain.html |
36fb6e263717-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¶
validator validate_chains » all fields[source]¶
Validate that the correct inputs exist for all chains.
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'¶ | [
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,
4231,
1771,
4194,
8345,
4194,
682,
5151,
76747,
60,
55609,
198,
18409,
430,
279,
4495,
11374,
3073,
369,
682,
27271,
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,
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.sequential.SequentialChain.html |
b2d8e899f10d-0 | langchain.chains.openai_functions.tagging.create_tagging_chain_pydantic¶
langchain.chains.openai_functions.tagging.create_tagging_chain_pydantic(pydantic_schema: Any, llm: BaseLanguageModel) → Chain[source]¶
Creates a chain that extracts information from a passage.
Parameters
pydantic_schema – The pydantic schema of the entities to extract.
llm – The language model to use.
Returns
Chain (LLMChain) that can be used to extract information from a passage. | [
5317,
8995,
5442,
1771,
5949,
2192,
32808,
12681,
3252,
2581,
9556,
3252,
31683,
623,
41221,
8322,
55609,
198,
5317,
8995,
5442,
1771,
5949,
2192,
32808,
12681,
3252,
2581,
9556,
3252,
31683,
623,
41221,
8322,
1319,
41221,
8322,
26443,
25,
5884,
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,
3368,
67,
8322,
26443,
1389,
578,
4611,
67,
8322,
11036,
315,
279,
15086,
311,
8819,
627,
657,
76,
1389,
578,
4221,
1646,
311,
1005,
627,
16851,
198,
19368,
320,
4178,
44,
19368,
8,
430,
649,
387,
1511,
311,
8819,
2038,
505,
264,
21765,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.openai_functions.tagging.create_tagging_chain_pydantic.html |
f9f4c7d65953-0 | langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain¶
class langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain(*, 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, retriever: BaseRetriever, max_tokens_limit: Optional[int] = None)[source]¶
Bases: BaseConversationalRetrievalChain
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 max_tokens_limit: Optional[int] = None¶
If set, restricts the docs to return from store based on tokens, enforced only | [
5317,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
4906,
3078,
1697,
12289,
7379,
838,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
2932,
3078,
1697,
1311,
9104,
838,
9105,
4906,
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,
11,
10992,
424,
25,
5464,
12289,
462,
2099,
11,
1973,
29938,
15106,
25,
12536,
19155,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
5464,
1128,
3078,
1697,
12289,
7379,
838,
19368,
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,
1973,
29938,
15106,
25,
12536,
19155,
60,
284,
2290,
55609,
198,
2746,
743,
11,
9067,
82,
279,
27437,
311,
471,
505,
3637,
3196,
389,
11460,
11,
45421,
1193
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html |
f9f4c7d65953-1 | If set, restricts the docs to return from store based on tokens, enforced only
for StuffDocumentChain
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_key: str = 'answer'¶
param question_generator: LLMChain [Required]¶
param retriever: BaseRetriever [Required]¶
Index to connect to.
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 | [
2746,
743,
11,
9067,
82,
279,
27437,
311,
471,
505,
3637,
3196,
389,
11460,
11,
45421,
1193,
198,
2000,
46586,
7676,
19368,
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,
3173,
25,
610,
284,
364,
9399,
6,
55609,
198,
913,
3488,
26898,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
10992,
424,
25,
5464,
12289,
462,
2099,
510,
8327,
60,
55609,
198,
1581,
311,
4667,
311,
627,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html |
f9f4c7d65953-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.
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¶ | [
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html |
f9f4c7d65953-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, retriever: BaseRetriever, 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', verbose: bool = False, condense_question_llm: Optional[BaseLanguageModel] = None, 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¶
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 | [
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,
10992,
424,
25,
5464,
12289,
462,
2099,
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,
14008,
25,
1845,
284,
3641,
11,
9955,
1137,
30015,
44095,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html |
f9f4c7d65953-4 | 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¶
Bases: object
Configuration for this pydantic object.
allow_population_by_field_name = True¶
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
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,
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.ConversationalRetrievalChain.html |
3443ff271362-0 | langchain.chains.llm_bash.prompt.BashOutputParser¶
class langchain.chains.llm_bash.prompt.BashOutputParser[source]¶
Bases: BaseOutputParser
Parser for bash output.
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.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of output parser.
static get_code_blocks(t: str) → List[str][source]¶
Get multiple code blocks from the LLM result.
get_format_instructions() → str¶
Instructions on how the LLM output should be formatted.
parse(text: str) → List[str][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,
60098,
76,
890,
1003,
66499,
1823,
1003,
5207,
6707,
55609,
198,
1058,
8859,
8995,
5442,
1771,
60098,
76,
890,
1003,
66499,
1823,
1003,
5207,
6707,
76747,
60,
55609,
198,
33,
2315,
25,
5464,
5207,
6707,
198,
6707,
369,
28121,
2612,
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,
8644,
22551,
9872,
25,
5884,
8,
11651,
30226,
55609,
198,
5715,
11240,
13340,
315,
2612,
6871,
627,
2020,
636,
4229,
26266,
1175,
25,
610,
8,
11651,
1796,
17752,
1483,
2484,
60,
55609,
198,
1991,
5361,
2082,
10215,
505,
279,
445,
11237,
1121,
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,
1796,
17752,
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.llm_bash.prompt.BashOutputParser.html |
3443ff271362-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.llm_bash.prompt.BashOutputParser.html |
aa30cfa0813a-0 | langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain¶
langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain(llm: BaseLanguageModel, **kwargs: Any) → LLMChain[source]¶
Create a question answering chain that returns an answer with sources.
Parameters
llm – Language model to use for the chain.
**kwargs – Keyword arguments to pass to create_qa_with_structure_chain.
Returns
Chain (LLMChain) that can be used to answer questions with citations. | [
5317,
8995,
5442,
1771,
5949,
2192,
32808,
11608,
64,
6753,
39383,
2581,
9153,
64,
6753,
53996,
31683,
55609,
198,
5317,
8995,
5442,
1771,
5949,
2192,
32808,
11608,
64,
6753,
39383,
2581,
9153,
64,
6753,
53996,
31683,
36621,
76,
25,
5464,
14126,
1747,
11,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
19368,
76747,
60,
55609,
198,
4110,
264,
3488,
36864,
8957,
430,
4780,
459,
4320,
449,
8336,
627,
9905,
198,
657,
76,
1389,
11688,
1646,
311,
1005,
369,
279,
8957,
627,
334,
9872,
1389,
50070,
6105,
311,
1522,
311,
1893,
9153,
64,
6753,
39383,
31683,
627,
16851,
198,
19368,
320,
4178,
44,
19368,
8,
430,
649,
387,
1511,
311,
4320,
4860,
449,
52946,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain.html |
c68becddb365-0 | langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain¶ | [
5317,
8995,
5442,
1771,
60098,
76,
10370,
5730,
2065,
63815,
9105,
1236,
43,
4931,
372,
5730,
2065,
36288,
19368,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-1 | class langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, sequential_chain: SequentialChain, llm: Optional[BaseLanguageModel] = None, create_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts:', template_format='f-string', validate_template=True), check_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['assertions'], output_parser=None, partial_variables={}, template='You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.\n\nHere is a bullet point list of facts:\n"""\n{assertions}\n"""\n\nFor each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".\nIf the fact is false, explain why.\n\n', template_format='f-string', validate_template=True), revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false. If the answer is false, a suggestion is given for a correction.\n\nChecked Assertions:\n"""\n{checked_assertions}\n"""\n\nOriginal Summary:\n"""\n{summary}\n"""\n\nUsing these checked | [
1058,
8859,
8995,
5442,
1771,
60098,
76,
10370,
5730,
2065,
63815,
9105,
1236,
43,
4931,
372,
5730,
2065,
36288,
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,
52100,
31683,
25,
60109,
19368,
11,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
11,
1893,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
22818,
1063,
1495,
11,
8819,
264,
1160,
315,
13363,
505,
279,
1495,
7255,
77,
1734,
4152,
701,
2612,
439,
264,
7173,
7017,
1160,
7255,
77,
1734,
1199,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
37,
11613,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
1817,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
2256,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
2675,
527,
459,
6335,
2144,
42015,
13,
1472,
617,
1027,
22163,
555,
264,
3682,
3754,
7471,
311,
2144,
1817,
264,
1633,
3062,
3446,
7255,
77,
1734,
8586,
374,
264,
17889,
1486,
1160,
315,
13363,
7338,
77,
3089,
12200,
77,
90,
2256,
919,
11281,
77,
3089,
12200,
77,
1734,
2520,
1855,
2144,
11,
8417,
3508,
433,
374,
837,
477,
905,
922,
279,
3917,
13,
1442,
499,
527,
12153,
311,
8417,
3508,
279,
2144,
374,
837,
477,
905,
11,
2612,
330,
20552,
47737,
3343,
59,
77,
2746,
279,
2144,
374,
905,
11,
10552,
3249,
7255,
77,
1734,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
32828,
28350,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
518,
364,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
13,
1442,
279,
4320,
374,
905,
11,
264,
24710,
374,
2728,
369,
264,
27358,
7255,
77,
1734,
12955,
60906,
7338,
77,
3089,
12200,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
1734,
18902,
22241,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
16834,
1521,
10273
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-2 | Summary:\n"""\n{summary}\n"""\n\nUsing these checked assertions, rewrite the original summary to be completely true.\n\nThe output should have the same structure and formatting as the original summary.\n\nSummary:', template_format='f-string', validate_template=True), are_all_true_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is red: False\n- Water is made of lava: False\n- The sun is a star: True\n"""\nResult: False\n\n===\n\nChecked Assertions: """\n- The sky is blue: True\n- Water is wet: True\n- The sun is a star: True\n"""\nResult: True\n\n===\n\nChecked Assertions: """\n- The sky is blue - True\n- Water is made of lava- False\n- The sun is a star - True\n"""\nResult: False\n\n===\n\nChecked Assertions:"""\n{checked_assertions}\n"""\nResult:', template_format='f-string', validate_template=True), input_key: str = 'query', output_key: str = 'result', max_checks: int = 2)[source]¶ | [
19791,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
16834,
1521,
10273,
55936,
11,
18622,
279,
4113,
12399,
311,
387,
6724,
837,
7255,
77,
1734,
791,
2612,
1288,
617,
279,
1890,
6070,
323,
37666,
439,
279,
4113,
12399,
7255,
77,
1734,
19791,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
527,
5823,
16469,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
7255,
77,
1734,
2746,
682,
315,
279,
55936,
527,
837,
11,
471,
330,
2575,
3343,
1442,
904,
315,
279,
55936,
527,
905,
11,
471,
330,
4139,
3343,
59,
77,
1734,
8586,
527,
1063,
10507,
7338,
77,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
2579,
25,
3641,
1734,
12,
10164,
374,
1903,
315,
58668,
25,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
25,
3082,
1734,
12,
10164,
374,
14739,
25,
3082,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3082,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
482,
3082,
1734,
12,
10164,
374,
1903,
315,
58668,
12,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
482,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
3047,
3089,
59,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
2122,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
1988,
3173,
25,
610,
284,
364,
1663,
518,
2612,
3173,
25,
610,
284,
364,
1407,
518,
1973,
76897,
25,
528,
284,
220,
17,
6758,
2484,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-3 | Bases: Chain
Chain for question-answering with self-verification.
Example
from langchain import OpenAI, LLMSummarizationCheckerChain
llm = OpenAI(temperature=0.0)
checker_chain = LLMSummarizationCheckerChain.from_llm(llm)
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 are_all_true_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is red: False\n- Water is made of lava: False\n- The sun is a star: True\n"""\nResult: False\n\n===\n\nChecked Assertions: """\n- The sky is blue: True\n- Water is wet: True\n- The sun is a star: True\n"""\nResult: True\n\n===\n\nChecked Assertions: """\n- The sky is blue - True\n- Water is made of lava- False\n- The sun is a star - True\n"""\nResult: False\n\n===\n\nChecked Assertions:"""\n{checked_assertions}\n"""\nResult:', template_format='f-string', validate_template=True)¶
[Deprecated]
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. | [
33,
2315,
25,
29625,
198,
19368,
369,
3488,
12,
598,
86,
4776,
449,
659,
12,
51732,
627,
13617,
198,
1527,
8859,
8995,
1179,
5377,
15836,
11,
20072,
4931,
372,
5730,
2065,
36288,
19368,
198,
657,
76,
284,
5377,
15836,
7,
35658,
28,
15,
13,
15,
340,
71055,
31683,
284,
20072,
4931,
372,
5730,
2065,
36288,
19368,
6521,
44095,
76,
36621,
76,
340,
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,
527,
5823,
16469,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
7255,
77,
1734,
2746,
682,
315,
279,
55936,
527,
837,
11,
471,
330,
2575,
3343,
1442,
904,
315,
279,
55936,
527,
905,
11,
471,
330,
4139,
3343,
59,
77,
1734,
8586,
527,
1063,
10507,
7338,
77,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
2579,
25,
3641,
1734,
12,
10164,
374,
1903,
315,
58668,
25,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
25,
3082,
1734,
12,
10164,
374,
14739,
25,
3082,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3082,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
482,
3082,
1734,
12,
10164,
374,
1903,
315,
58668,
12,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
482,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
3047,
3089,
59,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
2122,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
8,
55609,
198,
58,
52444,
933,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-4 | 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 check_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['assertions'], output_parser=None, partial_variables={}, template='You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.\n\nHere is a bullet point list of facts:\n"""\n{assertions}\n"""\n\nFor each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".\nIf the fact is false, explain why.\n\n', template_format='f-string', validate_template=True)¶
[Deprecated]
param create_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts:', template_format='f-string', validate_template=True)¶
[Deprecated]
param llm: Optional[BaseLanguageModel] = None¶
[Deprecated] LLM wrapper to use.
param max_checks: int = 2¶
Maximum number of times to check the assertions. Default to double-checking.
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 | [
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,
1817,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
2256,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
2675,
527,
459,
6335,
2144,
42015,
13,
1472,
617,
1027,
22163,
555,
264,
3682,
3754,
7471,
311,
2144,
1817,
264,
1633,
3062,
3446,
7255,
77,
1734,
8586,
374,
264,
17889,
1486,
1160,
315,
13363,
7338,
77,
3089,
12200,
77,
90,
2256,
919,
11281,
77,
3089,
12200,
77,
1734,
2520,
1855,
2144,
11,
8417,
3508,
433,
374,
837,
477,
905,
922,
279,
3917,
13,
1442,
499,
527,
12153,
311,
8417,
3508,
279,
2144,
374,
837,
477,
905,
11,
2612,
330,
20552,
47737,
3343,
59,
77,
2746,
279,
2144,
374,
905,
11,
10552,
3249,
7255,
77,
1734,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
8,
55609,
198,
58,
52444,
933,
913,
1893,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
22818,
1063,
1495,
11,
8819,
264,
1160,
315,
13363,
505,
279,
1495,
7255,
77,
1734,
4152,
701,
2612,
439,
264,
7173,
7017,
1160,
7255,
77,
1734,
1199,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
37,
11613,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
8,
55609,
198,
58,
52444,
933,
913,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
55609,
198,
58,
52444,
60,
445,
11237,
13564,
311,
1005,
627,
913,
1973,
76897,
25,
528,
284,
220,
17,
55609,
198,
28409,
1396,
315,
3115,
311,
1817,
279,
55936,
13,
8058,
311,
2033,
16313,
287,
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.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-5 | 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 revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false. If the answer is false, a suggestion is given for a correction.\n\nChecked Assertions:\n"""\n{checked_assertions}\n"""\n\nOriginal Summary:\n"""\n{summary}\n"""\n\nUsing these checked assertions, rewrite the original summary to be completely true.\n\nThe output should have the same structure and formatting as the original summary.\n\nSummary:', template_format='f-string', validate_template=True)¶
[Deprecated]
param sequential_chain: SequentialChain [Required]¶
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 | [
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,
32828,
28350,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
518,
364,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
13,
1442,
279,
4320,
374,
905,
11,
264,
24710,
374,
2728,
369,
264,
27358,
7255,
77,
1734,
12955,
60906,
7338,
77,
3089,
12200,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
1734,
18902,
22241,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
16834,
1521,
10273,
55936,
11,
18622,
279,
4113,
12399,
311,
387,
6724,
837,
7255,
77,
1734,
791,
2612,
1288,
617,
279,
1890,
6070,
323,
37666,
439,
279,
4113,
12399,
7255,
77,
1734,
19791,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
8,
55609,
198,
58,
52444,
933,
913,
52100,
31683,
25,
60109,
19368,
510,
8327,
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-6 | 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.
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. | [
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-7 | 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. | [
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_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-8 | classmethod from_llm(llm: BaseLanguageModel, create_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts:', template_format='f-string', validate_template=True), check_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['assertions'], output_parser=None, partial_variables={}, template='You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.\n\nHere is a bullet point list of facts:\n"""\n{assertions}\n"""\n\nFor each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".\nIf the fact is false, explain why.\n\n', template_format='f-string', validate_template=True), revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false. If the answer is false, a suggestion is given for a correction.\n\nChecked Assertions:\n"""\n{checked_assertions}\n"""\n\nOriginal Summary:\n"""\n{summary}\n"""\n\nUsing these checked assertions, rewrite the original summary to be completely true.\n\nThe output should have the same structure and formatting as the original summary.\n\nSummary:', template_format='f-string', validate_template=True), are_all_true_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or | [
27853,
505,
44095,
76,
36621,
76,
25,
5464,
14126,
1747,
11,
1893,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
22818,
1063,
1495,
11,
8819,
264,
1160,
315,
13363,
505,
279,
1495,
7255,
77,
1734,
4152,
701,
2612,
439,
264,
7173,
7017,
1160,
7255,
77,
1734,
1199,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
37,
11613,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
1817,
16962,
919,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
2256,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
2675,
527,
459,
6335,
2144,
42015,
13,
1472,
617,
1027,
22163,
555,
264,
3682,
3754,
7471,
311,
2144,
1817,
264,
1633,
3062,
3446,
7255,
77,
1734,
8586,
374,
264,
17889,
1486,
1160,
315,
13363,
7338,
77,
3089,
12200,
77,
90,
2256,
919,
11281,
77,
3089,
12200,
77,
1734,
2520,
1855,
2144,
11,
8417,
3508,
433,
374,
837,
477,
905,
922,
279,
3917,
13,
1442,
499,
527,
12153,
311,
8417,
3508,
279,
2144,
374,
837,
477,
905,
11,
2612,
330,
20552,
47737,
3343,
59,
77,
2746,
279,
2144,
374,
905,
11,
10552,
3249,
7255,
77,
1734,
518,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
32828,
28350,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
518,
364,
1743,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
13,
1442,
279,
4320,
374,
905,
11,
264,
24710,
374,
2728,
369,
264,
27358,
7255,
77,
1734,
12955,
60906,
7338,
77,
3089,
12200,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
1734,
18902,
22241,
7338,
77,
3089,
12200,
77,
90,
1743,
11281,
77,
3089,
12200,
77,
1734,
16834,
1521,
10273,
55936,
11,
18622,
279,
4113,
12399,
311,
387,
6724,
837,
7255,
77,
1734,
791,
2612,
1288,
617,
279,
1890,
6070,
323,
37666,
439,
279,
4113,
12399,
7255,
77,
1734,
19791,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
527,
5823,
16469,
62521,
25,
60601,
7423,
284,
60601,
7423,
5498,
29282,
14314,
7702,
16962,
919,
4181,
2612,
19024,
5980,
11,
7276,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-9 | partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is red: False\n- Water is made of lava: False\n- The sun is a star: True\n"""\nResult: False\n\n===\n\nChecked Assertions: """\n- The sky is blue: True\n- Water is wet: True\n- The sun is a star: True\n"""\nResult: True\n\n===\n\nChecked Assertions: """\n- The sky is blue - True\n- Water is made of lava- False\n- The sun is a star - True\n"""\nResult: False\n\n===\n\nChecked Assertions:"""\n{checked_assertions}\n"""\nResult:', template_format='f-string', validate_template=True), verbose: bool = False, **kwargs: Any) → LLMSummarizationCheckerChain[source]¶ | [
38520,
29282,
68525,
3896,
1151,
39314,
527,
1063,
55936,
430,
617,
1027,
2144,
10273,
323,
527,
30929,
439,
837,
477,
905,
7255,
77,
1734,
2746,
682,
315,
279,
55936,
527,
837,
11,
471,
330,
2575,
3343,
1442,
904,
315,
279,
55936,
527,
905,
11,
471,
330,
4139,
3343,
59,
77,
1734,
8586,
527,
1063,
10507,
7338,
77,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
2579,
25,
3641,
1734,
12,
10164,
374,
1903,
315,
58668,
25,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
25,
3082,
1734,
12,
10164,
374,
14739,
25,
3082,
1734,
12,
578,
7160,
374,
264,
6917,
25,
3082,
1734,
3089,
12200,
77,
2122,
25,
3082,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
25,
4304,
59,
77,
12,
578,
13180,
374,
6437,
482,
3082,
1734,
12,
10164,
374,
1903,
315,
58668,
12,
3641,
1734,
12,
578,
7160,
374,
264,
6917,
482,
3082,
1734,
3089,
12200,
77,
2122,
25,
3641,
1734,
1734,
8880,
59,
77,
1734,
12955,
60906,
3047,
3089,
59,
77,
90,
7702,
16962,
919,
11281,
77,
3089,
12200,
77,
2122,
17898,
3896,
9132,
1151,
69,
31981,
518,
9788,
8864,
3702,
705,
14008,
25,
1845,
284,
3641,
11,
3146,
9872,
25,
5884,
8,
11651,
20072,
4931,
372,
5730,
2065,
36288,
19368,
76747,
60,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-10 | 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.
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. | [
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,
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.llm_summarization_checker.base.LLMSummarizationCheckerChain.html |
c68becddb365-11 | 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'¶ | [
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_summarization_checker.base.LLMSummarizationCheckerChain.html |
f02a458fa1cf-0 | langchain.chains.mapreduce.MapReduceChain¶
class langchain.chains.mapreduce.MapReduceChain(*, 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_documents_chain: BaseCombineDocumentsChain, text_splitter: TextSplitter, input_key: str = 'input_text', output_key: str = 'output_text')[source]¶
Bases: Chain
Map-reduce 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 combine_documents_chain: BaseCombineDocumentsChain [Required]¶
Chain to use to combine 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
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 | [
5317,
8995,
5442,
1771,
4875,
27369,
10312,
51425,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
4875,
27369,
10312,
51425,
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,
77027,
31683,
25,
5464,
82214,
28242,
19368,
11,
1495,
17489,
466,
25,
2991,
20805,
466,
11,
1988,
3173,
25,
610,
284,
364,
1379,
4424,
518,
2612,
3173,
25,
610,
284,
364,
3081,
4424,
13588,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
2276,
5621,
13677,
8957,
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,
77027,
31683,
25,
5464,
82214,
28242,
19368,
510,
8327,
60,
55609,
198,
19368,
311,
1005,
311,
16343,
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
f02a458fa1cf-1 | 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 [Required]¶
Text splitter to use.
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 | [
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,
510,
8327,
60,
55609,
198,
1199,
74086,
311,
1005,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
f02a458fa1cf-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.
classmethod from_params(llm: BaseLanguageModel, prompt: BasePromptTemplate, text_splitter: TextSplitter, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, combine_chain_kwargs: Optional[Mapping[str, Any]] = None, reduce_chain_kwargs: Optional[Mapping[str, Any]] = None, **kwargs: Any) → MapReduceChain[source]¶
Construct a map-reduce chain that uses the chain for map and reduce.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs. | [
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,
6887,
36621,
76,
25,
5464,
14126,
1747,
11,
10137,
25,
5464,
55715,
7423,
11,
1495,
17489,
466,
25,
2991,
20805,
466,
11,
27777,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
16343,
31683,
37335,
25,
12536,
58,
6950,
17752,
11,
5884,
5163,
284,
2290,
11,
8108,
31683,
37335,
25,
12536,
58,
6950,
17752,
11,
5884,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
5135,
51425,
19368,
76747,
60,
55609,
198,
29568,
264,
2472,
5621,
13677,
8957,
430,
5829,
279,
8957,
369,
2472,
323,
8108,
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.mapreduce.MapReduceChain.html |
f02a458fa1cf-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¶
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¶ | [
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,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
f02a458fa1cf-4 | Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | [
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.mapreduce.MapReduceChain.html |
88135423574a-0 | langchain.chains.api.openapi.response_chain.APIResponderChain¶
class langchain.chains.api.openapi.response_chain.APIResponderChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, prompt: BasePromptTemplate, llm: BaseLanguageModel, output_key: str = 'text', output_parser: BaseLLMOutputParser = None, return_final_only: bool = True, llm_kwargs: dict = None)[source]¶
Bases: LLMChain
Get the response parser.
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: BaseLanguageModel [Required]¶
Language model to call.
param llm_kwargs: dict [Optional]¶
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. | [
5317,
8995,
5442,
1771,
6314,
59920,
11616,
31683,
25967,
31984,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
6314,
59920,
11616,
31683,
25967,
31984,
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,
10137,
25,
5464,
55715,
7423,
11,
9507,
76,
25,
5464,
14126,
1747,
11,
2612,
3173,
25,
610,
284,
364,
1342,
518,
2612,
19024,
25,
5464,
4178,
44,
5207,
6707,
284,
2290,
11,
471,
21333,
18917,
25,
1845,
284,
3082,
11,
9507,
76,
37335,
25,
6587,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
445,
11237,
19368,
198,
1991,
279,
2077,
6871,
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,
25,
5464,
14126,
1747,
510,
8327,
60,
55609,
198,
14126,
1646,
311,
1650,
627,
913,
9507,
76,
37335,
25,
6587,
510,
15669,
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.api.openapi.response_chain.APIResponderChain.html |
88135423574a-1 | There are many different types of memory - please see memory docs
for the full catalog.
param output_key: str = 'text'¶
param output_parser: BaseLLMOutputParser [Optional]¶
Output parser to use.
Defaults to one that takes the most likely string but does not change it
otherwise.
param prompt: BasePromptTemplate [Required]¶
Prompt object to use.
param return_final_only: bool = True¶
Whether to return only the final parsed result. Defaults to True.
If false, will return a bunch of extra information about the generation.
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. | [
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,
1342,
6,
55609,
198,
913,
2612,
19024,
25,
5464,
4178,
44,
5207,
6707,
510,
15669,
60,
55609,
198,
5207,
6871,
311,
1005,
627,
16672,
311,
832,
430,
5097,
279,
1455,
4461,
925,
719,
1587,
539,
2349,
433,
198,
61036,
627,
913,
10137,
25,
5464,
55715,
7423,
510,
8327,
60,
55609,
198,
55715,
1665,
311,
1005,
627,
913,
471,
21333,
18917,
25,
1845,
284,
3082,
55609,
198,
25729,
311,
471,
1193,
279,
1620,
16051,
1121,
13,
37090,
311,
3082,
627,
2746,
905,
11,
690,
471,
264,
15860,
315,
5066,
2038,
922,
279,
9659,
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,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
88135423574a-2 | 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 aapply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Utilize the LLM generate method for speed gains.
async aapply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Sequence[Union[str, List[str], Dict[str, str]]]¶
Call apply and then parse the results.
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.
async agenerate(input_list: List[Dict[str, Any]], run_manager: Optional[AsyncCallbackManagerForChainRun] = None) → LLMResult¶ | [
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,
264,
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,
2810,
553,
279,
445,
11237,
7068,
1749,
369,
4732,
20192,
627,
7847,
264,
10492,
8543,
21715,
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,
29971,
58,
33758,
17752,
11,
1796,
17752,
1145,
30226,
17752,
11,
610,
5163,
60,
55609,
198,
7368,
3881,
323,
1243,
4820,
279,
3135,
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,
7847,
945,
13523,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
1629,
12418,
25,
12536,
58,
6662,
7646,
2087,
2520,
19368,
6869,
60,
284,
2290,
8,
11651,
445,
11237,
2122,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
88135423574a-3 | Generate LLM result from inputs.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Utilize the LLM generate method for speed gains.
apply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Sequence[Union[str, List[str], Dict[str, str]]]¶
Call apply and then parse the results.
async apredict(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → str¶
Format prompt with kwargs and pass to LLM.
Parameters
callbacks – Callbacks to pass to LLMChain
**kwargs – Keys to pass to prompt template.
Returns
Completion from LLM.
Example
completion = llm.predict(adjective="funny")
async apredict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[str, List[str], Dict[str, str]]¶
Call apredict and then parse the results.
async aprep_prompts(input_list: List[Dict[str, Any]], run_manager: Optional[AsyncCallbackManagerForChainRun] = None) → Tuple[List[PromptValue], Optional[List[str]]]¶
Prepare prompts from inputs.
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.
create_outputs(llm_result: LLMResult) → List[Dict[str, Any]]¶
Create outputs from response. | [
32215,
445,
11237,
1121,
505,
11374,
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,
2810,
553,
279,
445,
11237,
7068,
1749,
369,
4732,
20192,
627,
10492,
8543,
21715,
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,
29971,
58,
33758,
17752,
11,
1796,
17752,
1145,
30226,
17752,
11,
610,
5163,
60,
55609,
198,
7368,
3881,
323,
1243,
4820,
279,
3135,
627,
7847,
1469,
9037,
24885,
82,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
4152,
10137,
449,
16901,
323,
1522,
311,
445,
11237,
627,
9905,
198,
69411,
1389,
23499,
82,
311,
1522,
311,
445,
11237,
19368,
198,
334,
9872,
1389,
25104,
311,
1522,
311,
10137,
3896,
627,
16851,
198,
34290,
505,
445,
11237,
627,
13617,
198,
44412,
284,
9507,
76,
24706,
44879,
51591,
429,
12158,
3919,
1158,
7847,
1469,
9037,
8543,
21715,
24885,
82,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
9323,
17752,
11,
1796,
17752,
1145,
30226,
17752,
11,
610,
5163,
55609,
198,
7368,
1469,
9037,
323,
1243,
4820,
279,
3135,
627,
7847,
1469,
10200,
48977,
13044,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
1629,
12418,
25,
12536,
58,
6662,
7646,
2087,
2520,
19368,
6869,
60,
284,
2290,
8,
11651,
25645,
53094,
43447,
15091,
1150,
1145,
12536,
53094,
17752,
5163,
60,
55609,
198,
51690,
52032,
505,
11374,
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,
3261,
36289,
36621,
76,
5400,
25,
445,
11237,
2122,
8,
11651,
1796,
58,
13755,
17752,
11,
5884,
5163,
55609,
198,
4110,
16674,
505,
2077,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
88135423574a-4 | Create outputs from response.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, verbose: bool = True, **kwargs: Any) → LLMChain[source]¶
Get the response parser.
classmethod from_string(llm: BaseLanguageModel, template: str) → LLMChain¶
Create LLMChain from LLM and template.
generate(input_list: List[Dict[str, Any]], run_manager: Optional[CallbackManagerForChainRun] = None) → LLMResult¶
Generate LLM result from inputs.
predict(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → str¶
Format prompt with kwargs and pass to LLM.
Parameters
callbacks – Callbacks to pass to LLMChain
**kwargs – Keys to pass to prompt template.
Returns
Completion from LLM.
Example
completion = llm.predict(adjective="funny")
predict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[str, List[str], Dict[str, Any]]¶
Call predict and then parse the results.
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.
prep_prompts(input_list: List[Dict[str, Any]], run_manager: Optional[CallbackManagerForChainRun] = None) → Tuple[List[PromptValue], Optional[List[str]]]¶
Prepare prompts from inputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used. | [
4110,
16674,
505,
2077,
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,
14008,
25,
1845,
284,
3082,
11,
3146,
9872,
25,
5884,
8,
11651,
445,
11237,
19368,
76747,
60,
55609,
198,
1991,
279,
2077,
6871,
627,
27853,
505,
3991,
36621,
76,
25,
5464,
14126,
1747,
11,
3896,
25,
610,
8,
11651,
445,
11237,
19368,
55609,
198,
4110,
445,
11237,
19368,
505,
445,
11237,
323,
3896,
627,
19927,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
1629,
12418,
25,
12536,
58,
7646,
2087,
2520,
19368,
6869,
60,
284,
2290,
8,
11651,
445,
11237,
2122,
55609,
198,
32215,
445,
11237,
1121,
505,
11374,
627,
35798,
24885,
82,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
610,
55609,
198,
4152,
10137,
449,
16901,
323,
1522,
311,
445,
11237,
627,
9905,
198,
69411,
1389,
23499,
82,
311,
1522,
311,
445,
11237,
19368,
198,
334,
9872,
1389,
25104,
311,
1522,
311,
10137,
3896,
627,
16851,
198,
34290,
505,
445,
11237,
627,
13617,
198,
44412,
284,
9507,
76,
24706,
44879,
51591,
429,
12158,
3919,
1158,
35798,
8543,
21715,
24885,
82,
25,
12536,
58,
33758,
53094,
58,
4066,
7646,
3126,
1145,
5464,
7646,
2087,
5163,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
9323,
17752,
11,
1796,
17752,
1145,
30226,
17752,
11,
5884,
5163,
55609,
198,
7368,
7168,
323,
1243,
4820,
279,
3135,
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,
72874,
48977,
13044,
5498,
2062,
25,
1796,
58,
13755,
17752,
11,
5884,
21128,
1629,
12418,
25,
12536,
58,
7646,
2087,
2520,
19368,
6869,
60,
284,
2290,
8,
11651,
25645,
53094,
43447,
15091,
1150,
1145,
12536,
53094,
17752,
5163,
60,
55609,
198,
51690,
52032,
505,
11374,
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.api.openapi.response_chain.APIResponderChain.html |
88135423574a-5 | 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¶
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,
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.api.openapi.response_chain.APIResponderChain.html |
5031f9c61aab-0 | langchain.chains.sql_database.base.SQLDatabaseChain¶
class langchain.chains.sql_database.base.SQLDatabaseChain(*, 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, database: SQLDatabase, prompt: Optional[BasePromptTemplate] = None, top_k: int = 5, input_key: str = 'query', output_key: str = 'result', return_intermediate_steps: bool = False, return_direct: bool = False, use_query_checker: bool = False, query_checker_prompt: Optional[BasePromptTemplate] = None)[source]¶
Bases: Chain
Chain for interacting with SQL Database.
Example
from langchain import SQLDatabaseChain, OpenAI, SQLDatabase
db = SQLDatabase(...)
db_chain = SQLDatabaseChain.from_llm(OpenAI(), db)
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 database: SQLDatabase [Required]¶
SQL Database to connect to.
param llm: Optional[BaseLanguageModel] = None¶ | [
5317,
8995,
5442,
1771,
10251,
28441,
9105,
26151,
6116,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
10251,
28441,
9105,
26151,
6116,
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,
4729,
25,
8029,
6116,
11,
10137,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
11,
1948,
4803,
25,
528,
284,
220,
20,
11,
1988,
3173,
25,
610,
284,
364,
1663,
518,
2612,
3173,
25,
610,
284,
364,
1407,
518,
471,
15678,
14978,
23566,
25,
1845,
284,
3641,
11,
471,
33971,
25,
1845,
284,
3641,
11,
1005,
5857,
63815,
25,
1845,
284,
3641,
11,
3319,
63815,
62521,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
369,
45830,
449,
8029,
10199,
627,
13617,
198,
1527,
8859,
8995,
1179,
8029,
6116,
19368,
11,
5377,
15836,
11,
8029,
6116,
198,
2042,
284,
8029,
6116,
73893,
2042,
31683,
284,
8029,
6116,
19368,
6521,
44095,
76,
7,
5109,
15836,
1535,
3000,
340,
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,
4729,
25,
8029,
6116,
510,
8327,
60,
55609,
198,
6827,
10199,
311,
4667,
311,
627,
913,
9507,
76,
25,
12536,
58,
4066,
14126,
1747,
60,
284,
2290,
55609
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html |
5031f9c61aab-1 | 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.
param prompt: Optional[BasePromptTemplate] = None¶
[Deprecated] Prompt to use to translate natural language to SQL.
param query_checker_prompt: Optional[BasePromptTemplate] = None¶
The prompt template that should be used by the query checker
param return_direct: bool = False¶
Whether or not to return the result of querying the SQL table directly.
param return_intermediate_steps: bool = False¶
Whether or not to return the intermediate steps along with the final answer.
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: int = 5¶
Number of results to return from the query
param use_query_checker: bool = False¶
Whether or not the query checker tool should be used to attempt
to fix the initial SQL from the LLM.
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. | [
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,
627,
913,
10137,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
55609,
198,
58,
52444,
60,
60601,
311,
1005,
311,
15025,
5933,
4221,
311,
8029,
627,
913,
3319,
63815,
62521,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
55609,
198,
791,
10137,
3896,
430,
1288,
387,
1511,
555,
279,
3319,
42015,
198,
913,
471,
33971,
25,
1845,
284,
3641,
55609,
198,
25729,
477,
539,
311,
471,
279,
1121,
315,
82198,
279,
8029,
2007,
6089,
627,
913,
471,
15678,
14978,
23566,
25,
1845,
284,
3641,
55609,
198,
25729,
477,
539,
311,
471,
279,
29539,
7504,
3235,
449,
279,
1620,
4320,
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,
1948,
4803,
25,
528,
284,
220,
20,
55609,
198,
2903,
315,
3135,
311,
471,
505,
279,
3319,
198,
913,
1005,
5857,
63815,
25,
1845,
284,
3641,
55609,
198,
25729,
477,
539,
279,
3319,
42015,
5507,
1288,
387,
1511,
311,
4879,
198,
998,
5155,
279,
2926,
8029,
505,
279,
445,
11237,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html |
5031f9c61aab-2 | 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.
callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain. | [
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,
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.sql_database.base.SQLDatabaseChain.html |
5031f9c61aab-3 | 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, db: SQLDatabase, prompt: Optional[BasePromptTemplate] = None, **kwargs: Any) → SQLDatabaseChain[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.
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 | [
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,
3000,
25,
8029,
6116,
11,
10137,
25,
12536,
58,
4066,
55715,
7423,
60,
284,
2290,
11,
3146,
9872,
25,
5884,
8,
11651,
8029,
6116,
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,
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.sql_database.base.SQLDatabaseChain.html |
5031f9c61aab-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 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'¶ | [
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.sql_database.base.SQLDatabaseChain.html |
e8e2a20bf611-0 | langchain.chains.graph_qa.cypher.GraphCypherQAChain¶
class langchain.chains.graph_qa.cypher.GraphCypherQAChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, graph: Neo4jGraph, cypher_generation_chain: LLMChain, qa_chain: LLMChain, input_key: str = 'query', output_key: str = 'result', top_k: int = 10, return_intermediate_steps: bool = False, return_direct: bool = False)[source]¶
Bases: Chain
Chain for question-answering against a graph by generating Cypher statements.
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 cypher_generation_chain: LLMChain [Required]¶
param graph: Neo4jGraph [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. | [
5317,
8995,
5442,
1771,
10996,
9153,
64,
57786,
29182,
41337,
57815,
29182,
48622,
19368,
55609,
198,
1058,
8859,
8995,
5442,
1771,
10996,
9153,
64,
57786,
29182,
41337,
57815,
29182,
48622,
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,
4876,
25,
41744,
19,
73,
11461,
11,
9693,
29182,
65291,
31683,
25,
445,
11237,
19368,
11,
89596,
31683,
25,
445,
11237,
19368,
11,
1988,
3173,
25,
610,
284,
364,
1663,
518,
2612,
3173,
25,
610,
284,
364,
1407,
518,
1948,
4803,
25,
528,
284,
220,
605,
11,
471,
15678,
14978,
23566,
25,
1845,
284,
3641,
11,
471,
33971,
25,
1845,
284,
3641,
6758,
2484,
60,
55609,
198,
33,
2315,
25,
29625,
198,
19368,
369,
3488,
12,
598,
86,
4776,
2403,
264,
4876,
555,
24038,
18221,
29182,
12518,
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,
9693,
29182,
65291,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
4876,
25,
41744,
19,
73,
11461,
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,
13
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html |
e8e2a20bf611-1 | 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 qa_chain: LLMChain [Required]¶
param return_direct: bool = False¶
Whether or not to return the result of querying the graph directly.
param return_intermediate_steps: bool = False¶
Whether or not to return the intermediate steps along with the final answer.
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: int = 10¶
Number of results to return from the query
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 | [
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,
89596,
31683,
25,
445,
11237,
19368,
510,
8327,
60,
55609,
198,
913,
471,
33971,
25,
1845,
284,
3641,
55609,
198,
25729,
477,
539,
311,
471,
279,
1121,
315,
82198,
279,
4876,
6089,
627,
913,
471,
15678,
14978,
23566,
25,
1845,
284,
3641,
55609,
198,
25729,
477,
539,
311,
471,
279,
29539,
7504,
3235,
449,
279,
1620,
4320,
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,
1948,
4803,
25,
528,
284,
220,
605,
55609,
198,
2903,
315,
3135,
311,
471,
505,
279,
3319,
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
] | https://langchain.readthedocs.io/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html |
e8e2a20bf611-2 | 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.
dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain. | [
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,
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.graph_qa.cypher.GraphCypherQAChain.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.