id stringlengths 14 16 | text stringlengths 31 2.41k | source stringlengths 53 121 |
|---|---|---|
81099a94f427-27 | Bases: langchain.chains.llm.LLMChain
Chain to have a conversation and load context from memory.
Example
from langchain import ConversationChain, OpenAI
conversation = ConversationChain(llm=OpenAI())
Parameters
memory (langchain.schema.BaseMemory) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHa... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-28 | Defaults to one that takes the most likely string but does not change it
otherwise.
attribute prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template='The following is a friendly conversation between a human and an AI. T... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-29 | Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
Sequence[Union[str, List[str], Dict[str, str]]]
async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, includ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-30 | 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]]
apply_and_parse(input_list, callbacks=None)ο
Call apply and then parse the results.
Parameters
input_list (Lis... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-31 | Return type
Tuple[List[langchain.schema.PromptValue], Optional[List[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.callback... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-32 | Returns
Completion from LLM.
Return type
str
Example
completion = llm.predict(adjective="funny")
predict_and_parse(callbacks=None, **kwargs)ο
Call predict and then parse the results.
Parameters
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-33 | 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 |
81099a94f427-34 | verbose (bool) β
tags (Optional[List[str]]) β
combine_docs_chain (langchain.chains.combine_documents.base.BaseCombineDocumentsChain) β
question_generator (langchain.chains.llm.LLMChain) β
output_key (str) β
return_source_documents (bool) β
return_generated_question (bool) β
get_chat_history (Optional[Callable[[U... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-35 | There are many different types of memory - please see memory docs
for the full catalog.
attribute output_key: str = 'answer'ο
attribute question_generator: LLMChain [Required]ο
attribute retriever: BaseRetriever [Required]ο
Index to connect to.
attribute return_generated_question: bool = Falseο
attribute return_source_... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-36 | 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 |
81099a94f427-37 | condense_question_prompt (langchain.prompts.base.BasePromptTemplate) β
chain_type (str) β
verbose (bool) β
condense_question_llm (Optional[langchain.base_language.BaseLanguageModel]) β
combine_docs_chain_kwargs (Optional[Dict]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langcha... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-38 | to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
property input_keys: List[str]ο
Input keys.
property lc_attributes: Dictο
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_names... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-39 | retriever (langchain.schema.BaseRetriever) β
min_prob (float) β
min_token_gap (int) β
num_pad_tokens (int) β
max_iter (int) β
start_with_retrieval (bool) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
O... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-40 | 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.
attribute verbose: bool [Optional]ο
Whether or no... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-41 | 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 (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Opt... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-42 | 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 |
81099a94f427-43 | 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]]) β
graph... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-44 | for the full catalog.
attribute qa_chain: LLMChain [Required]ο
attribute return_direct: bool = Falseο
Whether or not to return the result of querying the graph directly.
attribute return_intermediate_steps: bool = Falseο
Whether or not to return the intermediate steps along with the final answer.
attribute tags: Option... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-45 | 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 |
81099a94f427-46 | Parameters
kwargs (Any) β
Return type
Dict
classmethod from_llm(llm, *, qa_prompt=PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="You are an assistant that helps to form nice and human understandable answers.\nThe information part contains the provided inform... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-47 | Return type
langchain.chains.graph_qa.cypher.GraphCypherQAChain
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 (... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-48 | 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.chains.GraphQAChain(*, memory=None, callbacks=None,... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-49 | Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
attribute entity_extraction_chain: LLMChain [Required]ο
attribute graph: NetworkxEntityGraph [Required]ο
attribute memory: Optional[BaseMemory] = Noneο
Optional memory object. Defaults to None.
Memory is a class that ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-50 | 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 |
81099a94f427-51 | Parameters
kwargs (Any) β
Return type
Dict
classmethod from_llm(llm, qa_prompt=PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="Use the following knowledge triplets to answer the question at the end. If you don't know the answer, just say that you don't know, ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-52 | 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 |
81099a94f427-53 | 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.HypotheticalDocumentEmbedder(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, base_emb... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-54 | 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 |
81099a94f427-55 | 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]]) β
Return ty... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-56 | prompt_key (str) β
kwargs (Any) β
Return type
langchain.chains.hyde.base.HypotheticalDocumentEmbedder
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.
Paramet... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-57 | constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_KEYβ}
property lc_serializable: boolο
Return whether or not t... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-58 | 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/modules/chains.html |
81099a94f427-59 | 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.base.BaseCallba... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-60 | classmethod from_llm(llm, *, qa_prompt=PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="You are an assistant that helps to form nice and human understandable answers.\nThe information part contains the provided information that you must use to construct an answ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-61 | Initialize from LLM.
Parameters
llm (langchain.base_language.BaseLanguageModel) β
qa_prompt (langchain.prompts.base.BasePromptTemplate) β
cypher_prompt (langchain.prompts.base.BasePromptTemplate) β
kwargs (Any) β
Return type
langchain.chains.graph_qa.kuzu.KuzuQAChain
prep_inputs(inputs)ο
Validate and prep inputs.
P... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-62 | Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-63 | Chain that interprets a prompt and executes bash code to perform bash operations.
Example
from langchain import LLMBashChain, OpenAI
llm_bash = LLMBashChain.from_llm(OpenAI())
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langc... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-64 | and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
attribute prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'],... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-65 | 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 whether to return only outputs in the
response. If True, only new keys generated by this chain will b... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-66 | Parameters
kwargs (Any) β
Return type
Dict
classmethod from_llm(llm, prompt=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 commands that will perform the task. There is no... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-67 | 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[str]]) β
kwargs (Any) β
Ret... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-68 | Bases: langchain.chains.base.Chain
Chain to run queries against LLMs.
Example
from langchain import LLMChain, OpenAI, PromptTemplate
prompt_template = "Tell me a {adjective} joke"
prompt = PromptTemplate(
input_variables=["adjective"], template=prompt_template
)
llm = LLMChain(llm=OpenAI(), prompt=prompt)
Parameter... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-69 | 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 |
81099a94f427-70 | Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
Sequence[Union[str, List[str], Dict[str, str]]]
async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, includ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-71 | 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]]
apply_and_parse(input_list, callbacks=None)[source]ο
Call apply and then parse the results.
Parameters
input_l... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-72 | Return type
Tuple[List[langchain.schema.PromptValue], Optional[List[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.callback... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-73 | Returns
Completion from LLM.
Return type
str
Example
completion = llm.predict(adjective="funny")
predict_and_parse(callbacks=None, **kwargs)[source]ο
Call predict and then parse the results.
Parameters
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-74 | 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 |
81099a94f427-75 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chains.LLMCheckerChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, question_to_checked_assertions_chain, llm=None, create_draft_answer_prompt=PromptTemplate(input_variables=['question'], ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-76 | 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]]) β
quest... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-77 | [Deprecated]
attribute create_draft_answer_prompt: PromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='{question}\n\n', template_format='f-string', validate_template=True)ο
[Deprecated]
attribute list_assertions_prompt: PromptTemplate = PromptTemplate(input_... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-78 | 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
will be printed to the console. Defaults to langchain.verbose v... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-79 | 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 |
81099a94f427-80 | list_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
check_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
revised_answer_prompt (langchain.prompts.prompt.PromptTemplate) β
kwargs (Any) β
Return type
langchain.chains.llm_checker.base.LLMCheckerChain
prep_inputs(inputs)ο
Validate and prep... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-81 | Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-82 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chains.LLMMathChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, llm=None, prompt=PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-83 | 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]]) β
llm_c... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-84 | There are many different types of memory - please see memory docs
for the full catalog.
attribute 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.... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-85 | Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False)ο
Run the logic of this chain and add to output if desired.
Parameters
inpu... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-86 | tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
dict(**kwargs)ο
Return dictionary representation of chain.
Parameters
kwargs (Any) β
Return type
Dict
classmethod from_llm(llm, prompt=PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-87 | 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 |
81099a94f427-88 | 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.LLMRequestsChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, requests_... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-89 | for full details.
attribute llm_chain: LLMChain [Required]ο
attribute memory: Optional[BaseMemory] = Noneο
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it save... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-90 | 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 |
81099a94f427-91 | return_only_outputs (bool) β
Return type
Dict[str, str]
run(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManage... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-92 | Bases: langchain.chains.router.base.RouterChain
A router chain that uses an LLM chain to perform routing.
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Option... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-93 | You can use these to eg identify a specific instance of a chain with its use case.
attribute verbose: bool [Optional]ο
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
async acall(inputs, return_only_outputs=False, callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-94 | Return type
langchain.chains.router.base.Route
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]]... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-95 | 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 |
81099a94f427-96 | class langchain.chains.LLMSummarizationCheckerChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, sequential_chain, llm=None, create_assertions_prompt=PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of fact... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-97 | output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is re... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-98 | Bases: langchain.chains.base.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)
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Opti... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-99 | max_checks (int) β
Return type
None
attribute are_all_true_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false.\n\nIf all of the assertions are true, re... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-100 | Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
attribute check_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['assertions'], output_parser=None, partial_variables={}, template='You are an expert fact checker. You have been hired by a major new... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-101 | There are many different types of memory - please see memory docs
for the full catalog.
attribute revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are l... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-102 | response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β Callbacks to use ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-103 | classmethod from_llm(llm, create_assertions_prompt=PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts:', template_format='f-string', valid... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-104 | true or false.\n\nIf all of the assertions are true, return "True". If any of the assertions are false, return "False".\n\nHere are some examples:\n===\n\nChecked Assertions: """\n- The sky is red: False\n- Water is made of lava: False\n- The sun is a star: True\n"""\nResult: False\n\n===\n\nChecked Assertions: """\n- ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-105 | Parameters
llm (langchain.base_language.BaseLanguageModel) β
create_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
check_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
revised_summary_prompt (langchain.prompts.prompt.PromptTemplate) β
are_all_true_prompt (langchain.prompts.prompt.Promp... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-106 | 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 |
81099a94f427-107 | 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/modules/chains.html |
81099a94f427-108 | 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.base.BaseCallba... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-109 | Construct a map-reduce chain that uses the chain for map and reduce.
Parameters
llm (langchain.base_language.BaseLanguageModel) β
prompt (langchain.prompts.base.BasePromptTemplate) β
text_splitter (langchain.text_splitter.TextSplitter) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], l... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-110 | chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented]
to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
property lc_attributes: Dictο
Return a list of attribu... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-111 | default_chain (langchain.chains.llm.LLMChain) β
silent_errors (bool) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handl... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-112 | You can use these to eg identify a specific instance of a chain with its use case.
attribute verbose: bool [Optional]ο
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
async acall(inputs, return_only_outputs=False, callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-113 | Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
dict(**kwargs)ο
Return dictionary representation of chain.
Parameters
kwargs (Any) β
Return type
Dict
c... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-114 | Return type
str
save(file_path)ο
Save the chain.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the chain to.
Return type
None
Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.se... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-115 | verbose (bool) β
tags (Optional[List[str]]) β
router_chain (langchain.chains.router.llm_router.LLMRouterChain) β
destination_chains (Mapping[str, langchain.chains.retrieval_qa.base.BaseRetrievalQA]) β
default_chain (langchain.chains.base.Chain) β
silent_errors (bool) β
Return type
None
attribute callback_manager:... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-116 | If True, use default_chain when an invalid destination name is provided.
Defaults to False.
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbac... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-117 | Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict[str, str]]
async arun(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variabl... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-118 | inputs (Dict[str, str]) β
outputs (Dict[str, str]) β
return_only_outputs (bool) β
Return type
Dict[str, str]
run(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallba... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-119 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chains.MultiRouteChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, router_chain, destination_chains, default_chain, silent_errors=False)[source]ο
Bases: langchain.chains.base.Chain
Use a ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-120 | Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full ca... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-121 | use the callbacks provided to the chain.
include_run_info (bool) β Whether to include run info in the response. Defaults
to False.
tags (Optional[List[str]]) β
Return type
Dict[str, Any]
apply(input_list, callbacks=None)ο
Call the chain on all inputs in the list.
Parameters
input_list (List[Dict[str, Any]]) β
callbac... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-122 | Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
save(file_path)ο
Save the chain.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-123 | Implement an LLM driven browser.
Example
from langchain import NatBotChain
natbot = NatBotChain.from_default("Buy me a new hat.")
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-124 | them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
attribute objective: str [Required]ο
Objective that NatBot is tasked with completing.
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-125 | Return type
Dict[str, Any]
apply(input_list, callbacks=None)ο
Call the chain on all inputs in the list.
Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict[str, str]]
async ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-126 | objective (str) β
kwargs (Any) β
Return type
langchain.chains.natbot.base.NatBotChain
prep_inputs(inputs)ο
Validate and prep inputs.
Parameters
inputs (Union[Dict[str, Any], Any]) β
Return type
Dict[str, str]
prep_outputs(inputs, outputs, return_only_outputs=False)ο
Validate and prep outputs.
Parameters
inputs (Dict... | https://api.python.langchain.com/en/latest/modules/chains.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.