id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
408ec4da345f-7
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
408ec4da345f-8
Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be set by the chain’s memory. Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str,...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
408ec4da345f-9
these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: chain.run("What's the temperature in Boise, Idaho?")...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
408ec4da345f-10
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.AnalyzeDocumentChain.html
f5b78b92b09d-0
langchain.chains.graph_qa.arangodb.ArangoGraphQAChain¶ class langchain.chains.graph_qa.arangodb.ArangoGraphQAChain[source]¶ Bases: Chain Chain for question-answering against a graph by generating AQL statements. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if th...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param qa_chain: LLMChain [Required]¶ param return_aql_query: bool = False¶ param return_aql_result: bool = False¶ param tags: Optional[List[str]] = None¶ Optional list of tags...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-2
callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the c...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-3
returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects....
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-4
with all the inputs Parameters *args – If the chain expects a single input, it can be passed in as the sole positional argument. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to call...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-6
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-7
classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['adb_schema', 'user_input', 'aql_query', 'aql_result'], template="Task: Generate a natural language `Summary` from the results of an ArangoDB Query Language query.\n\nYou are an ArangoDB Query Language (AQL) ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-8
'aql_examples', 'user_input'], template="Task: Generate an ArangoDB Query Language (AQL) query from a User Input.\n\nYou are an ArangoDB Query Language (AQL) expert responsible for translating a `User Input` into an ArangoDB Query Language (AQL) query.\n\nYou are given an `ArangoDB Schema`. It is a JSON Object containi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-9
the `AQL Query Examples`. \n- Do not include any text except the generated AQL Query.\n- Do not provide explanations or apologies in your responses.\n- Do not generate an AQL Query that removes or deletes any data.\n\nUnder no circumstance should you generate an AQL Query that deletes any data whatsoever.\n\nArangoDB S...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-10
Query` wrapped in 3 backticks (```). Do not include any text except the Corrected AQL Query.\n\nRemember to think step by step.\n\nArangoDB Schema:\n{adb_schema}\n\nAQL Query:\n{aql_query}\n\nAQL Error:\n{aql_error}\n\nCorrected AQL Query:\n"), **kwargs: Any) → ArangoGraphQAChain[source]¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-11
Initialize from LLM. classmethod from_orm(obj: Any) → Model¶ classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict[str, Any], config: Optional[RunnableConf...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-12
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prepare chain inputs, including ad...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-13
sole positional argument. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in additi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-14
Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = No...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
f5b78b92b09d-15
property input_schema: Type[pydantic.main.BaseModel]¶ property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
7f394f28d00a-0
langchain.chains.llm_bash.base.LLMBashChain¶ class langchain.chains.llm_bash.base.LLMBashChain[source]¶ Bases: Chain Chain that interprets a prompt and executes bash operations. Example from langchain.chains import LLMBashChain from langchain.llms import OpenAI llm_bash = LLMBashChain.from_llm(OpenAI()) Create a new mo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=BashOutputParser(), template='If someone asks you to perform a task, your job is ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-2
will be printed to the console. Defaults to langchain.verbose value. __call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-3
Default implementation of abatch, which calls ainvoke N times. Subclasses should override this method if they can batch more efficiently. async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optiona...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-4
Default implementation of ainvoke, which calls invoke in a thread pool. Subclasses should override this method if they can run asynchronously. apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶ Call the chain on all inputs i...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-5
# Suppose we have a multi-input chain that takes a 'question' string # and 'context' string: question = "What's the temperature in Boise, Idaho?" context = "Weather report for Boise, Idaho on 07/03/23..." await chain.arun(question=question, context=context) # -> "The temperature in Boise is..." async astream(input: Inp...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-6
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can ba...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-7
**kwargs – Keyword arguments passed to default pydantic.BaseModel.dict method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-8
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-9
Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be set by the chain’s memory. Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str,...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-10
these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: chain.run("What's the temperature in Boise, Idaho?")...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
7f394f28d00a-11
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_bash.base.LLMBashChain.html
a0b74736f51f-0
langchain.chains.retrieval_qa.base.BaseRetrievalQA¶ class langchain.chains.retrieval_qa.base.BaseRetrievalQA[source]¶ Bases: Chain Base class for question-answering chains. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-1
Return the source documents or not. param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults to None. These tags will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-2
these runtime tags will propagate to calls to other objects. metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run info in the response. Defaults to False. Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async abatch...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-3
tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-4
these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-5
This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: As...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-6
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-7
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-8
Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be set by the chain’s memory. Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str,...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-9
these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: chain.run("What's the temperature in Boise, Idaho?")...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
a0b74736f51f-10
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
53f8464c8883-0
langchain.chains.prompt_selector.BasePromptSelector¶ class langchain.chains.prompt_selector.BasePromptSelector[source]¶ Bases: BaseModel, ABC Base class for prompt selectors. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form...
https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.BasePromptSelector.html
53f8464c8883-1
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ abstract get_prompt(llm: BaseLanguageModel) → BasePromptTemplate[source]¶ Get default prompt for a language model. json(*, include: Optional[Union[AbstractSetIntStr, Mappi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.BasePromptSelector.html
53f8464c8883-2
Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.BasePromptSelector.html
7c66680ae3ea-0
langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain¶ class langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain[source]¶ Bases: BaseQAWithSourcesChain Question-answering with sources over a vector database. Create a new model by parsing and validating input data from keyword arguments...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-1
This metadata will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param reduce_k_below_max_tokens: bool = False¶ Reduce the number of results to return from store based on tokens...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-2
response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-3
Chain.input_keys except for inputs that will be set by the chain’s memory. return_only_outputs – 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 ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-4
The main difference between this method and Chain.__call__ is that this method expects inputs to be passed directly in as positional arguments or keyword arguments, whereas Chain.__call__ expects a single input dictionary with all the inputs Parameters *args – If the chain expects a single input, it can be passed in as...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-6
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-7
classmethod from_llm(llm: BaseLanguageModel, document_prompt: BasePromptTemplate = PromptTemplate(input_variables=['page_content', 'source'], template='Content: {page_content}\nSource: {source}'), question_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], template='Use the following p...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-8
Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any  kind between the parties.\n\n11.9 No Third-Party Beneficiaries.\nSource: 30-pl\nContent: (b) if Google believes, in good faith, that the Distributor has violated or ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-9
tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland.\nSource: 0-pl\nContent: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. \n\nLet’s use this moment to reset. Let’s stop looking at COVID-1...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-10
world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-11
of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.\nSource: 34-pl\n=========\nFINAL ANSWER: The president did not mention Michael Jackson.\nSOURCES:\n\nQUESTION: {question}\n=========\n{summaries}\...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-12
Construct the chain from an LLM. classmethod from_orm(obj: Any) → Model¶ classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict[str, Any], config: Optional[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-13
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prepare chain inputs, including ad...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-14
sole positional argument. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in additi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-15
Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = No...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
7c66680ae3ea-16
property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: T...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html
2e5ff60a4e2d-0
langchain.chains.llm_math.base.LLMMathChain¶ class langchain.chains.llm_math.base.LLMMathChain[source]¶ Bases: Chain Chain that interprets a prompt and executes python code to do math. Example from langchain.chains import LLMMathChain from langchain.llms import OpenAI llm_math = LLMMathChain.from_llm(OpenAI()) Create a...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], template='Translate a math problem into a expression that can be executed using Python\'s numex...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-2
will be printed to the console. Defaults to langchain.verbose value. __call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-3
Default implementation of abatch, which calls ainvoke N times. Subclasses should override this method if they can batch more efficiently. async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optiona...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-4
Default implementation of ainvoke, which calls invoke in a thread pool. Subclasses should override this method if they can run asynchronously. apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶ Call the chain on all inputs i...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-5
# Suppose we have a multi-input chain that takes a 'question' string # and 'context' string: question = "What's the temperature in Boise, Idaho?" context = "Weather report for Boise, Idaho on 07/03/23..." await chain.arun(question=question, context=context) # -> "The temperature in Boise is..." async astream(input: Inp...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-6
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can ba...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-7
**kwargs – Keyword arguments passed to default pydantic.BaseModel.dict method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-8
namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-9
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prepare chain inputs, including adding inputs from memory. Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-10
these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-11
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
2e5ff60a4e2d-12
property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html
5293a8ab6241-0
langchain.chains.transform.TransformChain¶ class langchain.chains.transform.TransformChain[source]¶ Bases: Chain Chain that transforms the chain output. Example from langchain.chains import TransformChain transform_chain = TransformChain(input_variables=["text"], output_variables["entities"], transform=func()) Create ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param output_variables: List[str] [Required]¶ The keys returned by the transform’s output dictionary. param tags: Optional[List[str]] = None¶ Optional list of tags associated ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-2
callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the c...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-3
returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects....
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-4
with all the inputs Parameters *args – If the chain expects a single input, it can be passed in as the sole positional argument. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to call...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-6
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-7
namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-8
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prepare chain inputs, including adding inputs from memory. Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-9
these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-10
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream...
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
5293a8ab6241-11
property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶ Examples using TransformChain¶ Zapier Natural Language Actions Rebuff Transformation
https://api.python.langchain.com/en/latest/chains/langchain.chains.transform.TransformChain.html
7c7123bffa6c-0
langchain.chains.qa_with_sources.loading.LoadingCallable¶ class langchain.chains.qa_with_sources.loading.LoadingCallable(*args, **kwargs)[source]¶ Interface for loading the combine documents chain. Methods __init__(*args, **kwargs) __init__(*args, **kwargs)¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.loading.LoadingCallable.html
788699c76a0e-0
langchain.chains.graph_qa.falkordb.extract_cypher¶ langchain.chains.graph_qa.falkordb.extract_cypher(text: str) → str[source]¶ Extract Cypher code from a text. :param text: Text to extract Cypher code from. Returns Cypher code extracted from the text.
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.falkordb.extract_cypher.html
1bb5a3c9fec6-0
langchain.chains.query_constructor.ir.Visitor¶ class langchain.chains.query_constructor.ir.Visitor[source]¶ Defines interface for IR translation using visitor pattern. Attributes allowed_comparators allowed_operators Methods __init__() visit_comparison(comparison) Translate a Comparison. visit_operation(operation) Tran...
https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Visitor.html
4dec27c69f0b-0
langchain.chains.graph_qa.hugegraph.HugeGraphQAChain¶ class langchain.chains.graph_qa.hugegraph.HugeGraphQAChain[source]¶ Bases: Chain Chain for question-answering against a graph by generating gremlin statements. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-1
param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults to None. These tags will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param ve...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-2
metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run info in the response. Defaults to False. Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-3
addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run info in the response. Defaults to False. Returns A dict of named outputs. Sho...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-4
addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'que...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-5
jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default im...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-6
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(**kw...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-7
# -> {"_type": "foo", "verbose": False, ...} classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], template="You are an assistant that helps to form nice and human understandable answers.\nThe information part contains the provided inform...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
4dec27c69f0b-8
namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html