id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
2f9898eef758-2
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. async ainvoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output[source]¶ Default implementation of ainvoke, calls invoke from a thread. The de...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableGenerator.html
2f9898eef758-3
The jsonpatch ops can be applied in order to construct state. atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[Output][source]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can s...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableGenerator.html
2f9898eef758-4
This method allows to get an input 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 input. get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to vali...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableGenerator.html
2f9898eef758-5
Subclasses should override this method if they support streaming output. transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Any) → Iterator[Output][source]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they ca...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableGenerator.html
2f9898eef758-6
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/schema/langchain.schema.runnable.base.RunnableGenerator.html
2af7a0dcc0fb-0
langchain.schema.vectorstore.VectorStoreRetriever¶ class langchain.schema.vectorstore.VectorStoreRetriever[source]¶ Bases: BaseRetriever Base Retriever class for VectorStore. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-1
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. add_documents(documents: List[Document], **kwargs: Any) → List[str][source]¶ Add documents to vector...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-2
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/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-3
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/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-4
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(*, i...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-5
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 that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-6
Returns The output of the runnable. 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, exclu...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-7
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-8
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]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
2af7a0dcc0fb-9
The type of output this runnable produces specified as a type annotation. allowed_search_types: ClassVar[Collection[str]] = ('similarity', 'similarity_score_threshold', 'mmr')¶ property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property input_...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.vectorstore.VectorStoreRetriever.html
fb0bd07445b4-0
langchain.schema.messages.SystemMessageChunk¶ class langchain.schema.messages.SystemMessageChunk[source]¶ Bases: SystemMessage, BaseMessageChunk A System Message chunk. 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 val...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.SystemMessageChunk.html
fb0bd07445b4-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/schema/langchain.schema.messages.SystemMessageChunk.html
fb0bd07445b4-2
The unique identifier is a list of strings that describes the path to the object. 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: Uni...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.SystemMessageChunk.html
7a4eb30f624c-0
langchain.schema.callbacks.base.RunManagerMixin¶ class langchain.schema.callbacks.base.RunManagerMixin[source]¶ Mixin for run manager. Methods __init__() on_retry(retry_state, *, run_id[, parent_run_id]) Run on a retry event. on_text(text, *, run_id[, parent_run_id]) Run on arbitrary text. __init__()¶ on_retry(retry_st...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.RunManagerMixin.html
b412c6d75167-0
langchain.schema.output_parser.BaseTransformOutputParser¶ class langchain.schema.output_parser.BaseTransformOutputParser[source]¶ Bases: BaseOutputParser[T] Base class for an output parser that can handle streaming input. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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. abstract parse(text: str) → T¶ Parse a single string model output into some structure...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
b412c6d75167-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/schema/langchain.schema.output_parser.BaseTransformOutputParser.html
247eb6c86f27-0
langchain.schema.runnable.configurable.make_options_spec¶ langchain.schema.runnable.configurable.make_options_spec(spec: Union[ConfigurableFieldSingleOption, ConfigurableFieldMultiOption], description: Optional[str]) → ConfigurableFieldSpec[source]¶ Make a ConfigurableFieldSpec for a ConfigurableFieldSingleOption or Co...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.make_options_spec.html
407b928c17a0-0
langchain.schema.callbacks.manager.BaseRunManager¶ class langchain.schema.callbacks.manager.BaseRunManager(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.BaseRunManager.html
407b928c17a0-1
Run on arbitrary text. __init__(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inheritable_metadata: Op...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.BaseRunManager.html
6ffbebc44863-0
langchain.schema.runnable.configurable.RunnableConfigurableFields¶ class langchain.schema.runnable.configurable.RunnableConfigurableFields[source]¶ Bases: DynamicRunnable[Input, Output] A Runnable that can be dynamically configured. Create a new model by parsing and validating input data from keyword arguments. Raises ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-1
Default implementation of astream, which calls ainvoke. 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, incl...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-2
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) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[Bas...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-3
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...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-4
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 that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-5
classmethod lc_id() → List[str]¶ 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 e...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-7
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/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
6ffbebc44863-8
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/schema/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
1cfd434b98ed-0
langchain.schema.prompt.PromptValue¶ class langchain.schema.prompt.PromptValue[source]¶ Bases: Serializable, ABC Base abstract class for inputs to any language model. PromptValues can be converted to both LLM (pure text-generation) inputs andChatModel inputs. Create a new model by parsing and validating input data from...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.prompt.PromptValue.html
1cfd434b98ed-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/schema/langchain.schema.prompt.PromptValue.html
1cfd434b98ed-2
The unique identifier is a list of strings that describes the path to the object. 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: Uni...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.prompt.PromptValue.html
746fba206249-0
langchain.schema.document.Document¶ class langchain.schema.document.Document[source]¶ Bases: Serializable Class for storing a piece of text and associated metadata. 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 m...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.document.Document.html
746fba206249-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/schema/langchain.schema.document.Document.html
746fba206249-2
The unique identifier is a list of strings that describes the path to the object. 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: Uni...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.document.Document.html
746fba206249-3
OpenAI Functions Metadata Tagger Doctran Extract Properties Doctran Interrogate Documents Doctran Translate Documents TensorFlow Datasets Airbyte Salesforce Airbyte CDK Airbyte Stripe Copy Paste Airbyte Typeform Apify Dataset Docugami Airbyte Hubspot Airbyte Gong Airbyte Shopify Airbyte Zendesk Support SageMakerEndpoin...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.document.Document.html
17b4d5287f0f-0
langchain.schema.callbacks.manager.collect_runs¶ langchain.schema.callbacks.manager.collect_runs() → Generator[RunCollectorCallbackHandler, None, None][source]¶ Collect all run traces in context. Returns The run collector callback handler. Return type run_collector.RunCollectorCallbackHandler Example >>> with collect_r...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.collect_runs.html
f70d3ceee8d4-0
langchain.schema.callbacks.base.BaseCallbackManager¶ class langchain.schema.callbacks.base.BaseCallbackManager(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, tags: Optional[List[str]] = None, inheritable_tags: Optional[List...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackManager.html
f70d3ceee8d4-1
Set handlers as the only handlers on the callback manager. __init__(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] = None, metadata: Optional[Dict[str,...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackManager.html
f70d3ceee8d4-2
Run when a chat model starts running. on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶ Run when LLM starts running. on_retriever_start(serialized: Dict[st...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackManager.html
4addce59f87f-0
langchain.schema.callbacks.base.LLMManagerMixin¶ class langchain.schema.callbacks.base.LLMManagerMixin[source]¶ Mixin for LLM callbacks. Methods __init__() on_llm_end(response, *, run_id[, parent_run_id]) Run when LLM ends running. on_llm_error(error, *, run_id[, parent_run_id]) Run when LLM errors. on_llm_new_token(to...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.LLMManagerMixin.html
18dfe483f4ce-0
langchain.schema.callbacks.tracers.langchain.get_client¶ langchain.schema.callbacks.tracers.langchain.get_client() → Client[source]¶ Get the client.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.get_client.html
aadded79a865-0
langchain.schema.runnable.base.Runnable¶ class langchain.schema.runnable.base.Runnable[source]¶ A unit of work that can be invoked, batched, streamed, transformed and composed. invoke/ainvoke: Transforms a single input into an output. batch/abatch: Efficiently transforms multiple inputs into outputs. stream/astream: St...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-1
# A RunnableSequence constructed using the `|` operator sequence = RunnableLambda(lambda x: x + 1) | RunnableLambda(lambda x: x * 2) sequence.invoke(1) # 4 sequence.batch([1, 2, 3]) # [4, 6, 8] # A sequence that contains a RunnableParallel constructed using a dict literal sequence = RunnableLambda(lambda x: x + 1) | { ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-2
print(sequence.output_schema.schema()) # Show inferred output schema print(sequence.invoke(2)) # invoke the sequence (note the retry above!!) As the chains get longer, it can be useful to be able to see intermediate results to debug and trace the chain. You can set the global debug flag to True to enable debug output f...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-3
Default implementation runs invoke in parallel using a thread pool executor. bind(**kwargs) Bind arguments to a Runnable, returning a new Runnable. config_schema(*[, include]) The type of config this runnable accepts specified as a pydantic model. get_input_schema([config]) Get a pydantic model that can be used to vali...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-4
Default implementation runs ainvoke in parallel using asyncio.gather. 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. async ainvoke(input: Input, co...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-5
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: Literal[False], include_names: Optional[Sequence[str]] = 'None', include_types: Optional[Sequence[str]] = 'None', include_tags: Optional[Sequence[str]] = 'None', exclude_names: Optional[Sequence[str]] = 'None', exclude_types: Optional[Seque...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-6
bind(**kwargs: Any) → Runnable[Input, Output][source]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel][source]¶ The type of config this runnable accepts specified as a pydantic model. To mark a field as configurable, see the configurabl...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-7
Transform a single input into an output. Override to implement. 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 ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.Runnable.html
aadded79a865-8
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/schema/langchain.schema.runnable.base.Runnable.html
ec4971e8f79b-0
langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup¶ class langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, parent_run_manager: AsyncCallba...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup.html
ec4971e8f79b-1
Set handlers as the only handlers on the callback manager. __init__(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, parent_run_manager: AsyncCallbackManagerForChainRun, **kwargs: Any) → None[source]¶ Initialize callback mana...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup.html
ec4971e8f79b-2
Defaults to None. Returns The configured async callback manager. Return type AsyncCallbackManager copy() → AsyncCallbackManagerForChainGroup[source]¶ Copy the callback manager. async on_chain_end(outputs: Union[Dict[str, Any], Any], **kwargs: Any) → None[source]¶ Run when traced chain group ends. Parameters outputs (Un...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup.html
ec4971e8f79b-3
Return type List[AsyncCallbackManagerForLLMRun] async on_llm_start(serialized: Dict[str, Any], prompts: List[str], **kwargs: Any) → List[AsyncCallbackManagerForLLMRun]¶ Run when LLM starts running. Parameters serialized (Dict[str, Any]) – The serialized LLM. prompts (List[str]) – The list of prompts. run_id (UUID, opti...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup.html
ec4971e8f79b-4
remove_tags(tags: List[str]) → None¶ set_handler(handler: BaseCallbackHandler, inherit: bool = True) → None¶ Set handler as the only handler on the callback manager. set_handlers(handlers: List[BaseCallbackHandler], inherit: bool = True) → None¶ Set handlers as the only handlers on the callback manager.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainGroup.html
fa1666fb221e-0
langchain.schema.runnable.history.RunnableWithMessageHistory¶ class langchain.schema.runnable.history.RunnableWithMessageHistory[source]¶ Bases: RunnableBindingBase A runnable that manages chat message history for another runnable. Base runnable must have inputs and outputs that can be converted to a list ofBaseMessage...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-1
Must take as input one of: - A sequence of BaseMessages - A dict with one key for all messages - A dict with one key for the current input string/message(s) and a separate key for historical messages. If the input key points to a string, it will be treated as a HumanMessage in history. Must return as output one of: - A...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-2
param input_messages_key: Optional[str] = None¶ param kwargs: Mapping[str, Any] [Optional]¶ param output_messages_key: Optional[str] = None¶ async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-3
Stream all output from a runnable, as reported to the callback system. 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...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-4
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/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-5
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/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-6
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: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Output¶ Transform a single input...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-7
Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. 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¶ cl...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-8
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/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
fa1666fb221e-9
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/schema/langchain.schema.runnable.history.RunnableWithMessageHistory.html
c716287601dc-0
langchain.schema.prompt_template.format_document¶ langchain.schema.prompt_template.format_document(doc: Document, prompt: BasePromptTemplate) → str[source]¶ Format a document into a string based on a prompt template. First, this pulls information from the document from two sources: page_content:This takes the informati...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.prompt_template.format_document.html
f197a8fd57c2-0
langchain.schema.runnable.config.merge_configs¶ langchain.schema.runnable.config.merge_configs(*configs: Optional[RunnableConfig]) → RunnableConfig[source]¶ Merge multiple configs into one. Parameters *configs (Optional[RunnableConfig]) – The configs to merge. Returns The merged config. Return type RunnableConfig
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.merge_configs.html
876c27268dc1-0
langchain.schema.callbacks.manager.ahandle_event¶ async langchain.schema.callbacks.manager.ahandle_event(handlers: List[BaseCallbackHandler], event_name: str, ignore_condition_name: Optional[str], *args: Any, **kwargs: Any) → None[source]¶ Generic event handler for AsyncCallbackManager. Note: This function is used by l...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.ahandle_event.html
b75bae1cf445-0
langchain.schema.callbacks.base.ToolManagerMixin¶ class langchain.schema.callbacks.base.ToolManagerMixin[source]¶ Mixin for tool callbacks. Methods __init__() on_tool_end(output, *, run_id[, parent_run_id]) Run when tool ends running. on_tool_error(error, *, run_id[, parent_run_id]) Run when tool errors. __init__()¶ on...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.ToolManagerMixin.html
b74edacdc0a7-0
langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler¶ class langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler(evaluators: Sequence[RunEvaluator], client: Optional[Client] = None, example_id: Optional[Union[str, UUID]] = None, skip_unfinished: bool = True, project_name: Optional[st...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
b74edacdc0a7-1
ignore_chain Whether to ignore chain callbacks. ignore_chat_model Whether to ignore chat model callbacks. ignore_llm Whether to ignore LLM callbacks. ignore_retriever Whether to ignore retriever callbacks. ignore_retry Whether to ignore retry callbacks. name raise_error run_inline Methods __init__(evaluators[, client, ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
b74edacdc0a7-2
Run when Retriever errors. on_retriever_start(serialized, query, *, run_id) Run when Retriever starts running. on_retry(retry_state, *, run_id, **kwargs) Run on a retry event. on_text(text, *, run_id[, parent_run_id]) Run on arbitrary text. on_tool_end(output, *, run_id, **kwargs) End a trace for a tool run. on_tool_er...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
b74edacdc0a7-3
End a trace for a chain run. on_chain_error(error: BaseException, *, inputs: Optional[Dict[str, Any]] = None, run_id: UUID, **kwargs: Any) → Run¶ Handle an error for a chain run. on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
b74edacdc0a7-4
Run on new LLM token. Only available when streaming is enabled. on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs: Any) → Run¶ Start a trace...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
b74edacdc0a7-5
Handle an error for a tool run. on_tool_start(serialized: Dict[str, Any], input_str: str, *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs: Any) → Run¶ Start a trace for a tool run. wait_for_futures()...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.EvaluatorCallbackHandler.html
c6f4ab900c6d-0
langchain.schema.runnable.base.RunnableSerializable¶ class langchain.schema.runnable.base.RunnableSerializable[source]¶ Bases: Serializable, Runnable[Input, Output] A Runnable that can be serialized to JSON. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the in...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-1
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/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-2
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/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-3
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...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-4
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 that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-5
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/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-7
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/schema/langchain.schema.runnable.base.RunnableSerializable.html
c6f4ab900c6d-8
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/schema/langchain.schema.runnable.base.RunnableSerializable.html
8209bf40ac13-0
langchain.schema.messages.BaseMessage¶ class langchain.schema.messages.BaseMessage[source]¶ Bases: Serializable The base abstract Message class. Messages are the inputs and outputs of ChatModels. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data can...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.BaseMessage.html
8209bf40ac13-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/schema/langchain.schema.messages.BaseMessage.html
8209bf40ac13-2
The unique identifier is a list of strings that describes the path to the object. 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: Uni...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.BaseMessage.html
0d6e7b01bb24-0
langchain.graphs.rdf_graph.RdfGraph¶ class langchain.graphs.rdf_graph.RdfGraph(source_file: Optional[str] = None, serialization: Optional[str] = 'ttl', query_endpoint: Optional[str] = None, update_endpoint: Optional[str] = None, standard: Optional[str] = 'rdf', local_copy: Optional[str] = None)[source]¶ RDFlib wrapper ...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.rdf_graph.RdfGraph.html