id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
a434c360bd26-1
} | RunnablePassthrough.assign( total_chars=lambda inputs: len(inputs['llm1'] + inputs['llm2']) ) runnable.invoke('hello') # {'llm1': 'completion', 'llm2': 'completion', 'total_chars': 20} Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cann...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-2
the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously. classmethod assign(**kwargs: Union[Runnable[Dict[str, Any], Any], Callable[[Dict[str, Any]], Any], Mapping[str, Union[Runnable[Dict[str, Any], Any], Callable[[Dict[str, Any]], Any]]]])...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-3
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Other], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[Other][source]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-4
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-5
Get a pydantic model that can be used to validate input to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic input schema that depends on which configuration the runnable is invoked with. This method allows to get an input schema for a specific confi...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-6
for more details. Returns The output of the runnable. classmethod is_lc_serializable() → bool[source]¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Op...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-7
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Other, config: Optional[RunnableConfig] = None, **kwargs: Any) → Iterator[Other][source]¶ Default implementation of stream, which calls invoke. Subclasses should override this...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-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.runnable.passthrough.RunnablePassthrough.html
a434c360bd26-9
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.runnable.passthrough.RunnablePassthrough.html
e9db1caac566-0
langchain.schema.callbacks.manager.tracing_v2_enabled¶ langchain.schema.callbacks.manager.tracing_v2_enabled(project_name: Optional[str] = None, *, example_id: Optional[Union[str, UUID]] = None, tags: Optional[List[str]] = None, client: Optional[LangSmithClient] = None) → Generator[LangChainTracer, None, None][source]¶...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.tracing_v2_enabled.html
86ba57802f9e-0
langchain.schema.callbacks.tracers.stdout.try_json_stringify¶ langchain.schema.callbacks.tracers.stdout.try_json_stringify(obj: Any, fallback: str) → str[source]¶ Try to stringify an object to JSON. :param obj: Object to stringify. :param fallback: Fallback string to return if the object cannot be stringified. Returns ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.try_json_stringify.html
ad768a3fd453-0
langchain.schema.runnable.utils.get_lambda_source¶ langchain.schema.runnable.utils.get_lambda_source(func: Callable) → Optional[str][source]¶ Get the source code of a lambda function. Parameters func – a callable that can be a lambda function Returns the source code of the lambda function Return type str
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.get_lambda_source.html
f0b97704b20a-0
langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler¶ class langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler(example_id: Optional[Union[UUID, str]] = None, **kwargs: Any)[source]¶ A tracer that collects all nested runs in a list. This tracer is useful for inspection a...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler.html
f0b97704b20a-1
Run when a chat model starts running. on_llm_end(response, *, run_id, **kwargs) 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. o...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler.html
f0b97704b20a-2
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 agent end. on_chain_end(outputs: Dict[str, Any], *, run_id: UUID...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler.html
f0b97704b20a-3
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 LLM token. Only available when streaming is enabled. on_llm_start(serialized: Dict[str, Any], prompts:...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler.html
f0b97704b20a-4
End a trace for a tool run. on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶ 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]] = N...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.run_collector.RunCollectorCallbackHandler.html
ee7898967507-0
langchain.schema.messages.ChatMessageChunk¶ class langchain.schema.messages.ChatMessageChunk[source]¶ Bases: ChatMessage, BaseMessageChunk A Chat 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 valid model...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.ChatMessageChunk.html
ee7898967507-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.ChatMessageChunk.html
ee7898967507-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.ChatMessageChunk.html
e459db521ea1-0
langchain.schema.chat_history.BaseChatMessageHistory¶ class langchain.schema.chat_history.BaseChatMessageHistory[source]¶ Abstract base class for storing chat message history. See ChatMessageHistory for default implementation. Example class FileChatMessageHistory(BaseChatMessageHistory): storage_path: str sess...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.chat_history.BaseChatMessageHistory.html
e459db521ea1-1
Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. abstract clear() → None[source]¶ Remove all messages from the store
lang/api.python.langchain.com/en/latest/schema/langchain.schema.chat_history.BaseChatMessageHistory.html
ace0f11e7ae8-0
langchain.schema.prompt_template.BasePromptTemplate¶ class langchain.schema.prompt_template.BasePromptTemplate[source]¶ Bases: RunnableSerializable[Dict, PromptValue], ABC Base class for all prompt templates, returning a prompt. Create a new model by parsing and validating input data from keyword arguments. Raises Vali...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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.prompt_template.BasePromptTemplate.html
ace0f11e7ae8-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. Examples using BasePromptTemplate¶ Custom chain
lang/api.python.langchain.com/en/latest/schema/langchain.schema.prompt_template.BasePromptTemplate.html
9fef55613407-0
langchain.schema.runnable.branch.RunnableBranch¶ class langchain.schema.runnable.branch.RunnableBranch[source]¶ Bases: RunnableSerializable[Input, Output] A Runnable that selects which branch to run based on a condition. The runnable is initialized with a list of (condition, runnable) pairs and a default branch. When o...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.branch.RunnableBranch.html
9fef55613407-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. async ainvoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output[source]...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.branch.RunnableBranch.html
9fef55613407-2
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/schema/langchain.schema.runnable.branch.RunnableBranch.html
9fef55613407-3
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.runnable.branch.RunnableBranch.html
9fef55613407-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. classmethod get_lc_namespace() → List[str][source]¶ The namespace of a RunnableBranch is the namespace of its default branc...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.branch.RunnableBranch.html
9fef55613407-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.branch.RunnableBranch.html
9fef55613407-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.branch.RunnableBranch.html
9fef55613407-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.branch.RunnableBranch.html
9fef55613407-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.branch.RunnableBranch.html
a82f75d7df0e-0
langchain.schema.runnable.config.get_async_callback_manager_for_config¶ langchain.schema.runnable.config.get_async_callback_manager_for_config(config: RunnableConfig) → AsyncCallbackManager[source]¶ Get an async callback manager for a config. Parameters config (RunnableConfig) – The config. Returns The async callback m...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.get_async_callback_manager_for_config.html
b198ac934c61-0
langchain.schema.messages.SystemMessage¶ class langchain.schema.messages.SystemMessage[source]¶ Bases: BaseMessage A Message for priming AI behavior, usually passed in as the first of a sequence of input messages. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.SystemMessage.html
b198ac934c61-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.SystemMessage.html
b198ac934c61-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.SystemMessage.html
b198ac934c61-3
Conversational Retrieval Agent Structure answers with OpenAI functions Agents CAMEL Role-Playing Autonomous Cooperative Agents Multi-Agent Simulated Environment: Petting Zoo Multi-agent decentralized speaker selection Multi-agent authoritarian speaker selection Two-Player Dungeons & Dragons Multi-Player Dungeons & Drag...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.SystemMessage.html
648ffcd4af6b-0
langchain.schema.runnable.router.RouterRunnable¶ class langchain.schema.runnable.router.RouterRunnable[source]¶ Bases: RunnableSerializable[RouterInput, Output] A runnable that routes to a set of runnables based on Input[‘key’]. Returns the output of the selected runnable. Create a new model by parsing and validating i...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
648ffcd4af6b-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.router.RouterRunnable.html
ff650f87153e-0
langchain.schema.runnable.utils.accepts_run_manager¶ langchain.schema.runnable.utils.accepts_run_manager(callable: Callable[[...], Any]) → bool[source]¶ Check if a callable accepts a run_manager argument.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.accepts_run_manager.html
ec300a401f1c-0
langchain.schema.output_parser.BaseLLMOutputParser¶ class langchain.schema.output_parser.BaseLLMOutputParser[source]¶ Abstract base class for parsing the outputs of a model. Methods __init__() aparse_result(result, *[, partial]) Parse a list of candidate model Generations into a specific format. parse_result(result, *[...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.BaseLLMOutputParser.html
42967315e201-0
langchain.schema.callbacks.manager.AsyncRunManager¶ class langchain.schema.callbacks.manager.AsyncRunManager(*, 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.AsyncRunManager.html
42967315e201-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.AsyncRunManager.html
0c81c75ba89d-0
langchain.schema.runnable.utils.AddableDict¶ class langchain.schema.runnable.utils.AddableDict[source]¶ Dictionary that can be added to another dictionary. Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new dictionary with keys from iterable and values set to value. get(key[, default]) Retu...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.AddableDict.html
0c81c75ba89d-1
pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pair as a 2-tuple. Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty. setdef...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.AddableDict.html
c4b5aacb3c58-0
langchain.schema.callbacks.manager.CallbackManager¶ class langchain.schema.callbacks.manager.CallbackManager(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[s...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManager.html
c4b5aacb3c58-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.manager.CallbackManager.html
c4b5aacb3c58-2
inheritable_metadata (Optional[Dict[str, Any]], optional) – The inheritable metadata. Defaults to None. local_metadata (Optional[Dict[str, Any]], optional) – The local metadata. Defaults to None. Returns The configured callback manager. Return type CallbackManager copy() → T¶ Copy the callback manager. on_chain_start(s...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManager.html
c4b5aacb3c58-3
Parameters serialized (Dict[str, Any]) – The serialized LLM. prompts (List[str]) – The list of prompts. run_id (UUID, optional) – The ID of the run. Defaults to None. Returns A callback manager for eachprompt as an LLM run. Return type List[CallbackManagerForLLMRun] on_retriever_start(serialized: Dict[str, Any], query:...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManager.html
c4b5aacb3c58-4
Set handlers as the only handlers on the callback manager. Examples using CallbackManager¶ Anthropic 🚅 LiteLLM Ollama Llama.cpp Titan Takeoff Run LLMs locally Set env var OPENAI_API_KEY or load from a .env file Use local LLMs WebResearchRetriever
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManager.html
85e26bae34f9-0
langchain.schema.runnable.config.get_executor_for_config¶ langchain.schema.runnable.config.get_executor_for_config(config: RunnableConfig) → Generator[Executor, None, None][source]¶ Get an executor for a config. Parameters config (RunnableConfig) – The config. Yields Generator[Executor, None, None] – The executor.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.get_executor_for_config.html
5d6f488fc59e-0
langchain.schema.output.LLMResult¶ class langchain.schema.output.LLMResult[source]¶ Bases: BaseModel Class that contains all results for a batched LLM call. 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. pa...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output.LLMResult.html
5d6f488fc59e-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.output.LLMResult.html
5d6f488fc59e-2
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.output.LLMResult.html
6d72cc75a2ac-0
langchain.schema.runnable.utils.get_unique_config_specs¶ langchain.schema.runnable.utils.get_unique_config_specs(specs: Iterable[ConfigurableFieldSpec]) → List[ConfigurableFieldSpec][source]¶ Get the unique config specs from a sequence of config specs.
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.get_unique_config_specs.html
33b8b595a510-0
langchain.schema.messages.ToolMessage¶ class langchain.schema.messages.ToolMessage[source]¶ Bases: BaseMessage A Message for passing the result of executing a tool back to a model. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed t...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.ToolMessage.html
33b8b595a510-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.ToolMessage.html
33b8b595a510-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.ToolMessage.html
8bd517e55242-0
langchain.schema.callbacks.manager.AsyncCallbackManagerForRetrieverRun¶ class langchain.schema.callbacks.manager.AsyncCallbackManagerForRetrieverRun(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = No...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForRetrieverRun.html
8bd517e55242-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.AsyncCallbackManagerForRetrieverRun.html
8bd517e55242-2
Run when retriever errors. async on_retry(retry_state: RetryCallState, **kwargs: Any) → None¶ Run on a retry event. async on_text(text: str, **kwargs: Any) → Any¶ Run when text is received. Parameters text (str) – The received text. Returns The result of the callback. Return type Any Examples using AsyncCallbackManager...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForRetrieverRun.html
4d48ab55c38c-0
langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1¶ class langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1(**kwargs: Any)[source]¶ An implementation of the SharedTracer that POSTS to the langchain endpoint. Initialize the LangChain tracer. Attributes ignore_agent Whether to ignore agent ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1.html
4d48ab55c38c-1
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. on_retriever_error(error, *, run_id, **kwargs) Run when Retriever er...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1.html
4d48ab55c38c-2
Run on agent action. on_agent_finish(finish: AgentFinish, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶ Run on agent end. on_chain_end(outputs: Dict[str, Any], *, run_id: UUID, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → Run¶ End a trace for a chain run. on_chain_error(error...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1.html
4d48ab55c38c-3
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 LLM token. Only available when streaming is enabled. on_llm_start(serialized: Dict[str, Any], prompts:...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1.html
4d48ab55c38c-4
End a trace for a tool run. on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶ 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]] = N...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.LangChainTracerV1.html
158dbe5a0b0f-0
langchain.schema.callbacks.tracers.log_stream.RunState¶ class langchain.schema.callbacks.tracers.log_stream.RunState[source]¶ State of the run. id: str¶ ID of the run. streamed_output: List[Any]¶ List of output chunks streamed by Runnable.stream() final_output: Optional[Any]¶ Final output of the run, usually the result...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.RunState.html
fe55b4110643-0
langchain.schema.runnable.config.call_func_with_variable_args¶ langchain.schema.runnable.config.call_func_with_variable_args(func: Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfi...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.call_func_with_variable_args.html
30e1e4601905-0
langchain.schema.callbacks.tracers.log_stream.LogStreamCallbackHandler¶ class langchain.schema.callbacks.tracers.log_stream.LogStreamCallbackHandler(*, auto_close: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exc...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.LogStreamCallbackHandler.html
30e1e4601905-1
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. on_retriever_error(error, *...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.LogStreamCallbackHandler.html
30e1e4601905-2
include_run(run: Run) → bool[source]¶ 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 agent end. on_chain_end(ou...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.LogStreamCallbackHandler.html
30e1e4601905-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.log_stream.LogStreamCallbackHandler.html
30e1e4601905-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.log_stream.LogStreamCallbackHandler.html
38bda6ab957c-0
langchain.schema.messages.BaseMessageChunk¶ class langchain.schema.messages.BaseMessageChunk[source]¶ Bases: BaseMessage A Message chunk, which can be concatenated with other Message chunks. 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.messages.BaseMessageChunk.html
38bda6ab957c-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.BaseMessageChunk.html
38bda6ab957c-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.BaseMessageChunk.html
ad88c9c8f2ea-0
langchain.schema.runnable.router.RouterInput¶ class langchain.schema.runnable.router.RouterInput[source]¶ A Router input. key¶ The key to route on. Type str input¶ The input to pass to the selected runnable. Type Any Attributes key input Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new di...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.router.RouterInput.html
ad88c9c8f2ea-1
items() → a set-like object providing a view on D's items¶ keys() → a set-like object providing a view on D's keys¶ pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pa...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.router.RouterInput.html
7d8db8dea3f1-0
langchain.schema.callbacks.manager.CallbackManagerForLLMRun¶ class langchain.schema.callbacks.manager.CallbackManagerForLLMRun(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheritable_tags: ...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManagerForLLMRun.html
7d8db8dea3f1-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.CallbackManagerForLLMRun.html
7d8db8dea3f1-2
Run when LLM generates a new token. Parameters token (str) – The new token. on_retry(retry_state: RetryCallState, **kwargs: Any) → None¶ Run on a retry event. on_text(text: str, **kwargs: Any) → Any¶ Run when text is received. Parameters text (str) – The received text. Returns The result of the callback. Return type An...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.CallbackManagerForLLMRun.html
e558f6b8edbd-0
langchain.schema.runnable.utils.IsFunctionArgDict¶ class langchain.schema.runnable.utils.IsFunctionArgDict[source]¶ Check if the first argument of a function is a dict. Methods __init__() generic_visit(node) Called if no explicit visitor function exists for a node. visit(node) Visit a node. visit_AsyncFunctionDef(node)...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.IsFunctionArgDict.html
f6dccca5caae-0
langchain.schema.callbacks.manager.AsyncCallbackManagerForLLMRun¶ class langchain.schema.callbacks.manager.AsyncCallbackManagerForLLMRun(*, 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.AsyncCallbackManagerForLLMRun.html
f6dccca5caae-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.AsyncCallbackManagerForLLMRun.html
f6dccca5caae-2
Run when LLM errors. Parameters error (Exception or KeyboardInterrupt) – The error. async on_llm_new_token(token: str, *, chunk: Optional[Union[GenerationChunk, ChatGenerationChunk]] = None, **kwargs: Any) → None[source]¶ Run when LLM generates a new token. Parameters token (str) – The new token. async on_retry(retry_s...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForLLMRun.html