id stringlengths 14 16 | text stringlengths 4 1.28k | source stringlengths 54 121 |
|---|---|---|
07ceff43f477-116 | property lc_serializable: boolο
Return whether or not the class is serializable.
property output_keys: List[str]ο
Output keys for Hydeβs LLM chain.
class langchain.chains.KuzuQAChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, graph, cypher_generation_chain, qa_chain, input_key='quer... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-117 | tags (Optional[List[str]]) β
graph (langchain.graphs.kuzu_graph.KuzuGraph) β
cypher_generation_chain (langchain.chains.llm.LLMChain) β
qa_chain (langchain.chains.llm.LLMChain) β
input_key (str) β
output_key (str) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-118 | attribute graph: KuzuGraph [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 saves any returned variab... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-119 | attribute verbose: bool [Optional]ο
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to langchain.verbose value.
async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False)ο
Run the logic of this chain and add t... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-120 | chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info (bool) β Whether to include run ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-121 | Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
dict(**kwargs)ο
Return dictionary re... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-122 | 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 |
07ceff43f477-123 | graph database.\n\nInstructions:\n\nGenerate statement with KΓΉzu Cypher dialect (rather than standard):\n1. do not use `WHERE EXISTS` clause to check the existence of a property because KΓΉzu database has a fixed schema.\n2. do not omit relationship pattern. Always use `()-[]->()` instead of `()->()`.\n3. do not include... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-124 | template_format='f-string', validate_template=True), **kwargs)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-125 | 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 |
07ceff43f477-126 | Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
save(file_path)ο
Save the chain.
Par... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-127 | property lc_attributes: Dictο
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-128 | class langchain.chains.LLMBashChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain, llm=None, input_key='question', output_key='answer', prompt=PromptTemplate(input_variables=['question'], output_parser=BashOutputParser(), partial_variables={}, template='If someone asks you to... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-129 | the second directory\n```bash\nls\nmkdir myNewDirectory\ncp -r target/* myNewDirectory\n```\n\nThat is the format. Begin!\n\nQuestion: {question}', template_format='f-string', validate_template=True), bash_process=None)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-130 | Bases: langchain.chains.base.Chain
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.callbac... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-131 | bash_process (langchain.utilities.bash.BashProcess) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called thr... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-132 | 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. | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-133 | attribute 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 commands that will perform the task. There is no need to put "#!/bin/bash" in your ans... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-134 | {question}', template_format='f-string', validate_template=True)ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-135 | [Deprecated]
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its us... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-136 | 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 |
07ceff43f477-137 | 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 |
07ceff43f477-138 | 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 need to put "#!/bin/bash" in your answer. M... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-139 | {question}', template_format='f-string', validate_template=True), **kwargs)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-140 | Parameters
llm (langchain.base_language.BaseLanguageModel) β
prompt (langchain.prompts.base.BasePromptTemplate) β
kwargs (Any) β
Return type
langchain.chains.llm_bash.base.LLMBashChain
prep_inputs(inputs)ο
Validate and prep inputs.
Parameters
inputs (Union[Dict[str, Any], Any]) β
Return type
Dict[str, str]
prep_out... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-141 | 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 |
07ceff43f477-142 | 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 argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_K... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-143 | 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)
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optiona... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-144 | return_final_only (bool) β
llm_kwargs (dict) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughou... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-145 | 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 output_parser: BaseLLMOutputParser [Optional]ο
Output parser to use.
Defa... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-146 | 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 |
07ceff43f477-147 | 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, include_run_info=False)ο
Run the logic of this chain a... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-148 | chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info (bool) β Whether to include run ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-149 | 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 |
07ceff43f477-150 | **kwargs β Keys to pass to prompt template.
kwargs (Any) β
Returns
Completion from LLM.
Return type
str
Example
completion = llm.predict(adjective="funny")
async apredict_and_parse(callbacks=None, **kwargs)[source]ο
Call apredict and then parse the results.
Parameters
callbacks (Optional[Union[List[langchain.callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-151 | async arun(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any)... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-152 | Parameters
llm (langchain.base_language.BaseLanguageModel) β
template (str) β
Return type
langchain.chains.llm.LLMChain
generate(input_list, run_manager=None)[source]ο
Generate LLM result from inputs.
Parameters
input_list (List[Dict[str, Any]]) β
run_manager (Optional[langchain.callbacks.manager.CallbackManagerForC... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-153 | 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.BaseCallbackManager]]) β
kwargs (Any) β
Re... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-154 | Return type
Dict[str, str]
prep_prompts(input_list, run_manager=None)[source]ο
Prepare prompts from inputs.
Parameters
input_list (List[Dict[str, Any]]) β
run_manager (Optional[langchain.callbacks.manager.CallbackManagerForChainRun]) β
Return type
Tuple[List[langchain.schema.PromptValue], Optional[List[str]]]
run(*ar... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-155 | Save the chain.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the chain to.
Return type
None
Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplement... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-156 | Return a map of constructor argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_KEYβ}
property lc_serializable: boolο
Return whether or not the class is serializable. | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-157 | 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'], output_parser=None, partial_variables={}, template='{question}\n\n', template_for... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-158 | it is false, explain why.\n\n', template_format='f-string', validate_template=True), revised_answer_prompt=PromptTemplate(input_variables=['checked_assertions', 'question'], output_parser=None, partial_variables={}, template="{checked_assertions}\n\nQuestion: In light of the above assertions and checks, how would you a... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-159 | Bases: langchain.chains.base.Chain
Chain for question-answering with self-verification.
Example
from langchain import OpenAI, LLMCheckerChain
llm = OpenAI(temperature=0.7)
checker_chain = LLMCheckerChain.from_llm(llm)
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-160 | list_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
check_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
revised_answer_prompt (langchain.prompts.prompt.PromptTemplate) β
input_key (str) β
output_key (str) β
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-161 | for full details.
attribute check_assertions_prompt: PromptTemplate = PromptTemplate(input_variables=['assertions'], output_parser=None, partial_variables={}, template='Here is a bullet point list of assertions:\n{assertions}\nFor each assertion, determine whether it is true or false. If it is false, explain why.\n\n',... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-162 | [Deprecated]
attribute llm: Optional[BaseLanguageModel] = Noneο
[Deprecated] LLM wrapper to use.
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 al... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-163 | attribute revised_answer_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'question'], output_parser=None, partial_variables={}, template="{checked_assertions}\n\nQuestion: In light of the above assertions and checks, how would you answer the question '{question}'?\n\nAnswer:", template_fo... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-164 | async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False)ο
Run the logic of this chain and add to output if desired.
Parameters
inputs (Union[Dict[str, Any], Any]) β Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs (bool) β boolean for... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-165 | to False.
tags (Optional[List[str]]) β
Return type
Dict[str, Any]
apply(input_list, callbacks=None)ο
Call the chain on all inputs in the list.
Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-166 | Return dictionary representation of chain.
Parameters
kwargs (Any) β
Return type
Dict | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-167 | classmethod from_llm(llm, create_draft_answer_prompt=PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='{question}\n\n', template_format='f-string', validate_template=True), list_assertions_prompt=PromptTemplate(input_variables=['statement'], output_parser=None, partial_var... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-168 | 'question'], output_parser=None, partial_variables={}, template="{checked_assertions}\n\nQuestion: In light of the above assertions and checks, how would you answer the question '{question}'?\n\nAnswer:", template_format='f-string', validate_template=True), **kwargs)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-169 | Parameters
llm (langchain.base_language.BaseLanguageModel) β
create_draft_answer_prompt (langchain.prompts.prompt.PromptTemplate) β
list_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
check_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
revised_answer_prompt (langchain.prompts.prompt.P... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-170 | Return type
Dict[str, str]
run(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[st... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-171 | to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
property lc_attributes: Dictο
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-172 | 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='Translate a math problem into a expression that can be executed using Python\'s... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-173 | * 67")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True), input_key='question', output_key... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-174 | Bases: langchain.chains.base.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())
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCa... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-175 | Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting wi... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-176 | 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. | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-177 | 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. Use the output of running this code to answer the question.\n\nQuestion: ${{Question wi... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-178 | 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True)ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-179 | [Deprecated] Prompt to use to translate to python if necessary.
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-180 | only one param.
return_only_outputs (bool) β boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-181 | callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict[str, str]]
async arun(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-182 | classmethod from_llm(llm, prompt=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 the output of running this code to answer the question.\n\nQuestion: ${{Question with mat... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-183 | 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate("37593**(1/5)")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: {question}\n', template_format='f-string', validate_template=True), **kwargs)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-184 | Parameters
llm (langchain.base_language.BaseLanguageModel) β
prompt (langchain.prompts.base.BasePromptTemplate) β
kwargs (Any) β
Return type
langchain.chains.llm_math.base.LLMMathChain
prep_inputs(inputs)ο
Validate and prep inputs.
Parameters
inputs (Union[Dict[str, Any], Any]) β
Return type
Dict[str, str]
prep_out... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-185 | 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 |
07ceff43f477-186 | 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 argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_K... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-187 | Bases: langchain.chains.base.Chain
Chain that hits a URL and then uses an LLM to parse results.
Parameters
memory (Optional[langchain.schema.BaseMemory]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langcha... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-188 | attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callba... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-189 | attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
attri... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-190 | only one param.
return_only_outputs (bool) β boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-191 | callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict[str, str]]
async arun(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) β
callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-192 | 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
Dict[str, str]
run(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text out o... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-193 | Return type
None
Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented]
to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
prope... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-194 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chains.LLMRouterChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, llm_chain)[source]ο
Bases: langchain.chains.router.base.RouterChain
A router chain that uses an LLM chain to perform rout... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-195 | Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain ca... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-196 | for the full catalog.
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain wi... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-197 | only one param.
return_only_outputs (bool) β boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-198 | callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict[str, str]]
async aroute(inputs, callbacks=None)ο
Parameters
inputs (Dict[str, Any]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], lang... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-199 | str
dict(**kwargs)ο
Return dictionary representation of chain.
Parameters
kwargs (Any) β
Return type
Dict
classmethod from_llm(llm, prompt, **kwargs)[source]ο
Convenience constructor.
Parameters
llm (langchain.base_language.BaseLanguageModel) β
prompt (langchain.prompts.base.BasePromptTemplate) β
kwargs (Any) β
Ret... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-200 | Return type
Dict[str, str]
route(inputs, callbacks=None)ο
Parameters
inputs (Dict[str, Any]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
langchain.chains.router.base.Route
run(*args, callbacks=None, tags=None, **kwargs)ο... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-201 | Return type
None
Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented]
to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
prope... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-202 | property lc_serializable: boolο
Return whether or not the class is serializable.
property output_keys: List[str]ο
Output keys this chain expects. | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-203 | 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 |
07ceff43f477-204 | is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".\nIf the fact is false, explain why.\n\n', template_format='f-string', validate_template=True), revised_summary_prompt=PromptTemplate(input_variables=['checked_assertions', 'summary'], output_pars... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-205 | 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 |
07ceff43f477-206 | False\n\n===\n\nChecked Assertions:"""\n{checked_assertions}\n"""\nResult:', template_format='f-string', validate_template=True), input_key='query', output_key='result', max_checks=2)[source]ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-207 | 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 |
07ceff43f477-208 | check_assertions_prompt (langchain.prompts.prompt.PromptTemplate) β
revised_summary_prompt (langchain.prompts.prompt.PromptTemplate) β
are_all_true_prompt (langchain.prompts.prompt.PromptTemplate) β
input_key (str) β
output_key (str) β
max_checks (int) β
Return type
None | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-209 | 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, return "True". If any of the assertions... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-210 | False\n- The sun is a star - True\n"""\nResult: False\n\n===\n\nChecked Assertions:"""\n{checked_assertions}\n"""\nResult:', template_format='f-string', validate_template=True)ο | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-211 | [Deprecated]
attribute callback_manager: Optional[BaseCallbackManager] = Noneο
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = Noneο
Optional list of callback handlers (or callback manager). Defaults to None.
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with o... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-212 | 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 news organization to fact check a very important story.\n\nHere is a bullet point list o... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-213 | [Deprecated]
attribute 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:', template_format='f... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-214 | 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 revised_summary_prompt: PromptTemplate = PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, tem... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-215 | attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
attri... | 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.