id
stringlengths
14
15
text
stringlengths
49
2.47k
source
stringlengths
61
166
f6d931da83ae-0
langchain.chains.constitutional_ai.models.ConstitutionalPrinciple¶ class langchain.chains.constitutional_ai.models.ConstitutionalPrinciple[source]¶ Bases: BaseModel Class for a constitutional principle. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input d...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.models.ConstitutionalPrinciple.html
f6d931da83ae-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.models.ConstitutionalPrinciple.html
f6d931da83ae-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.models.ConstitutionalPrinciple.html
4f16c76424ce-0
langchain.chains.loading.load_chain_from_config¶ langchain.chains.loading.load_chain_from_config(config: dict, **kwargs: Any) → Chain[source]¶ Load chain from Config Dict.
https://api.python.langchain.com/en/latest/chains/langchain.chains.loading.load_chain_from_config.html
c17f4fb79a7f-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
c17f4fb79a7f-1
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 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-2
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.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-3
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 ainvok...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-4
directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: await chain.arun("What's the temperature in Boise, Idaho?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' s...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-5
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 creating the new model: you should trust this data deep – set to True to make a deep co...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-6
classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['adb_schema', 'user_input', 'aql_query', 'aql_result'], output_parser=None, partial_variables={}, template="Task: Generate a natural language `Summary` from the results of an ArangoDB Query Language query.\n\...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-7
aql_generation_prompt: BasePromptTemplate = PromptTemplate(input_variables=['adb_schema', 'aql_examples', 'user_input'], output_parser=None, partial_variables={}, template="Task: Generate an ArangoDB Query Language (AQL) query from a User Input.\n\nYou are an ArangoDB Query Language (AQL) expert responsible for transla...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-8
should not do:\n- Do not use any properties/relationships that can't be inferred from the `ArangoDB Schema` or 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 ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-9
`Collection Schema`: Lists all Collections within the ArangoDB Database Instance, along with their document/edge properties and a document/edge example.\n\nYou will output the `Corrected AQL Query` wrapped in 3 backticks (```). Do not include any text except the Corrected AQL Query.\n\nRemember to think step by step.\n...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-10
Initialize from LLM. classmethod from_orm(obj: Any) → Model¶ invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-11
Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶ Validate and prepare chain outputs, and save info about this run to memory. Parameters inputs – Dictionary of chain inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-12
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?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' string: ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
c17f4fb79a7f-13
classmethod validate(value: Any) → Model¶ with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.arangodb.ArangoGraphQAChain.html
5de36bd09165-0
langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain¶ class langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain[source]¶ Bases: Chain Chain for question-answering against a Neptune graph by generating openCypher statements. Example chain = NeptuneOpenCypherQAChain.from_llm(llm=llm, graph=grap...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-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_direct: bool = False¶ Whether or not to return the result of querying the graph directly. param return_intermediate_steps: bo...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-2
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. tags – List of string tags to pass to all callbacks. These will be...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-3
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.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-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.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-5
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-6
classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = 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 informati...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-7
include any text except the generated Cypher statement.\n\nThe question is:\n{question}', template_format='f-string', validate_template=True), **kwargs: Any) → NeptuneOpenCypherQAChain[source]¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-8
Initialize from LLM. classmethod from_orm(obj: Any) → Model¶ invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-9
Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶ Validate and prepare chain outputs, and save info about this run to memory. Parameters inputs – Dictionary of chain inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-10
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?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' string: ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
5de36bd09165-11
classmethod validate(value: Any) → Model¶ with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
b2a51e789e19-0
langchain.chains.openai_functions.openapi.SimpleRequestChain¶ class langchain.chains.openai_functions.openapi.SimpleRequestChain[source]¶ Bases: Chain Chain for making a simple request to an API endpoint. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-1
param request_method: Callable [Required]¶ Method to use for making the request. 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 us...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-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.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-3
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 ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = N...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-4
directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: await chain.arun("What's the temperature in Boise, Idaho?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' s...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-5
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 creating the new model: you should trust this data deep – set to True to make a deep co...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-6
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-7
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 the sole positional argument. callbacks – Callbacks to use for this cha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
b2a51e789e19-8
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None) → Iterator[Output]¶ to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedN...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.SimpleRequestChain.html
392fd0b5e6b6-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
392fd0b5e6b6-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
392fd0b5e6b6-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.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-3
to False. Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-4
# -> "The temperature in Boise is..." # 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-5
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(**kwargs: Any) → Dict¶ Dictionary representation of chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters **kwargs – Keyword arguments passed to defaul...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-6
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-7
Convenience method for executing chain. 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 expect...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
392fd0b5e6b6-8
Example chain.save(file_path="path/chain.yaml") classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optiona...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.BaseRetrievalQA.html
8294b24912ce-0
langchain.chains.openai_functions.base.convert_to_openai_function¶ langchain.chains.openai_functions.base.convert_to_openai_function(function: Union[Dict[str, Any], Type[BaseModel], Callable]) → Dict[str, Any][source]¶ Convert a raw function/class to an OpenAI function. Parameters function – Either a dictionary, a pyda...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.base.convert_to_openai_function.html
796f7058a00b-0
langchain.chains.retrieval_qa.base.RetrievalQA¶ class langchain.chains.retrieval_qa.base.RetrievalQA[source]¶ Bases: BaseRetrievalQA Chain for question-answering against an index. Example from langchain.llms import OpenAI from langchain.chains import RetrievalQA from langchain.faiss import FAISS from langchain.vectorst...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-1
for the full catalog. param metadata: Optional[Dict[str, Any]] = None¶ Optional metadata associated with the chain. Defaults to None. 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 cha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-2
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. tags – List of string tags to pass to all callbacks. These will be...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-3
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.retrieval_qa.base.RetrievalQA.html
796f7058a00b-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.RetrievalQA.html
796f7058a00b-5
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-6
Initialize from LLM. classmethod from_orm(obj: Any) → Model¶ invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-7
Returns A dictionary of all inputs, including those added by the chain’s memory. prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶ Validate and prepare chain outputs, and save info about this run to memory. Parameters inputs – Dictionary of chain inputs, ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-8
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?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' string: ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
796f7058a00b-9
classmethod validate(value: Any) → Model¶ with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out...
https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html
210fc5b347f8-0
langchain.chains.openai_functions.qa_with_structure.AnswerWithSources¶ class langchain.chains.openai_functions.qa_with_structure.AnswerWithSources[source]¶ Bases: BaseModel An answer to the question, with sources. 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.openai_functions.qa_with_structure.AnswerWithSources.html
210fc5b347f8-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.AnswerWithSources.html
210fc5b347f8-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.qa_with_structure.AnswerWithSources.html
a26d1a9d4e17-0
langchain.chains.llm.LLMChain¶ class langchain.chains.llm.LLMChain[source]¶ Bases: Chain Chain to run queries against LLMs. Example from langchain import LLMChain, OpenAI, PromptTemplate prompt_template = "Tell me a {adjective} joke" prompt = PromptTemplate( input_variables=["adjective"], template=prompt_template )...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-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_parser: BaseLLMOutputParser [Optional]¶ Output parser to use. Defaults to one that takes the most likely string but does not change it otherwise. param prompt: Ba...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-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.llm.LLMChain.html
a26d1a9d4e17-3
async acall(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, include_run_info: bool = False) → Dict[str, Any]¶ Asynchronously execute t...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-4
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]][source]¶ Utilize the LLM generate method for speed gains. apply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackM...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-5
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.llm.LLMChain.html
a26d1a9d4e17-6
bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no othe...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-7
classmethod from_orm(obj: Any) → Model¶ classmethod from_string(llm: BaseLanguageModel, template: str) → LLMChain[source]¶ Create LLMChain from LLM and template. generate(input_list: List[Dict[str, Any]], run_manager: Optional[CallbackManagerForChainRun] = None) → LLMResult[source]¶ Generate LLM result from inputs. inv...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-8
Format prompt with kwargs and pass to LLM. Parameters callbacks – Callbacks to pass to LLMChain **kwargs – Keys to pass to prompt template. Returns Completion from LLM. Example completion = llm.predict(adjective="funny") predict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-9
Prepare prompts from inputs. run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶ Convenience method for executing chain. The main difference between this method and Chain.__c...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-10
save(file_path: Union[Path, str]) → None¶ Save the chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters file_path – Path to file to save the chain to. Example chain.save(file_path="path/chain.yaml") classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definiti...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
a26d1a9d4e17-11
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. Examples using LLMChain¶ Zapier Natural Language Actions API Argilla Comet Aim Weights & Biases Rebuff MLflow Flyte Chat Over Documents with...
https://api.python.langchain.com/en/latest/chains/langchain.chains.llm.LLMChain.html
2fbf60e8dcac-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
2fbf60e8dcac-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
2fbf60e8dcac-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
2fbf60e8dcac-3
to False. Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-4
# -> "The temperature in Boise is..." # 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-5
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(**kwargs: Any) → Dict¶ Dictionary representation of chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters **kwargs – Keyword arguments passed to defaul...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-6
# -> {“_type”: “foo”, “verbose”: False, …} classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = 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 infor...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-7
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_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Cal...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-8
Validate and prepare chain outputs, and save info about this run to memory. Parameters inputs – Dictionary of chain inputs, including any inputs added by chain memory. outputs – Dictionary of initial chain outputs. return_only_outputs – Whether to only return the chain outputs. If False, inputs are also added to the fi...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-9
# and 'context' string: question = "What's the temperature in Boise, Idaho?" context = "Weather report for Boise, Idaho on 07/03/23..." chain.run(question=question, context=context) # -> "The temperature in Boise is..." save(file_path: Union[Path, str]) → None¶ Save the chain. Expects Chain._chain_type property to be i...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
2fbf60e8dcac-10
constructor. property lc_namespace: List[str]¶ Return the namespace of the langchain object. eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]¶ Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool¶ Return whether or not t...
https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.hugegraph.HugeGraphQAChain.html
3760bd4cb8bd-0
langchain.chains.openai_functions.base.convert_python_function_to_openai_function¶ langchain.chains.openai_functions.base.convert_python_function_to_openai_function(function: Callable) → Dict[str, Any][source]¶ Convert a Python function to an OpenAI function-calling API compatible dict. Assumes the Python function has ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.base.convert_python_function_to_openai_function.html
5df57dbf5778-0
langchain.chains.sql_database.query.SQLInput¶ class langchain.chains.sql_database.query.SQLInput[source]¶ Input for a SQL Chain. question: str¶
https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.query.SQLInput.html
0a72bff2aab5-0
langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn¶ langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn(spec: OpenAPISpec) → Tuple[List[Dict[str, Any]], Callable][source]¶ Convert a valid OpenAPI spec to the JSON Schema format expected for OpenAIfunctions. Parameters spec – OpenAPI spec...
https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn.html
6c85496cdbef-0
langchain.chains.qa_with_sources.base.QAWithSourcesChain¶ class langchain.chains.qa_with_sources.base.QAWithSourcesChain[source]¶ Bases: BaseQAWithSourcesChain Question answering with sources over documents. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the in...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-1
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 verbose: bool [Optional]¶ Whether or not r...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-2
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, List[RunnableConfig]]] = None, *, max_concurrency: Optional[int] = None) → List[Output]¶ async acall(inputs: Union[Dict[str, Any], Any], return_on...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-3
Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dic...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-4
# -> "The temperature in Boise is..." # 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-5
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(**kwargs: Any) → Dict¶ Dictionary representation of chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters **kwargs – Keyword arguments passed to defaul...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-6
classmethod from_llm(llm: BaseLanguageModel, document_prompt: BasePromptTemplate = PromptTemplate(input_variables=['page_content', 'source'], output_parser=None, partial_variables={}, template='Content: {page_content}\nSource: {source}', template_format='f-string', validate_template=True), question_prompt: BasePromptTe...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-7
or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation  in force of the remainder of the term (if any) and this 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...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-8
\n\nFrom President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world. \n\nGroups of citizens blocking 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 ha...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-9
\n\nTo all Americans, I will be honest with you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the 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 bu...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-10
and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test 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=========...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html
6c85496cdbef-11
Construct the chain from an LLM. classmethod from_orm(obj: Any) → Model¶ invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: ...
https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html