id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
806cbac008e0-0
langchain.schema.runnable.utils.IsLocalDict¶ class langchain.schema.runnable.utils.IsLocalDict(name: str, keys: Set[str])[source]¶ Check if a name is a local dict. Methods __init__(name, keys) generic_visit(node) Called if no explicit visitor function exists for a node. visit(node) Visit a node. visit_Call(node) visit_...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.IsLocalDict.html
649399f3430c-0
langchain.schema.callbacks.tracers.langchain.LangChainTracer¶ class langchain.schema.callbacks.tracers.langchain.LangChainTracer(example_id: Optional[Union[str, UUID]] = None, project_name: Optional[str] = None, client: Optional[Client] = None, tags: Optional[List[str]] = None, use_threading: bool = True, **kwargs: Any...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.LangChainTracer.html
649399f3430c-1
End a trace for an LLM run. on_llm_error(error, *, run_id, **kwargs) Handle an error for an LLM run. on_llm_new_token(token, *[, chunk, ...]) Run on new LLM token. on_llm_start(serialized, prompts, *, run_id) Start a trace for an LLM run. on_retriever_end(documents, *, run_id, **kwargs) Run when Retriever ends running....
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.LangChainTracer.html
649399f3430c-2
get_run_url() → str[source]¶ Get the LangSmith root run URL on_agent_action(action: AgentAction, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶ Run on agent action. on_agent_finish(finish: AgentFinish, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶ Run on agen...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.LangChainTracer.html
649399f3430c-3
End a trace for an LLM run. on_llm_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶ Handle an error for an LLM run. on_llm_new_token(token: str, *, chunk: Optional[Union[GenerationChunk, ChatGenerationChunk]] = None, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Run¶ Run on new ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.LangChainTracer.html
649399f3430c-4
Run on a retry event. on_text(text: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶ Run on arbitrary text. on_tool_end(output: str, *, run_id: UUID, **kwargs: Any) → Run¶ End a trace for a tool run. on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶ Handle an er...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.LangChainTracer.html
e46e10139714-0
langchain.schema.callbacks.tracers.stdout.FunctionCallbackHandler¶ class langchain.schema.callbacks.tracers.stdout.FunctionCallbackHandler(function: Callable[[str], None], **kwargs: Any)[source]¶ Tracer that calls a function with a single str parameter. Attributes ignore_agent Whether to ignore agent callbacks. ignore_...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.FunctionCallbackHandler.html
e46e10139714-1
Start a trace for an LLM run. on_retriever_end(documents, *, run_id, **kwargs) Run when Retriever ends running. on_retriever_error(error, *, run_id, **kwargs) 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 ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.FunctionCallbackHandler.html
e46e10139714-2
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.stdout.FunctionCallbackHandler.html
e46e10139714-3
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.stdout.FunctionCallbackHandler.html
e46e10139714-4
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.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.FunctionCallbackHandler.html
8482c4a99c14-0
langchain.schema.runnable.utils.get_function_first_arg_dict_keys¶ langchain.schema.runnable.utils.get_function_first_arg_dict_keys(func: Callable) → Optional[List[str]][source]¶ Get the keys of the first argument of a function if it is a dict.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.get_function_first_arg_dict_keys.html
8ba1b0ca347f-0
langchain.schema.callbacks.manager.AsyncParentRunManager¶ class langchain.schema.callbacks.manager.AsyncParentRunManager(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheritable_tags: Option...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncParentRunManager.html
8ba1b0ca347f-1
on_text(text, **kwargs) Run when text is received. __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]] = No...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncParentRunManager.html
8ba1b0ca347f-2
Run when text is received. Parameters text (str) – The received text. Returns The result of the callback. Return type Any
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncParentRunManager.html
e84c2eea98ae-0
langchain.schema.output.ChatGenerationChunk¶ class langchain.schema.output.ChatGenerationChunk[source]¶ Bases: ChatGeneration A ChatGeneration chunk, which can be concatenated with otherChatGeneration chunks. message¶ The message chunk output by the chat model. Create a new model by parsing and validating input data fr...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output.ChatGenerationChunk.html
e84c2eea98ae-1
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.output.ChatGenerationChunk.html
e84c2eea98ae-2
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/schema/langchain.schema.output.ChatGenerationChunk.html
82e88f71c59d-0
langchain.schema.runnable.utils.gated_coro¶ async langchain.schema.runnable.utils.gated_coro(semaphore: Semaphore, coro: Coroutine) → Any[source]¶ Run a coroutine with a semaphore. :param semaphore: The semaphore to use. :param coro: The coroutine to run. Returns The result of the coroutine.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.gated_coro.html
54f7fb9158d6-0
langchain.schema.runnable.utils.indent_lines_after_first¶ langchain.schema.runnable.utils.indent_lines_after_first(text: str, prefix: str) → str[source]¶ Indent all lines of text after the first line. Parameters text – The text to indent prefix – Used to determine the number of spaces to indent Returns The indented tex...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.indent_lines_after_first.html
4ed11b473592-0
langchain.schema.callbacks.tracers.log_stream.LogEntry¶ class langchain.schema.callbacks.tracers.log_stream.LogEntry[source]¶ A single entry in the run log. id: str¶ ID of the sub-run. name: str¶ Name of the object being run. type: str¶ Type of the object being run, eg. prompt, chain, llm, etc. tags: List[str]¶ List of...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.LogEntry.html
ac39b52bb443-0
langchain.schema.output_parser.BaseGenerationOutputParser¶ class langchain.schema.output_parser.BaseGenerationOutputParser[source]¶ Bases: BaseLLMOutputParser, RunnableSerializable[Union[str, BaseMessage], T] Base class to parse the output of an LLM call. async abatch(inputs: List[Input], config: Optional[Union[Runnabl...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-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.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-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.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-3
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.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-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.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-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.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-6
to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-7
The Run object contains information about the run, including its id, type, input, output, error, start_time, end_time, and any tags or metadata added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseGenerationOutputParser.html
ac39b52bb443-8
A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} 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.output_parser.BaseGenerationOutputParser.html
53b90d26f80a-0
langchain.schema.document.BaseDocumentTransformer¶ class langchain.schema.document.BaseDocumentTransformer[source]¶ Abstract base class for document transformation systems. A document transformation system takes a sequence of Documents and returns a sequence of transformed Documents. Example class EmbeddingsRedundantFi...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.document.BaseDocumentTransformer.html
53b90d26f80a-1
Parameters documents – A sequence of Documents to be transformed. Returns A list of transformed Documents.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.document.BaseDocumentTransformer.html
b27d905d128a-0
langchain.schema.runnable.base.RunnableEachBase¶ class langchain.schema.runnable.base.RunnableEachBase[source]¶ Bases: RunnableSerializable[List[Input], List[Output]] A runnable that delegates calls to another runnable with each element of the input sequence. Use only if creating a new RunnableEach subclass with differ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
b27d905d128a-3
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.runnable.base.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
b27d905d128a-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.base.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
b27d905d128a-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.RunnableEachBase.html
359bf2f927bf-0
langchain.schema.output_parser.StrOutputParser¶ class langchain.schema.output_parser.StrOutputParser[source]¶ Bases: BaseTransformOutputParser[str] OutputParser that parses LLMResult into the top likely string. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, re...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.StrOutputParser.html
359bf2f927bf-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.StrOutputParser.html
359bf2f927bf-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.StrOutputParser.html
359bf2f927bf-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.StrOutputParser.html
359bf2f927bf-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.StrOutputParser.html
359bf2f927bf-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) → str[source]¶ Returns the input text with no changes. classmethod p...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.StrOutputParser.html
359bf2f927bf-6
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.output_parser.StrOutputParser.html
359bf2f927bf-7
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.output_parser.StrOutputParser.html
359bf2f927bf-8
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 this runnable. property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.StrOutputParser.html
7389048d7103-0
langchain.schema.cache.BaseCache¶ class langchain.schema.cache.BaseCache[source]¶ Base interface for cache. Methods __init__() clear(**kwargs) Clear cache that can take additional keyword arguments. lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, llm_string, return_val) Update cache ba...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.cache.BaseCache.html
5e722430aa12-0
langchain.schema.messages.AIMessage¶ class langchain.schema.messages.AIMessage[source]¶ Bases: BaseMessage A Message from an AI. 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 additional_kwargs: dict ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.AIMessage.html
5e722430aa12-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.AIMessage.html
5e722430aa12-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.AIMessage.html
5e722430aa12-3
Multi-agent decentralized speaker selection Multi-agent authoritarian speaker selection Multi-Player Dungeons & Dragons Simulated Environment: Gymnasium Agent Debates with Tools Prompt pipelining
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.AIMessage.html
92a45df9d2b1-0
langchain.schema.callbacks.tracers.schemas.TracerSessionV1Base¶ class langchain.schema.callbacks.tracers.schemas.TracerSessionV1Base[source]¶ Bases: BaseModel Base class for TracerSessionV1. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot b...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.TracerSessionV1Base.html
92a45df9d2b1-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.callbacks.tracers.schemas.TracerSessionV1Base.html
92a45df9d2b1-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/schema/langchain.schema.callbacks.tracers.schemas.TracerSessionV1Base.html
7578f9963a5a-0
langchain.schema.memory.BaseMemory¶ class langchain.schema.memory.BaseMemory[source]¶ Bases: Serializable, ABC Abstract base class for memory in Chains. Memory refers to state in Chains. Memory can be used to store information aboutpast executions of a Chain and inject that information into the inputs of future executi...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.memory.BaseMemory.html
7578f9963a5a-1
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/schema/langchain.schema.memory.BaseMemory.html
7578f9963a5a-2
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/schema/langchain.schema.memory.BaseMemory.html
7578f9963a5a-3
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to upda...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.memory.BaseMemory.html
3583c0a8cacb-0
langchain.schema.runnable.utils.ConfigurableFieldMultiOption¶ class langchain.schema.runnable.utils.ConfigurableFieldMultiOption(id: str, options: Mapping[str, Any], default: Sequence[str], name: Optional[str] = None, description: Optional[str] = None)[source]¶ A field that can be configured by the user with multiple d...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.ConfigurableFieldMultiOption.html
b5a5b2b71656-0
langchain.schema.runnable.base.RunnableMap¶ langchain.schema.runnable.base.RunnableMap¶ alias of RunnableParallel Examples using RunnableMap¶ OpaquePrompts interface.md First we add a step to load memory sql_db.md prompt_llm_parser.md Adding memory multiple_chains.md
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableMap.html
1b3923dc3425-0
langchain.schema.runnable.utils.add¶ langchain.schema.runnable.utils.add(addables: Iterable[Addable]) → Optional[Addable][source]¶ Add a sequence of addable objects together.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.add.html
63e373c6943c-0
langchain.schema.runnable.utils.accepts_config¶ langchain.schema.runnable.utils.accepts_config(callable: Callable[[...], Any]) → bool[source]¶ Check if a callable accepts a config argument.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.accepts_config.html
687869cf286b-0
langchain.schema.runnable.base.RunnableBinding¶ class langchain.schema.runnable.base.RunnableBinding[source]¶ Bases: RunnableBindingBase[Input, Output] A runnable that delegates calls to another runnable with a set of kwargs. Create a new model by parsing and validating input data from keyword arguments. Raises Validat...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableBinding.html
687869cf286b-1
Subclasses should override this method if they can run asynchronously. 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 streaming output. a...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableBinding.html
687869cf286b-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.runnable.base.RunnableBinding.html
687869cf286b-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.runnable.base.RunnableBinding.html
687869cf286b-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/schema/langchain.schema.runnable.base.RunnableBinding.html
687869cf286b-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/schema/langchain.schema.runnable.base.RunnableBinding.html
687869cf286b-6
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/schema/langchain.schema.runnable.base.RunnableBinding.html
687869cf286b-7
added to the run. with_retry(**kwargs: Any) → Runnable[Input, Output][source]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exception_type – A tuple of exception types to retry on wait_exponential_jitter – Whether to add jitter to the wait time between retries stop_after_a...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableBinding.html
bcfcc031859c-0
langchain.schema.callbacks.tracers.schemas.TracerSessionV1¶ class langchain.schema.callbacks.tracers.schemas.TracerSessionV1[source]¶ Bases: TracerSessionV1Base TracerSessionV1 schema. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be pars...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.TracerSessionV1.html
bcfcc031859c-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.callbacks.tracers.schemas.TracerSessionV1.html
bcfcc031859c-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/schema/langchain.schema.callbacks.tracers.schemas.TracerSessionV1.html
5491566e8a1d-0
langchain.schema.agent.AgentActionMessageLog¶ class langchain.schema.agent.AgentActionMessageLog[source]¶ Bases: AgentAction Override init to support instantiation by position for backward compat. param log: str [Required]¶ Additional information to log about the action. This log can be used in a few ways. First, it ca...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentActionMessageLog.html
5491566e8a1d-1
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentActionMessageLog.html
5491566e8a1d-2
Return whether or not the class is 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_defaults: bool = False, ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentActionMessageLog.html
5491566e8a1d-3
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¶ property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentActionMessageLog.html
b7403cc4ca4b-0
langchain.schema.callbacks.manager.RunManager¶ class langchain.schema.callbacks.manager.RunManager(*, 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, ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.RunManager.html
b7403cc4ca4b-1
on_text(text, **kwargs) Run when text is received. __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]] = No...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.RunManager.html
372595142933-0
langchain.schema.callbacks.manager.AsyncCallbackManagerForChainRun¶ class langchain.schema.callbacks.manager.AsyncCallbackManagerForChainRun(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inhe...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainRun.html
372595142933-1
Run when chain errors. on_retry(retry_state, **kwargs) Run on a retry event. on_text(text, **kwargs) Run when text is received. __init__(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inherita...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainRun.html
372595142933-2
Run when agent action is received. Parameters action (AgentAction) – The agent action. Returns The result of the callback. Return type Any async on_agent_finish(finish: AgentFinish, **kwargs: Any) → Any[source]¶ Run when agent finish is received. Parameters finish (AgentFinish) – The agent finish. Returns The result of...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForChainRun.html
354488b97572-0
langchain.schema.callbacks.manager.ParentRunManager¶ class langchain.schema.callbacks.manager.ParentRunManager(*, 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[st...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.ParentRunManager.html
354488b97572-1
on_text(text, **kwargs) Run when text is received. __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]] = No...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.ParentRunManager.html
354488b97572-2
Run when text is received. Parameters text (str) – The received text. Returns The result of the callback. Return type Any
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.ParentRunManager.html
22dcb5d47e39-0
langchain.schema.output_parser.BaseCumulativeTransformOutputParser¶ class langchain.schema.output_parser.BaseCumulativeTransformOutputParser[source]¶ Bases: BaseTransformOutputParser[T] Base class for an output parser that can handle streaming input. param diff: bool = False¶ In streaming mode, whether to yield diffs b...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
22dcb5d47e39-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/schema/langchain.schema.output_parser.BaseCumulativeTransformOutputParser.html
32bb8a026f25-0
langchain.schema.callbacks.tracers.langchain.log_error_once¶ langchain.schema.callbacks.tracers.langchain.log_error_once(method: str, exception: Exception) → None[source]¶ Log an error once.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain.log_error_once.html
a434c360bd26-0
langchain.schema.runnable.passthrough.RunnablePassthrough¶ class langchain.schema.runnable.passthrough.RunnablePassthrough[source]¶ Bases: RunnableSerializable[Other, Other] A runnable to passthrough inputs unchanged or with additional keys. This runnable behaves almost like the identity function, except that it can be...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html