id
stringlengths
14
16
text
stringlengths
4
1.28k
source
stringlengths
54
121
07ceff43f477-416
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 = None Optional list of callback handlers (or callback manager). Defaults to Non...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-417
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 output_variables: List[str] [Required] attribute tags: Optional[List[str]] = None Optional list of tags associated with the chain. Defaults to None Th...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-418
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 chain expects only one param. return_only_outputs (bool) – boolean for...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-419
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
07ceff43f477-420
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) Validate and prep outputs. Parameters inputs (Dict[...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-421
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
07ceff43f477-422
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. class langchain.chain...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-423
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
07ceff43f477-424
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 with on_chain_start, ending with on_chain_end or on_chain_error. Each custom chain can optionally call additional callba...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-425
for the full catalog. attribute return_source_documents: bool = False Return the source documents. attribute search_kwargs: Dict[str, Any] [Optional] Extra search args. attribute search_type: str = 'similarity' Search type to use over vectorstore. similarity or mmr. attribute tags: Optional[List[str]] = None Option...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-426
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 chain expects only one param. return_only_outputs (bool) – boolean for...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-427
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
07ceff43f477-428
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.BaseLanguageModel) – chain_type (str) – chain_type_kwargs (Optional[dict]) ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-429
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
07ceff43f477-430
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.serializable.SerializedNotImplement...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-431
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. class langchain.chains.VectorDBQAWithSourcesChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, combine_do...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-432
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]]) – combine_documents_chain (langchain.chains.combine_documents.base.B...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-433
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 with on_chain_start, ending with on_chain_end or on_chain_error. Each custom chain ca...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-434
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
07ceff43f477-435
You can use these to eg identify a specific instance of a chain with its use case. attribute vectorstore: langchain.vectorstores.base.VectorStore [Required] Vector Database to connect to. attribute verbose: bool [Optional] Whether or not run in verbose mode. In verbose mode, some intermediate logs will be printed to ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-436
chain will be returned. Defaults to False. callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info (bool) – Whether to include run ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-437
Run the chain as text in, text out or multiple variables, text out. 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 re...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-438
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
07ceff43f477-439
just say that you don\'t know. Don\'t try to make up an answer.\nALWAYS return a "SOURCES" part in your answer.\n\nQUESTION: Which state/country\'s law governs the interpretation of the contract?\n=========\nContent: This Agreement is governed by English law and the parties submit to the exclusive jurisdiction of the E...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-440
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 Beneficiar...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-441
Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.  \n\nLast year COVID-19 kept us apart. This year we are finally together again. \n\nTonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. \n\nWith a duty to one an...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-442
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 another. And...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-443
York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. \n\nThey were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. \n\nOfficer Mora was 27 years old. \n\nOfficer Rivera was 22. \n\nBoth Dominican Americans who’d grown up on the ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-444
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
07ceff43f477-445
for patients and families. \n\nTo get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. \n\nIt’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more.  \n\nARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-446
known. \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 ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-447
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
07ceff43f477-448
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.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[st...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-449
to_json_not_implemented() 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...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-450
llm (langchain.base_language.BaseLanguageModel) – The language model to use. Returns Chain that can be used to extract information from a passage. Return type langchain.chains.base.Chain langchain.chains.create_extraction_chain_pydantic(pydantic_schema, llm)[source] Creates a chain that extracts information from a pas...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-451
llm (langchain.base_language.BaseLanguageModel) – The language model to use. Returns Chain (LLMChain) that can be used to extract information from a passage. Return type langchain.chains.base.Chain langchain.chains.create_tagging_chain_pydantic(pydantic_schema, llm)[source] Creates a chain that extracts information fr...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-452
kwargs (Any) – Return type langchain.chains.base.Chain langchain.chains.create_citation_fuzzy_match_chain(llm)[source] Create a citation fuzzy match chain. Parameters llm (langchain.base_language.BaseLanguageModel) – Language model to use for the chain. Returns Chain (LLMChain) that can be used to answer questions wi...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-453
output_parser (str) – Output parser to use. Should be one of pydantic or base. Default to base. prompt (Optional[Union[langchain.prompts.prompt.PromptTemplate, langchain.prompts.chat.ChatPromptTemplate]]) – Optional prompt to use for the chain. Return type langchain.chains.llm.LLMChain Returns: langchain.chains.create_...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-454
langchain.chains.llm.LLMChain class langchain.chains.StuffDocumentsChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, input_key='input_documents', output_key='output_text', llm_chain, document_prompt=None, document_variable_name, document_separator='\n\n')[source] Bases: langchain.ch...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-455
output_key (str) – llm_chain (langchain.chains.llm.LLMChain) – document_prompt (langchain.prompts.base.BasePromptTemplate) – document_variable_name (str) – document_separator (str) – Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute call...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-456
The string with which to join the formatted documents attribute document_variable_name: str [Required] The variable name in the llm_chain to put the documents in. If only one variable in the llm_chain, this need not be provided. attribute llm_chain: langchain.chains.llm.LLMChain [Required] LLM wrapper to use after fo...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-457
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 verbose: bool [Optional] Whether or not run in verbose mode. In verbose mode, some intermediate logs wil...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-458
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 for this chain run. If not provided, will use the callbacks provi...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-459
Return type Tuple[str, dict] 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]] asyn...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-460
Stuff all documents into one prompt and pass to LLM. Parameters docs (List[langchain.schema.Document]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type Tuple[str, dict] dict(**kwargs) Return dictionary repres...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-461
Return type Dict[str, str] prompt_length(docs, **kwargs)[source] Get the prompt length by formatting the prompt. Parameters docs (List[langchain.schema.Document]) – kwargs (Any) – Return type Optional[int] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-462
Example: .. code-block:: python 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...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-463
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.MapRerankDocumentsChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, input_key='input_documents', output_key='output_text', llm_chain, document_variable_name, rank_key, answer_key, ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-464
tags (Optional[List[str]]) – input_key (str) – output_key (str) – llm_chain (langchain.chains.llm.LLMChain) – document_variable_name (str) – rank_key (str) – answer_key (str) – metadata_keys (Optional[List[str]]) – return_intermediate_steps (bool) – Return type None attribute answer_key: str [Required] Key in...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-465
Each custom chain can optionally call additional callback methods, see Callback docs for full details. attribute document_variable_name: str [Required] The variable name in the llm_chain to put the documents in. If only one variable in the llm_chain, this need not be provided. attribute llm_chain: LLMChain [Required]...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-466
Key in output of llm_chain to rank on. attribute return_intermediate_steps: bool = 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 callbacks...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-467
only one param. return_only_outputs (bool) – 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 (Optional[Union[List[langchain.callbacks...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-468
Parameters docs (List[langchain.schema.Document]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type Tuple[str, dict] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-469
tags (Optional[List[str]]) – kwargs (Any) – Return type str combine_docs(docs, callbacks=None, **kwargs)[source] Combine documents in a map rerank manner. Combine by mapping first chain over all documents, then reranking the results. Parameters docs (List[langchain.schema.Document]) – callbacks (Optional[Union[List...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-470
Validate and prep outputs. Parameters inputs (Dict[str, str]) – outputs (Dict[str, str]) – return_only_outputs (bool) – Return type Dict[str, str] prompt_length(docs, **kwargs) Return the prompt length given the documents passed in. Returns None if the method does not depend on the prompt length. Parameters docs (L...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-471
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
07ceff43f477-472
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. class langchain.chains.MapReduceDocumentsChain(*, memory=None, callbacks=None, callback_manager=None, v...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-473
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – verbose (bool) – tags (Optional[List[str]]) – input_key (str) – output_key (str) – llm_chain (langchain.chains.llm.LLMChain) – combine_document_chain (langchain.chains.combine_documents.base.BaseCombineDocumentsChain) – collapse_document...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-474
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 collapse_document_chain: Optional[BaseCombineDocumentsChain] = None Chain to use to collapse intermediary results if needed. If None...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-475
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
07ceff43f477-476
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
07ceff43f477-477
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] async acombine_docs(docs, callbacks=None, **kwargs)[source] Combine documents in a map reduce manner. Combine by mapping first chai...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-478
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 variables, text out. Parameters args (Any) – callbacks...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-479
Parameters docs (List[langchain.schema.Document]) – token_max (int) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type Tuple[str, dict] dict(**kwargs) Return dictionary representation of chain. Parameters kwar...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-480
prompt_length(docs, **kwargs) Return the prompt length given the documents passed in. Returns None if the method does not depend on the prompt length. Parameters docs (List[langchain.schema.Document]) – kwargs (Any) – Return type Optional[int] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-481
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.serializable.SerializedNotImplemented] to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented prope...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-482
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.RefineDocumentsChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, input_key='input_documents', output_key='output_text', initial_llm_chain, refine_llm_chain, document_variable_name,...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-483
tags (Optional[List[str]]) – input_key (str) – output_key (str) – initial_llm_chain (langchain.chains.llm.LLMChain) – refine_llm_chain (langchain.chains.llm.LLMChain) – document_variable_name (str) – initial_response_name (str) – document_prompt (langchain.prompts.base.BasePromptTemplate) – return_intermediate_...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-484
Each custom chain can optionally call additional callback methods, see Callback docs for full details. attribute document_prompt: BasePromptTemplate [Optional] Prompt to use to format each document. attribute document_variable_name: str [Required] The variable name in the initial_llm_chain to put the documents in. If...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-485
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 refine_llm_chain: LLMChain [Required] LLM chain to use when refining. attribute return_intermediate_steps: bool = False Return the results of the refi...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-486
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 chain expects only one param. return_only_outputs (bool) – boolean for...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-487
to False. tags (Optional[List[str]]) – Return type Dict[str, Any] async acombine_docs(docs, callbacks=None, **kwargs)[source] Combine by mapping first chain over all, then stuffing into final chain. Parameters docs (List[langchain.schema.Document]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallba...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-488
List[Dict[str, str]] async arun(*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.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[s...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-489
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) Validate and prep outputs. Parameters inputs (Dict[...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-490
Run the chain as text in, text out or multiple variables, text out. 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. Par...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-491
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] ...
https://api.python.langchain.com/en/latest/modules/chains.html
8ab9cc7dfede-0
Agent Toolkits Agent toolkits.
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-1
langchain.agents.agent_toolkits.create_json_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the following tools which help you learn more about the JSON you are interacting with.\...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-2
key in one of those responses, you cannot use it.\nYou should only add one key at a time to the path. You cannot add multiple keys at once.\nIf you encounter a "KeyError", go back to the previous key, look at the available keys, and try again.\n\nIf the question does not seem to be related to the JSON, just return "I d...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-3
the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.\n', suffix='Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I have access to\n{agent_scratchpad}', format_instructions='Use the following for...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-4
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.json.toolkit.JsonToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) – inpu...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-5
langchain.agents.agent_toolkits.create_sql_agent(llm, toolkit, agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager=None, prefix='You are an agent designed to interact with a SQL database.\nGiven an input question, create a syntactically correct {dialect} query to run, then look at the results of the quer...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-6
before executing it. If you get an error while executing a query, rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return "I don\'t know" as the answer.\n', suffix=None, format_instructi...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-7
max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-8
Construct a sql agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit) – agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefi...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-9
langchain.agents.agent_toolkits.create_openapi_agent(llm, toolkit, callback_manager=None, prefix="You are an agent designed to answer questions by making web requests to an API given the openapi spec.\n\nIf the question does not seem related to the API, return I don't know. Do not make up an answer.\nOnly use informati...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-10
correct parameters to the request by checking which parameters are required. For parameters with a fixed set of values, please use the spec to look at which values are allowed.\n\nUse the exact parameter names as listed in the spec, do not make up any names or abbreviate the names of parameters.\nIf you get a not found...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-11
Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question', input_variables=None, max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, return_intermediate_steps=False, agent_executor_kwargs=None, **kwar...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-12
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) –...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-13
langchain.agents.agent_toolkits.create_pbi_agent(llm, toolkit, powerbi=None, callback_manager=None, prefix='You are an agent designed to help users interact with a PowerBI Dataset.\n\nAgent has access to a tool that can write a query based on the question and then run those against PowerBI, Microsofts business intellig...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-14
in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix='Begin!\n\nQuestion: {input}\nThought: I can first ask which tables I have, then how each table is defined and then ask the query tool...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-15
the final answer\nFinal Answer: the final answer to the original input question', examples=None, input_variables=None, top_k=10, verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-16
Construct a pbi agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.powerbi.PowerBIDataset]) – callback_manager (Optional[langchain.callbacks.base.BaseCallb...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-17
langchain.agents.agent_toolkits.create_pbi_chat_agent(llm, toolkit, powerbi=None, callback_manager=None, output_parser=None, prefix='Assistant is a large language model built to help users interact with a PowerBI Dataset.\n\nAssistant has access to a tool that can write a query based on the question and then run those ...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-18
human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix="TOOLS\n------\nAssistant can ask the user to use tools to look up information that may be ...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-19
Construct a pbi agent from an Chat LLM and tools. If you supply only a toolkit and no powerbi dataset, the same LLM is used for both. Parameters llm (langchain.chat_models.base.BaseChatModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.p...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-20
verbose (bool) – agent_executor_kwargs (Optional[Dict[str, Any]]) – kwargs (Dict[str, Any]) – Return type langchain.agents.agent.AgentExecutor
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-21
langchain.agents.agent.AgentExecutor langchain.agents.agent_toolkits.create_python_agent(llm, tool, agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager=None, verbose=False, prefix='You are an agent designed to write and execute python code to answer questions.\nYou have access to a python REPL, which you...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-22
tool (langchain.tools.python.tool.PythonREPLTool) – agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – verbose (bool) – prefix (str) – agent_executor_kwargs (Optional[Dict[str, Any]]) – kwargs (Dict[str, Any]) – Return type langchain....
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html
8ab9cc7dfede-23
langchain.agents.agent.AgentExecutor langchain.agents.agent_toolkits.create_vectorstore_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to answer questions about sets of documents.\nYou have access to tools for interacting with the documents, and the inputs to the tools are questions.\nSome...
https://api.python.langchain.com/en/latest/modules/agent_toolkits.html