id
stringlengths
14
15
text
stringlengths
35
2.51k
source
stringlengths
61
154
b0744d6ee3b7-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[SerializedConstruc...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html
85ca7adfb0f6-0
langchain.chains.graph_qa.base.GraphQAChain¶ class langchain.chains.graph_qa.base.GraphQAChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html
85ca7adfb0f6-1
for the full catalog. 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 ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html
85ca7adfb0f6-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 key...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html
85ca7adfb0f6-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm(llm: BaseLanguageModel, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="Use the following knowledge triplets to answer the question at t...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html
85ca7adfb0f6-4
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 m...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html
639d2f26babf-0
langchain.chains.combine_documents.map_reduce.CombineDocsProtocol¶ class langchain.chains.combine_documents.map_reduce.CombineDocsProtocol(*args, **kwargs)[source]¶ Bases: Protocol Interface for the combine_docs method. Methods __init__(*args, **kwargs) __call__(docs: List[Document], **kwargs: Any) → str[source]¶ Inter...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.CombineDocsProtocol.html
43f36e65a644-0
langchain.chains.openai_functions.utils.get_llm_kwargs¶ langchain.chains.openai_functions.utils.get_llm_kwargs(function: dict) → dict[source]¶ Returns the kwargs for the LLMChain constructor. Parameters function – The function to use. Returns The kwargs for the LLMChain constructor.
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.utils.get_llm_kwargs.html
5a88a6286c0e-0
langchain.chains.summarize.__init__.LoadingCallable¶ class langchain.chains.summarize.__init__.LoadingCallable(*args, **kwargs)[source]¶ Bases: Protocol Interface for loading the combine documents chain. Methods __init__(*args, **kwargs) __call__(llm: BaseLanguageModel, **kwargs: Any) → BaseCombineDocumentsChain[source...
https://api.python.langchain.com/en/latest/chains/langchain.chains.summarize.__init__.LoadingCallable.html
60784b7959c0-0
langchain.chains.openai_functions.qa_with_structure.AnswerWithSources¶ class langchain.chains.openai_functions.qa_with_structure.AnswerWithSources(*, answer: str, sources: List[str])[source]¶ Bases: BaseModel An answer to the question being asked, with sources. Create a new model by parsing and validating input data fr...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.AnswerWithSources.html
4142e99ebd0f-0
langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn¶ langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn(spec: OpenAPISpec) → Tuple[List[Dict[str, Any]], Callable][source]¶ Convert a valid OpenAPI spec to the JSON Schema format expected for OpenAIfunctions. Parameters spec – OpenAPI spec...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn.html
f26b3c203cc6-0
langchain.chains.query_constructor.base.load_query_constructor_chain¶ langchain.chains.query_constructor.base.load_query_constructor_chain(llm: BaseLanguageModel, document_contents: str, attribute_info: List[AttributeInfo], examples: Optional[List] = None, allowed_comparators: Optional[Sequence[Comparator]] = None, all...
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.base.load_query_constructor_chain.html
c7d457087ea7-0
langchain.chains.prompt_selector.is_chat_model¶ langchain.chains.prompt_selector.is_chat_model(llm: BaseLanguageModel) → bool[source]¶ Check if the language model is a chat model. Parameters llm – Language model to check. Returns True if the language model is a BaseChatModel model, False otherwise.
https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.is_chat_model.html
ffeb72b46431-0
langchain.chains.natbot.crawler.ElementInViewPort¶ class langchain.chains.natbot.crawler.ElementInViewPort[source]¶ Bases: TypedDict A typed dictionary containing information about elements in the viewport. Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new dictionary with keys from iterabl...
https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.crawler.ElementInViewPort.html
ffeb72b46431-1
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.¶ If the key is not found, return the default if given; otherwi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.crawler.ElementInViewPort.html
a9bb84cfdfdd-0
langchain.chains.openai_functions.openapi.SimpleRequestChain¶ class langchain.chains.openai_functions.openapi.SimpleRequestChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: boo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
a9bb84cfdfdd-1
These tags will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param verbose: bool [Optional]¶ Whether or not run in verbose mode. In verbose mode, some intermediate logs will be...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
a9bb84cfdfdd-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 p...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
a9bb84cfdfdd-3
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[SerializedConstruc...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
ec41bba49000-0
langchain.chains.retrieval_qa.base.VectorDBQA¶ class langchain.chains.retrieval_qa.base.VectorDBQA(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.VectorDBQA.html
ec41bba49000-1
and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. There are many different types of memory - please see memory docs for the full catalog. param return_source_documents: bool = False¶ Return the source documents. param sea...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.VectorDBQA.html
ec41bba49000-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 acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False,...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.VectorDBQA.html
ec41bba49000-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_chain_type(llm: BaseLanguageModel, chain_type: str = 'stuff', chain_type_kwargs: Optional[dict] = None, **kwargs: Any) → BaseRetrievalQA¶ Load chain from chain type. classmethod from_llm(llm: BaseLanguageModel, prompt: Optional[Prom...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.VectorDBQA.html
ec41bba49000-4
Validate search type. 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_sec...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.VectorDBQA.html
58c292427124-0
langchain.chains.graph_qa.kuzu.KuzuQAChain¶ class langchain.chains.graph_qa.kuzu.KuzuQAChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-1
There are many different types of memory - please see memory docs for the full catalog. 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 th...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-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) → ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-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 informati...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-4
Cypher statement.\n\nThe question is:\n{question}', template_format='f-string', validate_template=True), **kwargs: Any) → KuzuQAChain[source]¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-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 war...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
58c292427124-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¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.kuzu.KuzuQAChain.html
c3e3cd27560d-0
langchain.chains.router.base.RouterChain¶ class langchain.chains.router.base.RouterChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = No...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c3e3cd27560d-1
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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c3e3cd27560d-2
response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info – Whether to inc...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c3e3cd27560d-3
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 ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
0525f921d123-0
langchain.chains.openai_functions.extraction.create_extraction_chain¶ langchain.chains.openai_functions.extraction.create_extraction_chain(schema: dict, llm: BaseLanguageModel) → Chain[source]¶ Creates a chain that extracts information from a passage. Parameters schema – The schema of the entities to extract. llm – The...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.extraction.create_extraction_chain.html
e1eb5402832e-0
langchain.chains.sql_database.base.SQLDatabaseSequentialChain¶ class langchain.chains.sql_database.base.SQLDatabaseSequentialChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: b...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
e1eb5402832e-1
and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. There are many different types of memory - please see memory docs for the full catalog. param return_intermediate_steps: bool = False¶ param sql_chain: SQLDatabaseChain [R...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
e1eb5402832e-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) → ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
e1eb5402832e-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm(llm: BaseLanguageModel, database: SQLDatabase, query_prompt: BasePromptTemplate = PromptTemplate(input_variables=['input', 'table_info', 'dialect', 'top_k'], output_parser=None, partial_variables={}, template='Given an input que...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
e1eb5402832e-4
Load the necessary chains. 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 deprecati...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
e1eb5402832e-5
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¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseSequentialChain.html
577913c0f8d9-0
langchain.chains.router.multi_prompt.MultiPromptChain¶ class langchain.chains.router.multi_prompt.MultiPromptChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html
577913c0f8d9-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 router_chain: RouterChain [Required]¶ Chain for deciding a destination chain and the input to it. param silent_errors: bool = False¶ If True, use default_ch...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html
577913c0f8d9-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) → ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html
577913c0f8d9-3
Convenience constructor for instantiating from destination prompts. 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_de...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html
577913c0f8d9-4
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'¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html
4df97523a127-0
langchain.chains.combine_documents.base.AnalyzeDocumentChain¶ class langchain.chains.combine_documents.base.AnalyzeDocumentChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: boo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
4df97523a127-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: langchain.text_splitter.Text...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
4df97523a127-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 key...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
4df97523a127-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. T...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
50a775b91307-0
langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain¶ langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain(llm: BaseLanguageModel, schema: Union[dict, Type[BaseModel]], output_parser: str = 'base', prompt: Optional[Union[PromptTemplate, ChatPromptTemplate]] = ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain.html
007d6f7f2a44-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: Op...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html
007d6f7f2a44-1
[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, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html
007d6f7f2a44-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]¶ R...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html
007d6f7f2a44-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 a...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html
007d6f7f2a44-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() → SerializedNotI...
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.base.SQLDatabaseChain.html
58120c638b7c-0
langchain.chains.combine_documents.stuff.StuffDocumentsChain¶ class langchain.chains.combine_documents.stuff.StuffDocumentsChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: boo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.stuff.StuffDocumentsChain.html
58120c638b7c-1
param llm_chain: langchain.chains.llm.LLMChain [Required]¶ LLM wrapper to use after formatting 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 th...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.stuff.StuffDocumentsChain.html
58120c638b7c-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[BaseCallbac...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.stuff.StuffDocumentsChain.html
58120c638b7c-3
Run the chain as text in, text out or multiple variables, text out. combine_docs(docs: List[Document], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Tuple[str, dict][source]¶ Stuff all documents into one prompt and pass to LLM. dict(**kwargs: Any) → Dict¶ Return dic...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.stuff.StuffDocumentsChain.html
58120c638b7c-4
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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.stuff.StuffDocumentsChain.html
063afa91943b-0
langchain.chains.pal.base.PALChain¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-1
class langchain.chains.pal.base.PALChain(*, 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[BaseLangu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-2
golf_balls_left = golf_balls_initial - golf_balls_lost_tuesday - golf_balls_lost_wednesday\n    result = golf_balls_left\n    return result\n\n\n\n\n\nQ: 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\n...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-3
solution in Python:\n\n\ndef solution():\n    """Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops 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    ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-4
= total_cars\n    return result\n\n\n\n\n\nQ: 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\n# solution in Python:\n\n\ndef solution():\n    """There are 15 trees in the grove. Grove wo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-5
Bases: Chain Implements Program-Aided Language Models. 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 c...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-6
param 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 for $...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-7
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/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-8
= 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/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-9
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/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-10
[Deprecated] param python_globals: Optional[Dict[str, Any]] = None¶ param python_locals: Optional[Dict[str, Any]] = None¶ param return_intermediate_steps: bool = False¶ param stop: str = '\n\n'¶ param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults to None These tags will be ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-11
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) → ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-12
Load PAL from colored object prompt. classmethod from_math_prompt(llm: BaseLanguageModel, **kwargs: Any) → PALChain[source]¶ Load PAL from math prompt. 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_ou...
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
063afa91943b-13
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'¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.pal.base.PALChain.html
1be1d52ff26c-0
langchain.chains.router.llm_router.LLMRouterChain¶ class langchain.chains.router.llm_router.LLMRouterChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Option...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html
1be1d52ff26c-1
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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html
1be1d52ff26c-2
response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info – Whether to inc...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html
1be1d52ff26c-3
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 ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.LLMRouterChain.html
cf62b66ff678-0
langchain.chains.query_constructor.parser.QueryTransformer¶ langchain.chains.query_constructor.parser.QueryTransformer¶ alias of None
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.parser.QueryTransformer.html
f50b0eacdfbb-0
langchain.chains.api.base.APIChain¶ class langchain.chains.api.base.APIChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, api_requ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
f50b0eacdfbb-1
There are many different types of memory - please see memory docs for the full catalog. param requests_wrapper: TextRequestsWrapper [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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
f50b0eacdfbb-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) → ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
f50b0eacdfbb-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm_and_api_docs(llm: BaseLanguageModel, api_docs: str, headers: Optional[dict] = None, api_url_prompt: BasePromptTemplate = PromptTemplate(input_variables=['api_docs', 'question'], output_parser=None, partial_variables={}, template...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
f50b0eacdfbb-4
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[BaseCa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
f50b0eacdfbb-5
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¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.base.APIChain.html
3ef5bc5cb4a7-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: Op...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html
3ef5bc5cb4a7-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_intermedi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html
3ef5bc5cb4a7-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[BaseCallbac...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html
3ef5bc5cb4a7-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. 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 unders...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html
3ef5bc5cb4a7-4
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[BaseCa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.GraphCypherQAChain.html
8c7378a2f6f7-0
langchain.chains.retrieval_qa.base.BaseRetrievalQA¶ class langchain.chains.retrieval_qa.base.BaseRetrievalQA(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Opti...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
8c7378a2f6f7-1
Return the source documents. 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
8c7378a2f6f7-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 key...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
8c7378a2f6f7-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[BaseCa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
8c7378a2f6f7-4
Configuration for this pydantic object. allow_population_by_field_name = True¶ arbitrary_types_allowed = True¶ extra = 'forbid'¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
687655b038be-0
langchain.chains.query_constructor.ir.Operation¶ class langchain.chains.query_constructor.ir.Operation(*, operator: Operator, arguments: List[FilterDirective])[source]¶ Bases: FilterDirective A logical operation over other directives. Create a new model by parsing and validating input data from keyword arguments. Raise...
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Operation.html
d50c0785e2f2-0
langchain.chains.qa_with_sources.loading.load_qa_with_sources_chain¶ langchain.chains.qa_with_sources.loading.load_qa_with_sources_chain(llm: BaseLanguageModel, chain_type: str = 'stuff', verbose: Optional[bool] = None, **kwargs: Any) → BaseCombineDocumentsChain[source]¶ Load question answering with sources chain. Para...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.loading.load_qa_with_sources_chain.html
9dfec98ab6bd-0
langchain.chains.combine_documents.base.BaseCombineDocumentsChain¶ class langchain.chains.combine_documents.base.BaseCombineDocumentsChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, ve...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html