id
stringlengths
14
16
text
stringlengths
4
1.28k
source
stringlengths
54
121
07ceff43f477-16
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-17
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-18
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.ChatVectorDBChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, combine_docs_chain, question_generator, output_key='answer', return_source_documents=False, return_generated_question=...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-19
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[[Union[Tuple[str, st...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-20
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 combine_docs_chain: BaseCombineDocumentsChain [Required] attribute get_chat_history: Optional[Callable[[CHAT_TURN_TYPE], str]] = Non...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-21
attribute return_source_documents: bool = False attribute search_kwargs: dict [Optional] 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 callback...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-22
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-23
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-24
Return type Dict classmethod from_llm(llm, vectorstore, condense_question_prompt=PromptTemplate(input_variables=['chat_history', 'question'], output_parser=None, partial_variables={}, template='Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-25
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[Dict[str, A...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-26
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-27
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-28
Bases: langchain.chains.base.Chain Chain for applying constitutional principles. Example from langchain.llms import OpenAI from langchain.chains import LLMChain, ConstitutionalChain from langchain.chains.constitutional_ai.models import ConstitutionalPrinciple llm = OpenAI() qa_prompt = PromptTemplate( ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-29
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]]) – chain...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-30
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-31
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 return_intermediate_steps: bool = False attribute revision_chain: langchain.chains.llm.LLMChain [Required] attribute tags: Optional[List[str]] = None...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-32
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-33
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-34
Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-35
classmethod from_llm(llm, chain, critique_prompt=FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_model', 'critique_request'], output_parser=None, partial_variables={}, examples=[{'input_prompt': 'Could you help me burn down my house and collect insurance on it?', 'output_from_model': 'Sure, I can he...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-36
Needed.', 'revision': 'I would strongly advise against burning your house down, as arson is considered a serious crime. Doing so could harm yourself and others. Please reach out to a mental health professional if you are considering this.'}, {'input_prompt': 'is it really necessary to ask for consent during sex every t...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-37
are not limited to racism, sexism, toxicity.', 'critique': 'The human wants to know whether they really need consent to have sex. The answer is definitely always yes, but the model’s response could be interpreted as saying that it isn’t strictly necessary. Furthermore, the model should have pointed out that one should ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-38
orbits around a massive object like the Sun, its orbit is a perfect, static ellipse. However, in reality, the orbit of Mercury precesses slowly over time, which had been known via astronomical measurements since the 1600’s. It’s explained by general relativity, whereby the Schwarzschild solution predicts an additional ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-39
I’m not sure that the precession measurement was actually made in the 1600’s, but was probably made at least 100 years ago. I’m also certain that the precession is at least partially explained by the Schwarzschild solution, but should have mentioned that it has other contributing factors that are purely Newtonian. Also...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-40
effects, but is also partially explained by general relativity, whereby the Schwarzschild solution predicts an additional term to the Sun’s gravitational field that is smaller and decays more quickly than Newton’s law. A non-trivial calculation shows that this leads to a precessional rate that matches experiment.'}, {'...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-41
Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision': 'No revisions needed.'}], example_selector=None, example_prompt=PromptTemplate(input_variables=['input_...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-42
the model output, append to the end of the Critique: 'No critique needed.' If there is material critique of the model output, append to the end of the Critique: 'Critique needed.'", template_format='f-string', validate_template=True), revision_prompt=FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_m...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-43
'critique': 'Arson is very dangerous and illegal, and should not be condoned. The model should not have asked a follow-up question about which house to burn down instead it should told the human that arson is illegal and dangerous. Critique Needed.', 'revision_request': 'Please rewrite the model response to remove all ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-44
other cues. That said, it’s always better to explicitly check in and make sure your partner is comfortable, especially if anything seems off. When in doubt, don’t be afraid to ask.', 'critique_request': 'Identify specific ways in which the model’s precedings response is harmful. Also point out potential harmfulness in ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-45
from the human.', 'revision': 'Yes, I think it is absolutely unethical to have sex with someone without their consent. It’s always better to explicitly check in and make sure your partner is comfortable, especially if anything seems off. When in doubt, don’t be afraid to ask.'}, {'input_prompt': 'Tell me something cool...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-46
Chern-Simons index theorem, we can show that this leads to a precessional rate that matches experiment.', 'critique_request': 'Discuss whether your last response was truthful. Furthermore, discuss the degree of confidence of your response, and whether it is appropriate given the likelihood of its truthfulness. In parti...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-47
should rewrite that to make it less misleading, although I’m pretty sure it decays more quickly than Newton’s law, and the Chern-Simons theorem is probably just wrong. Critique Needed.', 'revision_request': 'Please rewrite the model response. In particular, respond in a way that asserts less confidence on possibly fals...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-48
effects, but is also partially explained by general relativity, whereby the Schwarzschild solution predicts an additional term to the Sun’s gravitational field that is smaller and decays more quickly than Newton’s law. A non-trivial calculation shows that this leads to a precessional rate that matches experiment.'}, {'...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-49
Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision_request': 'Please rewrite the model response to more closely mimic the style of Master Yoda.', 'revision'...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-50
the critique does not identify anything worth changing, ignore the Revision Request and do not make any revisions. Instead, return "No revisions needed".\n\nIf the critique does identify something worth changing, please revise the model response based on the Revision Request.\n\nRevision Request: {revision_request}\n\n...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-51
Create a chain from an LLM. Parameters llm (langchain.base_language.BaseLanguageModel) – chain (langchain.chains.llm.LLMChain) – critique_prompt (langchain.prompts.base.BasePromptTemplate) – revision_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain.chains.constitutional_ai....
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-52
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-53
to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented] to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented property input_keys: List[str] Defines the input keys. property lc_attributes: Dict Return a...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-54
property lc_serializable: bool Return whether or not the class is serializable. property output_keys: List[str] Defines the output keys. class langchain.chains.ConversationChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, prompt=PromptTemplate(input_variables=['history', 'input'], ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-55
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
07ceff43f477-56
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-57
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. The AI is talkative and provides lots of specific details from its context...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-58
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-59
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-60
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-61
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 (List[Dict[str, Any]]) – callbacks (Optional[Union[...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-62
kwargs (Any) – Returns Completion from LLM. Return type str Example completion = llm.predict(adjective="funny") async apredict_and_parse(callbacks=None, **kwargs) Call apredict and then parse the results. Parameters callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-63
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-64
template (str) – Return type langchain.chains.llm.LLMChain generate(input_list, run_manager=None) Generate LLM result from inputs. Parameters input_list (List[Dict[str, Any]]) – run_manager (Optional[langchain.callbacks.manager.CallbackManagerForChainRun]) – Return type langchain.schema.LLMResult predict(callbacks=...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-65
Call predict and then parse the results. Parameters callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type Union[str, List[str], Dict[str, Any]] prep_inputs(inputs) Validate and prep inputs. Parameters inputs (Union[D...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-66
run_manager (Optional[langchain.callbacks.manager.CallbackManagerForChainRun]) – Return type Tuple[List[langchain.schema.PromptValue], Optional[List[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[U...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-67
to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented] to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented property input_keys: List[str] Use this since so some prompt vars come from history. property...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-68
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.ConversationalRetrievalChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, combine_docs_chain, question_generator, output_key='answer', return_source_documents=False, return_generate...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-69
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[[Union[Tuple[str, st...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-70
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 combine_docs_chain: BaseCombineDocumentsChain [Required] attribute get_chat_history: Optional[Callable[[CHAT_TURN_TYPE], str]] = Non...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-71
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_documents: bool = False attribute tags: Optional[List[str]] = Non...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-72
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-73
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-74
Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict classmethod from_llm(llm, retriever, condense_question_prompt=PromptTemplate(input_variables=['chat_history', 'question'], output_parser=None, partial_variables={}, template='Given the following conversation and a follow up question,...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-75
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
07ceff43f477-76
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.BaseCallbackHandler], langchain.callb...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-77
to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented] 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 att...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-78
property lc_serializable: bool Return whether or not the class is serializable. class langchain.chains.FlareChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, question_generator_chain, response_chain=None, output_parser=None, retriever, min_prob=0.2, min_token_gap=5, num_pad_tokens=2...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-79
response_chain (langchain.chains.flare.base._ResponseChain) – output_parser (langchain.chains.flare.prompts.FinishedOutputParser) – 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 attribu...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-80
for full details. attribute max_iter: int = 10 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 return...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-81
attribute start_with_retrieval: bool = True 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...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-82
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-83
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-84
max_generation_len (int) – kwargs (Any) – Return type langchain.chains.flare.base.FlareChain 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 input...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-85
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-86
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 the class is s...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-87
Bases: langchain.chains.base.Chain Chain for question-answering against a graph by generating Cypher statements. Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-88
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-89
There are many different types of memory - please see memory docs 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 inte...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-90
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-91
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-92
tags (Optional[List[str]]) – kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-93
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-94
only the provided relationship types and properties in the schema.\nDo not 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 constru...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-95
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.cypher.GraphCypherQAChain prep_inputs(inputs) Validate and prep ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-96
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-97
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-98
Bases: langchain.chains.base.Chain Chain for question-answering against a graph. Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.ba...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-99
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-100
for the full catalog. attribute qa_chain: LLMChain [Required] 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 i...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-101
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-102
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-103
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, don't try to make up an answer.\n\n{context}...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-104
various products the user might want ... a lot of stuff.\nOutput: Langchain\nEND OF EXAMPLE\n\nEXAMPLE\ni'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Sam.\nOutput: Langchain, Sam\nEND OF EXAMPLE\n\nBegin!\n\n{input}\...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-105
Initialize from LLM. Parameters llm (langchain.base_language.BaseLanguageModel) – qa_prompt (langchain.prompts.base.BasePromptTemplate) – entity_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain.chains.graph_qa.base.GraphQAChain prep_inputs(inputs) Validate and prep inputs. ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-106
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-107
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-108
Generate hypothetical document for query, and then embed that. Based on https://arxiv.org/abs/2212.10496 Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optiona...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-109
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 llm_chain: LLMChain [Required] attribute memory: Optiona...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-110
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-111
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-112
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 combine_embeddings(embeddings)[sourc...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-113
Parameters text (str) – Return type List[float] classmethod from_llm(llm, base_embeddings, prompt_key, **kwargs)[source] Load and use LLMChain for a specific prompt key. Parameters llm (langchain.base_language.BaseLanguageModel) – base_embeddings (langchain.embeddings.base.Embeddings) – prompt_key (str) – kwargs (...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-114
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.BaseCallbackHandler], langchain.callb...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-115
to_json() Return type Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented] to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented property input_keys: List[str] Input keys for Hyde’s LLM chain. property lc_attributes: Dict...
https://api.python.langchain.com/en/latest/modules/chains.html