id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
1594fccb9d22-6
# -> "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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-7
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-8
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwargs: Union[ConfigurableField, C...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-9
method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} classmethod from_orm(obj: Any) → Model¶ get_input_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate input to th...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-10
Parameters input – The input to the runnable. config – A config to use when invoking the runnable. The config supports standard keys like ‘tags’, ‘metadata’ for tracing purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other keys. Please refer to the RunnableConfig for more details. Retur...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-11
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-12
otherwise the length of the prompt in tokens. 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 met...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-13
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-14
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
1594fccb9d22-15
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Type[langchain.schema.runnable.utils.Input]¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.runnable.utils.Output]¶ The type of output this runnable produces speci...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html
40c9c6b67d91-0
langchain.chains.prompt_selector.is_chat_model¶ langchain.chains.prompt_selector.is_chat_model(llm: BaseLanguageModel) → bool[source]¶ Check if the language model is a chat model. Parameters llm – Language model to check. Returns True if the language model is a BaseChatModel model, False otherwise.
lang/api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.is_chat_model.html
f3c002b9631a-0
langchain.chains.query_constructor.parser.v_args¶ langchain.chains.query_constructor.parser.v_args(*args: Any, **kwargs: Any) → Any[source]¶ Dummy decorator for when lark is not installed.
lang/api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.parser.v_args.html
c00e85fb16cf-0
langchain.chains.router.base.RouterChain¶ class langchain.chains.router.base.RouterChain[source]¶ Bases: Chain, ABC Chain that outputs the name of a destination chain and the inputs to it. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-1
You can use these to eg identify a specific instance of a chain with its use case. param verbose: bool [Optional]¶ Whether or not run in verbose mode. In verbose mode, some intermediate logs will be printed to the console. Defaults to the global verbose value, accessible via langchain.globals.get_verbose(). __call__(in...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-2
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, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs ainvoke in parallel ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-4
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-6
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-7
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-8
Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schem...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-9
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-10
Returns A dict of the final chain outputs. route(inputs: Dict[str, Any], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Route[source]¶ Route inputs to a destination chain. Parameters inputs – inputs to the chain callbacks – callbacks to use for the chain Returns a Route object run(...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-11
# 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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-12
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
c00e85fb16cf-13
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html
2b438990ce2a-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn.html
dbfa371c9647-0
langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence¶ class langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence[source]¶ Bases: BaseModel Class representing a single statement. Each fact has a body and a list of sources. If there are multiple facts make sure to break them apart su...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence.html
dbfa371c9647-1
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(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence.html
dbfa371c9647-2
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¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence.html
a4061c4cd0bb-0
langchain.chains.loading.load_chain¶ langchain.chains.loading.load_chain(path: Union[str, Path], **kwargs: Any) → Chain[source]¶ Unified method for loading a chain from LangChainHub or local fs. Examples using load_chain¶ Hugging Face Prompt Injection Identification Serialization Loading from LangChainHub
lang/api.python.langchain.com/en/latest/chains/langchain.chains.loading.load_chain.html
ff5cf52bc116-0
langchain.chains.flare.prompts.FinishedOutputParser¶ class langchain.chains.flare.prompts.FinishedOutputParser[source]¶ Bases: BaseOutputParser[Tuple[str, bool]] Output parser that checks if the output is finished. param finished_value: str = 'FINISHED'¶ Value that indicates the output is finished. async abatch(inputs:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-1
to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support str...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-3
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-4
methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-5
The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. parse(text: str) → Tuple[str, bool][source]¶ Parse a single string model output into ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-6
prompt – Input PromptValue. Returns Structured output 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: O...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-7
exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
ff5cf52bc116-8
The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.flare.prompts.FinishedOutputParser.html
009cf75efbd1-0
langchain.chains.moderation.OpenAIModerationChain¶ class langchain.chains.moderation.OpenAIModerationChain[source]¶ Bases: Chain Pass input through a moderation endpoint. To use, you should have the openai python package installed, and the environment variable OPENAI_API_KEY set with your API key. Any parameters that a...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-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 model_name: Optional[str] = None¶ Moderation model name to use. param openai_api_key: Optional[str] = None...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-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 ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-4
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-6
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-7
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-8
Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schem...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-9
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-10
Returns A dict of the final chain outputs. 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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-11
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-12
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
009cf75efbd1-13
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Type[langchain.schema.runnable.utils.Input]¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.runnable.utils.Output]¶ The type of output this runnable produces speci...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html
00fc2981231d-0
langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain¶ class langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain[source]¶ Bases: MultiRouteChain A multi-route chain that uses an LLM router chain to choose amongst retrieval qa chains. Create a new model by parsing and validating input data from k...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-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 router_chain: LLMRouterChain [Required]¶ Chain for deciding a destination chain and the input to it. param silent_errors: bool = False¶ If True, use default_chain when a...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-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 ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-4
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-6
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-7
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-8
Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables th...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-9
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-10
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,...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-11
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?")...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-12
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-13
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
00fc2981231d-14
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_retrieval_qa.MultiRetrievalQAChain.html
31fcd879db42-0
langchain.chains.openai_functions.base.get_openai_output_parser¶ langchain.chains.openai_functions.base.get_openai_output_parser(functions: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]]) → Union[BaseOutputParser, BaseGenerationOutputParser][source]¶ Get the appropriate function output parser given the user...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.base.get_openai_output_parser.html
3bdc1c890f1f-0
langchain.chains.conversational_retrieval.base.InputType¶ class langchain.chains.conversational_retrieval.base.InputType[source]¶ Bases: BaseModel 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 valid model. param chat_h...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.InputType.html
3bdc1c890f1f-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.InputType.html
3bdc1c890f1f-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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.InputType.html
fd3d37402eaa-0
langchain.chains.llm_requests.LLMRequestsChain¶ class langchain.chains.llm_requests.LLMRequestsChain[source]¶ Bases: Chain Chain that requests a URL and then uses an LLM to parse results. Security Note: This chain can make GET requests to arbitrary URLs,including internal URLs. Control access to who can run this chain ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-1
You can use these to eg identify a specific instance of a chain with its use case. param requests_wrapper: TextRequestsWrapper [Optional]¶ 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 ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-2
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. metadata – Optional metadata associated with the ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-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....
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-4
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-6
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-7
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-8
Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schem...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-9
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-10
Returns A dict of the final chain outputs. 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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-11
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-12
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
fd3d37402eaa-13
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Type[langchain.schema.runnable.utils.Input]¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.runnable.utils.Output]¶ The type of output this runnable produces speci...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.llm_requests.LLMRequestsChain.html
68eac2854fa4-0
langchain.chains.router.llm_router.RouterOutputParser¶ class langchain.chains.router.llm_router.RouterOutputParser[source]¶ Bases: BaseOutputParser[Dict[str, str]] Parser for output of router chain in the multi-prompt chain. param default_destination: str = 'DEFAULT'¶ param next_inputs_inner_key: str = 'input'¶ param n...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-1
Parameters result – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astr...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-2
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 runs invoke in parallel using a thread pool executor. The default implementation of batch w...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-3
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...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-4
namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema tha...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-5
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 lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-6
The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion – String output of a language model. prompt – Input PromptValue. Returns Structured output classmethod schema(by_alias: bool = True, ref_templa...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-7
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
68eac2854fa4-8
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Any¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_spe...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html
d05cf5c56d31-0
langchain.chains.graph_qa.cypher.construct_schema¶ langchain.chains.graph_qa.cypher.construct_schema(structured_schema: Dict[str, Any], include_types: List[str], exclude_types: List[str]) → str[source]¶ Filter the schema based on included or excluded types
lang/api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.construct_schema.html
cb2572552a7b-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. Security note: Make sure that the database connection uses credential...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
cb2572552a7b-1
param graph: NeptuneGraph [Required]¶ param memory: Optional[BaseMemory] = None¶ Optional memory object. Defaults to None. Memory is a class that gets called at the start and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. ...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html
cb2572552a7b-2
accessible via langchain.globals.get_verbose(). __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: Optional[str] = Non...
lang/api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.NeptuneOpenCypherQAChain.html