id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
54
121
09aa860bdfb8-109
Construct a map-reduce chain that uses the chain for map and reduce. Parameters llm (langchain.base_language.BaseLanguageModel) – prompt (langchain.prompts.base.BasePromptTemplate) – text_splitter (langchain.text_splitter.TextSplitter) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], l...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-110
chain.save(file_path=”path/chain.yaml”) to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented] to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented property lc_attributes: Dict Return a list of attribu...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-111
default_chain (langchain.chains.llm.LLMChain) – silent_errors (bool) – Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute callbacks: Callbacks = None Optional list of callback handlers (or callback manager). Defaults to None. Callback handl...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-112
You can use these to eg identify a specific instance of a chain with its use case. attribute 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. async acall(inputs, return_only_outputs=False, callbacks...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-113
Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict c...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-114
Return type str save(file_path) Save the chain. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save the chain to. Return type None Example: .. code-block:: python chain.save(file_path=”path/chain.yaml”) to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.se...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-115
verbose (bool) – tags (Optional[List[str]]) – router_chain (langchain.chains.router.llm_router.LLMRouterChain) – destination_chains (Mapping[str, langchain.chains.retrieval_qa.base.BaseRetrievalQA]) – default_chain (langchain.chains.base.Chain) – silent_errors (bool) – Return type None attribute callback_manager:...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-116
If True, use default_chain when an invalid destination name is provided. Defaults to False. attribute 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 callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-117
Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async arun(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variabl...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-118
inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dict[str, str] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text out. Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallba...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-119
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.MultiRouteChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, router_chain, destination_chains, default_chain, silent_errors=False)[source] Bases: langchain.chains.base.Chain Use a ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-120
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 ca...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-121
use the callbacks provided to the chain. include_run_info (bool) – Whether to include run info in the response. Defaults to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-122
Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type str save(file_path) Save the chain. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-123
Implement an LLM driven browser. Example from langchain import NatBotChain natbot = NatBotChain.from_default("Buy me a new hat.") Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-124
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. attribute objective: str [Required] Objective that NatBot is tasked with completing. attribute tags: Optional[List[str]] = None Optional list of tags associated...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-125
Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-126
objective (str) – kwargs (Any) – Return type langchain.chains.natbot.base.NatBotChain prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[Dict[str, Any], Any]) – Return type Dict[str, str] prep_outputs(inputs, outputs, return_only_outputs=False) Validate and prep outputs. Parameters inputs (Dict...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-127
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 s...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-128
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. attribute graph: NebulaGraph [Required] attribute memory: Optional...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-129
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 (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to use ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-130
classmethod from_llm(llm, *, qa_prompt=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 answ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-131
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...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-132
Initialize from LLM. Parameters llm (langchain.base_language.BaseLanguageModel) – qa_prompt (langchain.prompts.base.BasePromptTemplate) – ngql_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain prep_inputs(inputs) Validate and pr...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-133
langchain.load.serializable.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”, “l...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-134
client (Any) – model_name (Optional[str]) – error (bool) – input_key (str) – output_key (str) – openai_api_key (Optional[str]) – openai_organization (Optional[str]) – Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute callbacks: Callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-135
attribute 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. async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False) Run the logic of this chain and add t...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-136
tags (Optional[List[str]]) – kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[Dict[str, Any], Any]) – Return type Dict[str, str] prep_outputs(inputs, outputs, r...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-137
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 t...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-138
max_text_length (Optional[int]) – Return type None attribute api_operation: APIOperation [Required] attribute api_request_chain: LLMChain [Required] attribute api_response_chain: Optional[LLMChain] = None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-139
will be printed to the console. Defaults to langchain.verbose value. async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False) Run the logic of this chain and add to output if desired. Parameters inputs (Union[Dict[str, Any], Any]) – Dictionary of inputs, or single input if c...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-140
kwargs (Any) – Return type str deserialize_json_input(serialized_args)[source] Use the serialized typescript dictionary. Resolve the path, query params dict, and optional requestBody dict. Parameters serialized_args (str) – Return type dict dict(**kwargs) Return dictionary representation of chain. Parameters kwargs...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-141
prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[Dict[str, Any], Any]) – Return type Dict[str, str] prep_outputs(inputs, outputs, return_only_outputs=False) Validate and prep outputs. Parameters inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dic...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-142
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.
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-143
class langchain.chains.PALChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, llm=None, prompt=PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-144
computers were installed each day, from monday to thursday. How many computers are now in the server room?\n\n# solution in Python:\n\n\ndef solution():\n    """There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server ro...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-145
did Jason give to Denny?"""\n    jason_lollipops_initial = 20\n    jason_lollipops_after = 12\n    denny_lollipops = jason_lollipops_initial - jason_lollipops_after\n    result = denny_lollipops\n    return result\n\n\n\n\n\nQ: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have l...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-146
21 trees. How many trees did the grove workers plant today?\n\n# solution in Python:\n\n\ndef solution():\n    """There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?"""\n    trees_initial = 15\...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-147
Bases: langchain.chains.base.Chain Implements Program-Aided Language Models. Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.B...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-148
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 ca...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-149
attribute prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have left?\n\n# solution in Python:\n\n\ndef solution():\n    """Olivia has $23. She bought five bagels f...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-150
solution():\n    """There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?"""\n    computers_initial = 9\n    computers_per_day = 5\n    num_days = 4  # 4 days between monday and thursday\n    computers_added = c...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-151
= 12\n    denny_lollipops = jason_lollipops_initial - jason_lollipops_after\n    result = denny_lollipops\n    return result\n\n\n\n\n\nQ: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total?\n\n# solution in Python:\n\n\ndef solution():\n    """Leah had 32 chocolate...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-152
15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?"""\n    trees_initial = 15\n    trees_after = 21\n    trees_added = trees_after - trees_initial\n    result = trees_added\n    return result\n\n\n\n\n\...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-153
[Deprecated] attribute python_globals: Optional[Dict[str, Any]] = None attribute python_locals: Optional[Dict[str, Any]] = None attribute return_intermediate_steps: bool = False attribute stop: str = '\n\n' attribute tags: Optional[List[str]] = None Optional list of tags associated with the chain. Defaults to None...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-154
Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-155
Validate and prep outputs. Parameters inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dict[str, str] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text out. Parameters args (Any) – callbacks (Optional[Union[Li...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-156
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.QAGenerationChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, text_splitter=<langchain.text_splitter.RecursiveCharacterTextSplitter object>, input_key='text', output_key...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-157
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 ca...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-158
use the callbacks provided to the chain. include_run_info (bool) – Whether to include run info in the response. Defaults to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-159
inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dict[str, str] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text out. Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallba...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-160
property lc_serializable: bool Return whether or not the class is serializable. property output_keys: List[str] Output keys this chain expects. class langchain.chains.QAWithSourcesChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, combine_documents_chain, question_key='question', in...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-161
Chain to use to combine documents. attribute 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....
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-162
use the callbacks provided to the chain. include_run_info (bool) – Whether to include run info in the response. Defaults to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-163
classmethod from_llm(llm, document_prompt=PromptTemplate(input_variables=['page_content', 'source'], output_parser=None, partial_variables={}, template='Content: {page_content}\nSource: {source}', template_format='f-string', validate_template=True), question_prompt=PromptTemplate(input_variables=['context', 'question']...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-164
of this Agreement shall not affect the continuation  in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any  kind between the parties.\n\n11.9 No Third-Party Benefic...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-165
their fearlessness, their courage, their determination, inspires the world. \n\nGroups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland.\nSource: 0-pl\nContent: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one anothe...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-166
you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can a...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-167
\n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.\nSource: 34-pl\n=========\nFINAL ANSWER: The president did not mention Michael...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-168
Construct the chain from an LLM. Parameters llm (langchain.base_language.BaseLanguageModel) – document_prompt (langchain.prompts.base.BasePromptTemplate) – question_prompt (langchain.prompts.base.BasePromptTemplate) – combine_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-169
Return type langchain.load.serializable.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. [“la...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-170
verbose (bool) – tags (Optional[List[str]]) – combine_documents_chain (langchain.chains.combine_documents.base.BaseCombineDocumentsChain) – input_key (str) – output_key (str) – return_source_documents (bool) – retriever (langchain.schema.BaseRetriever) – Return type None attribute callback_manager: Optional[Base...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-171
attribute 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. async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False) Run the logic of this chain and add t...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-172
tags (Optional[List[str]]) – kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict classmethod from_chain_type(llm, chain_type='stuff', chain_type_kwargs=None, **kwargs) Load chain from chain type. Parameters llm (langchain.base_language...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-173
tags (Optional[List[str]]) – kwargs (Any) – Return type str save(file_path) Save the chain. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save the chain to. Return type None Example: .. code-block:: python chain.save(file_path=”path/chain.yaml”) to_json() Return type Union[langchain.load.seriali...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-174
Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – verbose (bool) – tags (Optional[List[str]]) – combi...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-175
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. attribute reduce_k_below_max_tokens: bool = False Reduce the number of results to ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-176
use the callbacks provided to the chain. include_run_info (bool) – Whether to include run info in the response. Defaults to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-177
classmethod from_llm(llm, document_prompt=PromptTemplate(input_variables=['page_content', 'source'], output_parser=None, partial_variables={}, template='Content: {page_content}\nSource: {source}', template_format='f-string', validate_template=True), question_prompt=PromptTemplate(input_variables=['context', 'question']...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-178
of this Agreement shall not affect the continuation  in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any  kind between the parties.\n\n11.9 No Third-Party Benefic...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-179
their fearlessness, their courage, their determination, inspires the world. \n\nGroups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland.\nSource: 0-pl\nContent: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one anothe...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-180
you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can a...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-181
\n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.\nSource: 34-pl\n=========\nFINAL ANSWER: The president did not mention Michael...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-182
Construct the chain from an LLM. Parameters llm (langchain.base_language.BaseLanguageModel) – document_prompt (langchain.prompts.base.BasePromptTemplate) – question_prompt (langchain.prompts.base.BasePromptTemplate) – combine_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-183
Return type langchain.load.serializable.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. [“la...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-184
for full details. attribute 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 d...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-185
to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-186
Parameters inputs (Dict[str, Any]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type langchain.chains.router.base.Route run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables,...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-187
property lc_serializable: bool Return whether or not the class is serializable. property output_keys: List[str] Output keys this chain expects. class langchain.chains.SQLDatabaseChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, llm=None, database, prompt=None, top_k=5, i...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-188
Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute 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 wi...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-189
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. attribute top_k: int = 5 Number of results to return from the query attribute use_query_checker: bool = False Whe...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-190
Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async arun(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variabl...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-191
Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type str save(file_path) Save the chain. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-192
Chain for querying SQL database that is a sequential chain. The chain is as follows: 1. Based on the query, determine which tables to use. 2. Based on those tables, call the normal SQL database chain. This is useful in cases where the number of tables in the database is large. Parameters memory (Optional[langchain.sche...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-193
There are many different types of memory - please see memory docs for the full catalog. attribute return_intermediate_steps: bool = False attribute sql_chain: SQLDatabaseChain [Required] attribute tags: Optional[List[str]] = None Optional list of tags associated with the chain. Defaults to None These tags will be as...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-194
Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async arun(*args, callbacks=None, tags=None, **kwargs) Run the chai...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-195
Parameters kwargs (Any) – Return type Dict classmethod from_llm(llm, database, query_prompt=PromptTemplate(input_variables=['input', 'table_info', 'dialect', 'top_k'], output_parser=None, partial_variables={}, template='Given an input question, first create a syntactically correct {dialect} query to run, then look at ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-196
Parameters llm (langchain.base_language.BaseLanguageModel) – database (langchain.sql_database.SQLDatabase) – query_prompt (langchain.prompts.base.BasePromptTemplate) – decider_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain.chains.sql_database.base.SQLDatabaseSequentialCha...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-197
langchain.load.serializable.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”, “l...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-198
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. attribute chains: List[langchain.chains.base.Chain] [Required] att...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-199
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 (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to use ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-200
inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dict[str, str] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text out. Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallba...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-201
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.SimpleSequentialChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, chains, strip_outputs=False, input_key='input', output_key='output')[source] Bases: langchain.chains.base.Chain S...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-202
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. attribute strip_outputs: bool = False attribute tags: Optional[List[str]] = None Optional list of tags associated with the chain. Defaults to None These tags wi...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-203
Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async arun(*args, callbacks=None, tags=None, **kwargs) Run the chai...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-204
Return type str save(file_path) Save the chain. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save the chain to. Return type None Example: .. code-block:: python chain.save(file_path=”path/chain.yaml”) to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.se...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-205
verbose (bool) – tags (Optional[List[str]]) – input_variables (List[str]) – output_variables (List[str]) – transform (Callable[[Dict[str, str]], Dict[str, str]]) – Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute callbacks: Callbacks = ...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-206
will be printed to the console. Defaults to langchain.verbose value. async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False) Run the logic of this chain and add to output if desired. Parameters inputs (Union[Dict[str, Any], Any]) – Dictionary of inputs, or single input if c...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-207
kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[Dict[str, Any], Any]) – Return type Dict[str, str] prep_outputs(inputs, outputs, return_only_outputs=False) Val...
https://api.python.langchain.com/en/latest/modules/chains.html
09aa860bdfb8-208
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 s...
https://api.python.langchain.com/en/latest/modules/chains.html