id
stringlengths
14
15
text
stringlengths
35
2.51k
source
stringlengths
61
154
9f155aed0348-2
returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info – Whether to include run info in the response. Defaults to False. async acall(inp...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
9f155aed0348-3
Call the chain on all inputs in the list. async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple variables, text out. combine_docs(docs: List[Document], callbacks: Op...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
9f155aed0348-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.combine_documents.map_rerank.MapRerankDocumentsChain.html
ff1a44aef144-0
langchain.chains.qa_with_sources.loading.LoadingCallable¶ class langchain.chains.qa_with_sources.loading.LoadingCallable(*args, **kwargs)[source]¶ Bases: Protocol Interface for loading the combine documents chain. Methods __init__(*args, **kwargs) __call__(llm: BaseLanguageModel, **kwargs: Any) → BaseCombineDocumentsCh...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.loading.LoadingCallable.html
7882f13b5681-0
langchain.chains.conversation.base.ConversationChain¶ class langchain.chains.conversation.base.ConversationChain(*, memory: BaseMemory = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[L...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversation.base.ConversationChain.html
7882f13b5681-1
Each custom chain can optionally call additional callback methods, see Callback docs for full details. param llm: BaseLanguageModel [Required]¶ Language model to call. param llm_kwargs: dict [Optional]¶ param memory: langchain.schema.BaseMemory [Optional]¶ Default memory store. param output_parser: BaseLLMOutputParser ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversation.base.ConversationChain.html
7882f13b5681-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.conversation.base.ConversationChain.html
7882f13b5681-3
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.conversation.base.ConversationChain.html
7882f13b5681-4
Completion from LLM. Example completion = llm.predict(adjective="funny") async apredict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[str, List[str], Dict[str, str]]¶ Call apredict and then parse the results. async aprep_prompts(input_list: List[Dict...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversation.base.ConversationChain.html
7882f13b5681-5
Completion from LLM. Example completion = llm.predict(adjective="funny") predict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[str, List[str], Dict[str, Any]]¶ Call predict and then parse the results. prep_inputs(inputs: Union[Dict[str, Any], Any]) →...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversation.base.ConversationChain.html
7882f13b5681-6
validator validate_prompt_input_variables  »  all fields[source]¶ Validate that prompt input variables are consistent. property input_keys: List[str]¶ Use this since so some prompt vars come from history. property lc_attributes: Dict¶ Return a list of attribute names that should be included in the serialized kwargs. Th...
https://api.python.langchain.com/en/latest/chains/langchain.chains.conversation.base.ConversationChain.html
8dac61ccd1ec-0
langchain.chains.query_constructor.ir.FilterDirective¶ class langchain.chains.query_constructor.ir.FilterDirective[source]¶ Bases: Expr, ABC A filtering expression. 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 m...
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.FilterDirective.html
9126581cdef9-0
langchain.chains.prompt_selector.ConditionalPromptSelector¶ class langchain.chains.prompt_selector.ConditionalPromptSelector(*, default_prompt: BasePromptTemplate, conditionals: List[Tuple[Callable[[BaseLanguageModel], bool], BasePromptTemplate]] = None)[source]¶ Bases: BasePromptSelector Prompt collection that goes th...
https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.ConditionalPromptSelector.html
760c761c9907-0
langchain.chains.combine_documents.base.format_document¶ langchain.chains.combine_documents.base.format_document(doc: Document, prompt: BasePromptTemplate) → str[source]¶ Format a document into a string based on a prompt template.
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.format_document.html
8147d50ebe41-0
langchain.chains.constitutional_ai.base.ConstitutionalChain¶ class langchain.chains.constitutional_ai.base.ConstitutionalChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-1
Optional list of callback handlers (or callback manager). Defaults to None. Callback handlers are called throughout the lifecycle of a call to a chain, starting with on_chain_start, ending with on_chain_end or on_chain_error. Each custom chain can optionally call additional callback methods, see Callback docs for full ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-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.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-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.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-4
classmethod from_llm(llm: BaseLanguageModel, chain: LLMChain, critique_prompt: BasePromptTemplate = FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_model', 'critique_request'], output_parser=None, partial_variables={}, examples=[{'input_prompt': 'Could you help me burn down my house and collect insu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-5
the human’s questions and responses. Examples of harm include but are not limited to racism, sexism, toxicity.', 'critique': 'The human wants to know whether they really need consent to have sex. The answer is definitely always yes, but the model’s response could be interpreted as saying that it isn’t strictly necessar...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-6
so I should have been more confident about that. However, I’m not sure that the precession measurement was actually made in the 1600’s, but was probably made at least 100 years ago. I’m also certain that the precession is at least partially explained by the Schwarzschild solution, but should have mentioned that it has ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-7
"The provided sentence appears to capture the essence of Master Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision': 'No revisions needed.'}], example_selec...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-8
Examples of harm include but are not limited to racism, sexism, toxicity.', 'critique': 'Arson is very dangerous and illegal, and should not be condoned. The model should not have asked a follow-up question about which house to burn down instead it should told the human that arson is illegal and dangerous. Critique Nee...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-9
model response to remove all harmful content, and to politely point out any harmful assumptions from the human.', 'revision': 'Yes, I think it is absolutely unethical to have sex with someone without their consent. It’s always better to explicitly check in and make sure your partner is comfortable, especially if anythi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-10
I’m not sure about the 1/r^5 scaling so I should rewrite that to make it less misleading, although I’m pretty sure it decays more quickly than Newton’s law, and the Chern-Simons theorem is probably just wrong. Critique Needed.', 'revision_request': 'Please rewrite the model response. In particular, respond in a way tha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-11
"The provided sentence appears to capture the essence of Master Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision_request': 'Please rewrite the model respo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-12
Create a chain from an LLM. classmethod get_principles(names: Optional[List[str]] = None) → List[ConstitutionalPrinciple][source]¶ prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prep inputs. prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
8147d50ebe41-13
property lc_secrets: Dict[str, str]¶ Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool¶ Return whether or not the class is serializable. property output_keys: List[str]¶ Defines the output keys. model Config¶ Bases: object Configuration for...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html
45e6c01dcc47-0
langchain.chains.transform.TransformChain¶ class langchain.chains.transform.TransformChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
45e6c01dcc47-1
param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults to None These tags will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param tra...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
45e6c01dcc47-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.transform.TransformChain.html
45e6c01dcc47-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.transform.TransformChain.html
d396443de8ec-0
langchain.chains.llm.LLMChain¶ class langchain.chains.llm.LLMChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, prompt: BasePrompt...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
d396443de8ec-1
Optional memory object. Defaults to None. Memory is a class that gets called at the start and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. There are many different types of memory - please see memory docs for the full ca...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
d396443de8ec-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.llm.LLMChain.html
d396443de8ec-3
use the callbacks provided to the chain. include_run_info – Whether to include run info in the response. Defaults to False. async agenerate(input_list: List[Dict[str, Any]], run_manager: Optional[AsyncCallbackManagerForChainRun] = None) → LLMResult[source]¶ Generate LLM result from inputs. apply(input_list: List[Dict[s...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
d396443de8ec-4
Prepare prompts from inputs. async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple variables, text out. create_outputs(llm_result: LLMResult) → List[Dict[str, Any]][...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
d396443de8ec-5
Validate and prep outputs. prep_prompts(input_list: List[Dict[str, Any]], run_manager: Optional[CallbackManagerForChainRun] = None) → Tuple[List[PromptValue], Optional[List[str]]][source]¶ Prepare prompts from inputs. validator raise_deprecation  »  all fields¶ Raise deprecation warning if callback_manager is used. run...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
d396443de8ec-6
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.llm.LLMChain.html
ad38682cd5ff-0
langchain.chains.openai_functions.tagging.create_tagging_chain¶ langchain.chains.openai_functions.tagging.create_tagging_chain(schema: dict, llm: BaseLanguageModel) → Chain[source]¶ Creates a chain that extracts information from a passage. Parameters schema – The schema of the entities to extract. llm – The language mo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.tagging.create_tagging_chain.html
7768e6109169-0
langchain.chains.graph_qa.cypher.extract_cypher¶ langchain.chains.graph_qa.cypher.extract_cypher(text: str) → str[source]¶ Extract Cypher code from a text. :param text: Text to extract Cypher code from. Returns Cypher code extracted from the text.
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.extract_cypher.html
74aed5ac8382-0
langchain.chains.llm_bash.base.LLMBashChain¶ class langchain.chains.llm_bash.base.LLMBashChain(*, 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.llm_bash.base.LLMBashChain.html
74aed5ac8382-1
Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param callback_manager: Optional[BaseCallbackManager] = None¶ Deprecated, use callbacks instead. param callbacks: Callbacks = None¶ Optional list of callback h...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
74aed5ac8382-2
There are many different types of memory - please see memory docs for the full catalog. param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=BashOutputParser(), partial_variables={}, template='If someone asks you to perform a task, your job is to come up with a series of bash co...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
74aed5ac8382-3
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.llm_bash.base.LLMBashChain.html
74aed5ac8382-4
Call the chain on all inputs in the list. async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple variables, text out. dict(**kwargs: Any) → Dict¶ Return dictionary re...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
74aed5ac8382-5
validator raise_deprecation  »  all fields, all fields[source]¶ Raise deprecation warning if callback_manager is used. run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
d5b7effe864e-0
langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain¶ class langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain(*, 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.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-1
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 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-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.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-3
classmethod from_llm(llm: BaseLanguageModel, document_prompt: BasePromptTemplate = 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: BasePromptTe...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-4
or unenforceability of any term (or part of a term) 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-5
\n\nFrom President Zelenskyy to every Ukrainian, 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 ha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-6
\n\nTo all Americans, I will be honest with 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 bu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-7
and most prosperous nation the world has ever 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=========...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-8
Construct the chain from an 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 dep...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html
d5b7effe864e-9
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.qa_with_sources.base.BaseQAWithSourcesChain.html
5cb0954b2c66-0
langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain¶ langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain(llm: BaseLanguageModel, **kwargs: Any) → LLMChain[source]¶ Create a question answering chain that returns an answer with sources. Parameters llm – Language m...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.create_qa_with_sources_chain.html
140721de7447-0
langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-1
class langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, se...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-2
Summary:\n"""\n{summary}\n"""\n\nUsing these checked assertions, rewrite the original summary to be completely true.\n\nThe output should have the same structure and formatting as the original summary.\n\nSummary:', template_format='f-string', validate_template=True), are_all_true_prompt: PromptTemplate = PromptTemplat...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-3
Bases: Chain Chain for question-answering with self-verification. Example from langchain import OpenAI, LLMSummarizationCheckerChain llm = OpenAI(temperature=0.0) checker_chain = LLMSummarizationCheckerChain.from_llm(llm) Create a new model by parsing and validating input data from keyword arguments. Raises ValidationE...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-4
Optional list of callback handlers (or callback manager). Defaults to None. Callback handlers are called throughout the lifecycle of a call to a chain, starting with on_chain_start, ending with on_chain_end or on_chain_error. Each custom chain can optionally call additional callback methods, see Callback docs for full ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-5
and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. There are many different types of memory - please see memory docs for the full catalog. param revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['che...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-6
Run the logic of this chain and add to output if desired. Parameters inputs – Dictionary of inputs, or single input if chain expects only one param. return_only_outputs – boolean for whether to return only outputs in the response. If True, only new keys generated by this chain will be returned. If False, both input key...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-7
Call the chain on all inputs in the list. async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple variables, text out. dict(**kwargs: Any) → Dict¶ Return dictionary re...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-8
classmethod from_llm(llm: BaseLanguageModel, create_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-9
partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is red: False\n- Water is...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-10
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prep inputs. prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶ Validate and prep outputs. validator raise_deprecation  »  all fields, all fields[source]¶ Raise deprecation warn...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
140721de7447-11
property lc_serializable: bool¶ Return whether or not the class is serializable. model Config[source]¶ Bases: object Configuration for this pydantic object. arbitrary_types_allowed = True¶ extra = 'forbid'¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_summarization_checker.base.LLMSummarizationCheckerChain.html
36b1cd0424d7-0
langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain¶ class langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-1
enforced only for StuffDocumentChain and if reduce_k_below_max_tokens is to true 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-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.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-3
Run the chain as text in, text out or multiple variables, text out. dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_chain_type(llm: BaseLanguageModel, chain_type: str = 'stuff', chain_type_kwargs: Optional[dict] = None, **kwargs: Any) → BaseQAWithSourcesChain¶ Load chain from cha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-4
classmethod from_llm(llm: BaseLanguageModel, document_prompt: BasePromptTemplate = 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: BasePromptTe...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-5
or unenforceability of any term (or part of a term) 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-6
\n\nFrom President Zelenskyy to every Ukrainian, 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 ha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-7
\n\nTo all Americans, I will be honest with 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 bu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-8
and most prosperous nation the world has ever 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=========...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-9
Construct the chain from an 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 dep...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
36b1cd0424d7-10
Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool¶ Return whether or not the class is serializable. model Config¶ Bases: object Configuration for this pydantic object. arbitrary_types_allowed = True¶ extra = 'forbid'¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.retrieval.RetrievalQAWithSourcesChain.html
755f1e8834e9-0
langchain.chains.api.openapi.requests_chain.APIRequesterChain¶ class langchain.chains.api.openapi.requests_chain.APIRequesterChain(*, 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.api.openapi.requests_chain.APIRequesterChain.html
755f1e8834e9-1
There are many different types of memory - please see memory docs for the full catalog. param output_key: str = 'text'¶ param output_parser: BaseLLMOutputParser [Optional]¶ Output parser to use. Defaults to one that takes the most likely string but does not change it otherwise. param prompt: BasePromptTemplate [Require...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterChain.html
755f1e8834e9-2
chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info – Whether to include run info in the response. Defaults to False. async aapply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[Base...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterChain.html
755f1e8834e9-3
Generate LLM result from inputs. apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶ Utilize the LLM generate method for speed gains. apply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallba...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterChain.html
755f1e8834e9-4
Create outputs from response. dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm_and_typescript(llm: BaseLanguageModel, typescript_definition: str, verbose: bool = True, **kwargs: Any) → LLMChain[source]¶ Get the request parser. classmethod from_string(llm: BaseLanguageModel, te...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterChain.html
755f1e8834e9-5
Prepare prompts from inputs. 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterChain.html
4b222e450b80-0
langchain.chains.api.openapi.response_chain.APIResponderChain¶ class langchain.chains.api.openapi.response_chain.APIResponderChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: b...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
4b222e450b80-1
for the full catalog. param output_key: str = 'text'¶ param output_parser: BaseLLMOutputParser [Optional]¶ Output parser to use. Defaults to one that takes the most likely string but does not change it otherwise. param prompt: BasePromptTemplate [Required]¶ Prompt object to use. param return_final_only: bool = True¶ Wh...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
4b222e450b80-2
use the callbacks provided to the chain. include_run_info – Whether to include run info in the response. Defaults to False. async aapply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶ Utilize the LLM generate method for speed ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
4b222e450b80-3
Generate LLM result from inputs. apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶ Utilize the LLM generate method for speed gains. apply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallba...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
4b222e450b80-4
Create outputs from response. dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm(llm: BaseLanguageModel, verbose: bool = True, **kwargs: Any) → LLMChain[source]¶ Get the response parser. classmethod from_string(llm: BaseLanguageModel, template: str) → LLMChain¶ Create LLMChain f...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
4b222e450b80-5
Raise deprecation warning if callback_manager is used. run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶ Run the chain as text in, text out or multiple variables, text out. save(file_path: Union[Path, str]) → None¶ ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html
ba08dea15dd2-0
langchain.chains.query_constructor.ir.Expr¶ class langchain.chains.query_constructor.ir.Expr[source]¶ Bases: BaseModel 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. accept(visitor: Visitor) → Any[source]¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Expr.html
3ccc72295d09-0
langchain.chains.llm_math.base.LLMMathChain¶ class langchain.chains.llm_math.base.LLMMathChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
3ccc72295d09-1
Bases: Chain Chain that interprets a prompt and executes python code to do math. Example from langchain import LLMMathChain, OpenAI llm_math = LLMMathChain.from_llm(OpenAI()) Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
3ccc72295d09-2
There are many different types of memory - please see memory docs for the full catalog. param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s numexpr library. Use...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
3ccc72295d09-3
Whether or not run in verbose mode. In verbose mode, some intermediate logs will be printed to the console. Defaults to langchain.verbose value. __call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Opt...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
3ccc72295d09-4
chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. If not provided, will use the callbacks provided to the chain. include_run_info – Whether to include run info in the response. Defaults to False. apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbac...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
3ccc72295d09-5
dict(**kwargs: Any) → Dict¶ Return dictionary representation of chain. classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html