id stringlengths 14 16 | text stringlengths 4 1.28k | source stringlengths 54 121 |
|---|---|---|
07ceff43f477-216 | 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-217 | 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-218 | 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 |
07ceff43f477-219 | fact is false, explain why.\n\n', template_format='f-string', validate_template=True), revised_summary_prompt=PromptTemplate(input_variables=['checked_assertions', 'summary'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled as true or false. If t... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-220 | 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 |
07ceff43f477-221 | template_format='f-string', validate_template=True), verbose=False, **kwargs)[source] | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-222 | 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 |
07ceff43f477-223 | 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 |
07ceff43f477-224 | 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 attribute names that should be included in the
... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-225 | class langchain.chains.MapReduceChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, combine_documents_chain, text_splitter, input_key='input_text', output_key='output_text')[source]
Bases: langchain.chains.base.Chain
Map-reduce chain.
Parameters
memory (Optional[langchain.schema.BaseM... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-226 | 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-227 | There are many different types of memory - please see memory docs
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.
... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-228 | 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 be
returned. If False, both input keys and new keys generat... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-229 | 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 |
07ceff43f477-230 | Return type
Dict
classmethod from_params(llm, prompt, text_splitter, callbacks=None, combine_chain_kwargs=None, reduce_chain_kwargs=None, **kwargs)[source]
Construct a map-reduce chain that uses the chain for map and reduce.
Parameters
llm (langchain.base_language.BaseLanguageModel) –
prompt (langchain.prompts.base.B... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-231 | 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
Dict[str, str]
run(*args... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-232 | 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-233 | 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.MultiPromptChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, router_chain, destin... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-234 | tags (Optional[List[str]]) –
router_chain (langchain.chains.router.base.RouterChain) –
destination_chains (Mapping[str, langchain.chains.llm.LLMChain]) –
default_chain (langchain.chains.llm.LLMChain) –
silent_errors (bool) –
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = None
Depreca... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-235 | Default chain to use when router doesn’t map input to one of the destinations.
attribute destination_chains: Mapping[str, LLMChain] [Required]
Map of name to candidate chains that inputs can be routed to.
attribute memory: Optional[BaseMemory] = None
Optional memory object. Defaults to None.
Memory is a class that ge... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-236 | 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 callbacks.
You can use these to eg identify a specific instance of a chain with ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-237 | 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-238 | 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-239 | Parameters
llm (langchain.base_language.BaseLanguageModel) –
prompt_infos (List[Dict[str, str]]) –
default_chain (Optional[langchain.chains.llm.LLMChain]) –
kwargs (Any) –
Return type
langchain.chains.router.multi_prompt.MultiPromptChain
prep_inputs(inputs)
Validate and prep inputs.
Parameters
inputs (Union[Dict[s... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-240 | 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-241 | 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-242 | qa chains.
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]... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-243 | 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 details.
attribute default_chain: Chain [Required]
Default chain to use whe... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-244 | for the full catalog.
attribute router_chain: LLMRouterChain [Required]
Chain for deciding a destination chain and the input to it.
attribute silent_errors: bool = False
If True, use default_chain when an invalid destination name is provided.
Defaults to False.
attribute tags: Optional[List[str]] = None
Optional lis... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-245 | 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 |
07ceff43f477-246 | 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 arun(*args, callbacks=None,... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-247 | Return type
Dict
classmethod from_retrievers(llm, retriever_infos, default_retriever=None, default_prompt=None, default_chain=None, **kwargs)[source]
Parameters
llm (langchain.base_language.BaseLanguageModel) –
retriever_infos (List[Dict[str, Any]]) –
default_retriever (Optional[langchain.schema.BaseRetriever]) –
d... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-248 | 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 or multiple variables, text out.
Parameters
args (Any) –
callbacks (Optional[Union[Li... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-249 | 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 attribute names that should be included in the
... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-250 | 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 single chain to route an input to one of multiple candidate chains.
Parameters
me... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-251 | 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-252 | 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 router_chain: RouterChain [Required]
Chain that routes inputs to destina... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-253 | will be printed to the console. Defaults to langchain.verbose value.
async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False)
Run the logic of this chain and add to output if desired.
Parameters
inputs (Union[Dict[str, Any], Any]) – Dictionary of inputs, or single input if c... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-254 | 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 |
07ceff43f477-255 | tags (Optional[List[str]]) –
kwargs (Any) –
Return type
str
dict(**kwargs)
Return dictionary representation of chain.
Parameters
kwargs (Any) –
Return type
Dict
prep_inputs(inputs)
Validate and prep inputs.
Parameters
inputs (Union[Dict[str, Any], Any]) –
Return type
Dict[str, str]
prep_outputs(inputs, outputs, r... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-256 | 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-257 | 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-258 | 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 |
07ceff43f477-259 | 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-260 | 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 |
07ceff43f477-261 | 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 |
07ceff43f477-262 | 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 arun(*args, callbacks=None,... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-263 | Return type
Dict
execute(url, browser_content)[source]
Figure out next browser command to run.
Parameters
url (str) – URL of the site currently on.
browser_content (str) – Content of the page as currently displayed by the browser.
Returns
Next browser command to run.
Return type
str
Example
browser_content = "...."
ll... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-264 | 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 |
07ceff43f477-265 | tags (Optional[List[str]]) –
kwargs (Any) –
Return type
str
save(file_path)
Save the chain.
Parameters
file_path (Union[pathlib.Path, str]) – Path to file to save the chain to.
Return type
None
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
to_json()
Return type
Union[langchain.load.seriali... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-266 | Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool
Return whether or not the class is serializable.
class langchain.chain... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-267 | 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 (langchain.graphs.nebula_graph.NebulaGraph) –
ngql_generati... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-268 | starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
attribute graph: NebulaGraph [Required]
attribute memory: Optional[BaseMemory] = None
Optional memory object. Defaults to None.
Memory is a c... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-269 | These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
attribute verbose: bool [Optional]
Whether or not run in verbose mode. In verbose mode, some intermediate logs
wil... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-270 | returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to use for this chain run. If not provided, will
use the callbacks provi... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-271 | List[Dict[str, str]]
async arun(*args, callbacks=None, tags=None, **kwargs)
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) –
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) –
tags (Optional[List[s... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-272 | 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-273 | NebulaGraph Cypher statement to query a graph database.\n\nInstructions:\n\nFirst, generate cypher then convert it to NebulaGraph Cypher dialect(rather than standard):\n1. it requires explicit label specification when referring to node properties: v.`Foo`.name\n2. it uses double equals sign for comparison: `==` rather ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-274 | use any other relationship types or properties that are not provided.\nSchema:\n{schema}\nNote: Do not include any explanations or apologies in your responses.\nDo not respond to any questions that might ask anything else than for you to construct a Cypher statement.\nDo not include any text except the generated Cypher... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-275 | Initialize from LLM.
Parameters
llm (langchain.base_language.BaseLanguageModel) –
qa_prompt (langchain.prompts.base.BasePromptTemplate) –
ngql_prompt (langchain.prompts.base.BasePromptTemplate) –
kwargs (Any) –
Return type
langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain
prep_inputs(inputs)
Validate and pr... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-276 | 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-277 | 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-278 | Bases: langchain.chains.base.Chain
Pass input through a moderation endpoint.
To use, you should have the openai python package installed, and the
environment variable OPENAI_API_KEY set with your API key.
Any parameters that are valid to be passed to the openai.create call can be passed
in, even if not explicitly saved... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-279 | error (bool) –
input_key (str) –
output_key (str) –
openai_api_key (Optional[str]) –
openai_organization (Optional[str]) –
Return type
None
attribute callback_manager: Optional[BaseCallbackManager] = None
Deprecated, use callbacks instead.
attribute callbacks: Callbacks = None
Optional list of callback handlers ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-280 | Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full ca... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-281 | 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-282 | 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-283 | 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-284 | 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-285 | 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-286 | class langchain.chains.OpenAPIEndpointChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, api_request_chain, api_response_chain=None, api_operation, requests=None, param_mapping, return_intermediate_steps=False, instructions_key='instructions', output_key='output', max_text_length=None... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-287 | api_response_chain (Optional[langchain.chains.llm.LLMChain]) –
api_operation (langchain.tools.openapi.utils.api_models.APIOperation) –
requests (langchain.requests.Requests) –
param_mapping (langchain.chains.api.openapi.chain._ParamMapping) –
return_intermediate_steps (bool) –
instructions_key (str) –
output_key ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-288 | 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 details.
attribute memory: Optional[BaseMemory] = None
Optional memory obje... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-289 | These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
attribute verbose: bool [Optional]
Whether or not run in verbose mode. In verbose mode, some intermediate logs
wil... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-290 | returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to use for this chain run. If not provided, will
use the callbacks provi... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-291 | List[Dict[str, str]]
async arun(*args, callbacks=None, tags=None, **kwargs)
Run the chain as text in, text out or multiple variables, text out.
Parameters
args (Any) –
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) –
tags (Optional[List[s... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-292 | Return type
Dict
classmethod from_api_operation(operation, llm, requests=None, verbose=False, return_intermediate_steps=False, raw_response=False, callbacks=None, **kwargs)[source]
Create an OpenAPIEndpointChain from an operation and a spec.
Parameters
operation (langchain.tools.openapi.utils.api_models.APIOperation) ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-293 | classmethod from_url_and_method(spec_url, path, method, llm, requests=None, return_intermediate_steps=False, **kwargs)[source]
Create an OpenAPIEndpoint from a spec at the specified url.
Parameters
spec_url (str) –
path (str) –
method (str) –
llm (langchain.base_language.BaseLanguageModel) –
requests (Optional[lan... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-294 | 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 |
07ceff43f477-295 | 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 attribute names that should be included in the
... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-296 | class langchain.chains.PALChain(*, 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='Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-297 | On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday?\n\n# solution in Python:\n\n\ndef solution():\n """Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednes... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-298 | from monday to thursday. How many computers are now in the server room?\n\n# solution in Python:\n\n\ndef solution():\n """There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?"""\n computers_initial = 9\n... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-299 | Christmas, he got two toys each from his mom and dad. How many toys does he have now?"""\n toys_initial = 5\n mom_toys = 2\n dad_toys = 2\n total_received = mom_toys + dad_toys\n total_toys = toys_initial + total_received\n result = total_toys\n return result\n\n\n\n\n\nQ: Jason had 20 lollipops. H... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-300 | jason_lollipops_initial = 20\n jason_lollipops_after = 12\n denny_lollipops = jason_lollipops_initial - jason_lollipops_after\n result = denny_lollipops\n return result\n\n\n\n\n\nQ: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total?\n\n# solution in Py... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-301 | chocolates_left = total_chocolates - chocolates_eaten\n result = chocolates_left\n return result\n\n\n\n\n\nQ: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?\n\n# solution in Python:\n\n\ndef solution():\n """If there are 3 cars in the parking lot and 2 mor... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-302 | workers plant today?\n\n# solution in Python:\n\n\ndef solution():\n """There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?"""\n trees_initial = 15\n trees_after = 21\n trees_added ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-303 | Bases: langchain.chains.base.Chain
Implements Program-Aided Language Models.
Parameters
memory (Optional[langchain.schema.BaseMemory]) –
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) –
callback_manager (Optional[langchain.callbacks.base.B... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-304 | return_intermediate_steps (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 handlers are called throughout the lifecyc... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-305 | 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-306 | attribute prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have left?\n\n# solution in Python:\n\n\ndef solution():\n """Olivia has $23. She bought five bagels f... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-307 | at the end of wednesday?\n\n# solution in Python:\n\n\ndef solution():\n """Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday?"""\n golf_balls_initial = 58\n golf_balls_lost_tuesday = 23\n golf_balls_lost_wedne... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-308 | solution():\n """There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?"""\n computers_initial = 9\n computers_per_day = 5\n num_days = 4 # 4 days between monday and thursday\n computers_added = c... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-309 | = 5\n mom_toys = 2\n dad_toys = 2\n total_received = mom_toys + dad_toys\n total_toys = toys_initial + total_received\n result = total_toys\n return result\n\n\n\n\n\nQ: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?\n\n# s... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-310 | denny_lollipops = jason_lollipops_initial - jason_lollipops_after\n result = denny_lollipops\n return result\n\n\n\n\n\nQ: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total?\n\n# solution in Python:\n\n\ndef solution():\n """Leah had 32 chocolates and her ... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-311 | If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?\n\n# solution in Python:\n\n\ndef solution():\n """If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?"""\n cars_initial = 3\n cars_arrived = 2\n total_cars =... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-312 | will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?"""\n trees_initial = 15\n trees_after = 21\n trees_added = trees_after - trees_initial\n result = trees_added\n return result\n\n\n\n\n\nQ: {question}\n\n# solution in Pytho... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-313 | [Deprecated]
attribute python_globals: Optional[Dict[str, Any]] = None
attribute python_locals: Optional[Dict[str, Any]] = None
attribute return_intermediate_steps: bool = False
attribute stop: str = '\n\n'
attribute tags: Optional[List[str]] = None
Optional list of tags associated with the chain. Defaults to None... | https://api.python.langchain.com/en/latest/modules/chains.html |
07ceff43f477-314 | 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 |
07ceff43f477-315 | 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 arun(*args, callbacks=None,... | 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.