id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
2bf196a59c74-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.FunctionMessageChunk.html |
2bf196a59c74-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.FunctionMessageChunk.html |
2f3197cef53f-0 | langchain.schema.callbacks.tracers.langchain_v1.get_headers¶
langchain.schema.callbacks.tracers.langchain_v1.get_headers() → Dict[str, Any][source]¶
Get the headers for the LangChain API. | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.langchain_v1.get_headers.html |
a8e14fa9a6c5-0 | langchain.schema.runnable.config.get_callback_manager_for_config¶
langchain.schema.runnable.config.get_callback_manager_for_config(config: RunnableConfig) → CallbackManager[source]¶
Get a callback manager for a config.
Parameters
config (RunnableConfig) – The config.
Returns
The callback manager.
Return type
CallbackMa... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.get_callback_manager_for_config.html |
a2716685f162-0 | langchain.schema.callbacks.tracers.schemas.ToolRun¶
class langchain.schema.callbacks.tracers.schemas.ToolRun[source]¶
Bases: BaseRun
Class for ToolRun.
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 a... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.ToolRun.html |
a2716685f162-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.callbacks.tracers.schemas.ToolRun.html |
a2716685f162-2 | classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_n... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.ToolRun.html |
306fb54c6095-0 | langchain.schema.callbacks.tracers.log_stream.RunLogPatch¶
class langchain.schema.callbacks.tracers.log_stream.RunLogPatch(*ops: Dict[str, Any])[source]¶
A patch to the run log.
Attributes
ops
List of jsonpatch operations, which describe how to create the run state from an empty dict.
Methods
__init__(*ops)
__init__(*o... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.log_stream.RunLogPatch.html |
7e7197cb7d3e-0 | langchain.schema.runnable.config.patch_config¶
langchain.schema.runnable.config.patch_config(config: Optional[RunnableConfig], *, callbacks: Optional[BaseCallbackManager] = None, recursion_limit: Optional[int] = None, max_concurrency: Optional[int] = None, run_name: Optional[str] = None, configurable: Optional[Dict[str... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.patch_config.html |
16449014e5d1-0 | langchain.schema.agent.AgentAction¶
class langchain.schema.agent.AgentAction[source]¶
Bases: Serializable
A full description of an action for an ActionAgent to execute.
Override init to support instantiation by position for backward compat.
param log: str [Required]¶
Additional information to log about the action.
This... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentAction.html |
16449014e5d1-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.agent.AgentAction.html |
16449014e5d1-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.agent.AgentAction.html |
16449014e5d1-3 | Custom Trajectory Evaluator
Agents
Plug-and-Plai
Wikibase Agent
SalesGPT - Your Context-Aware AI Sales Assistant With Knowledge Base
Custom Agent with PlugIn Retrieval
Multiple callback handlers
Custom multi-action agent
Custom agent
Custom agent with tool retrieval | lang/api.python.langchain.com/en/latest/schema/langchain.schema.agent.AgentAction.html |
56eb57d54868-0 | langchain.schema.callbacks.base.AsyncCallbackHandler¶
class langchain.schema.callbacks.base.AsyncCallbackHandler[source]¶
Async callback handler that handles callbacks from LangChain.
Attributes
ignore_agent
Whether to ignore agent callbacks.
ignore_chain
Whether to ignore chain callbacks.
ignore_chat_model
Whether to ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.AsyncCallbackHandler.html |
56eb57d54868-1 | Run on retriever error.
on_retriever_start(serialized, query, *, run_id)
Run on retriever start.
on_retry(retry_state, *, run_id[, parent_run_id])
Run on a retry event.
on_text(text, *, run_id[, parent_run_id, tags])
Run on arbitrary text.
on_tool_end(output, *, run_id[, ...])
Run when tool ends running.
on_tool_error(... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.AsyncCallbackHandler.html |
56eb57d54868-2 | Run when chain errors.
async on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → None[source]¶
Run when chain starts running.
async on_chat_model_start(seri... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.AsyncCallbackHandler.html |
56eb57d54868-3 | Run on new LLM token. Only available when streaming is enabled.
async 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) → None[source]¶
Run when LLM starts runnin... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.AsyncCallbackHandler.html |
56eb57d54868-4 | Run on arbitrary text.
async on_tool_end(output: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, **kwargs: Any) → None[source]¶
Run when tool ends running.
async on_tool_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[s... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.AsyncCallbackHandler.html |
d7c80d791d8d-0 | langchain.schema.runnable.config.acall_func_with_variable_args¶
async langchain.schema.runnable.config.acall_func_with_variable_args(func: Union[Callable[[Input], Awaitable[Output]], Callable[[Input, RunnableConfig], Awaitable[Output]], Callable[[Input, AsyncCallbackManagerForChainRun], Awaitable[Output]], Callable[[In... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.acall_func_with_variable_args.html |
c6efaf936362-0 | langchain.schema.output_parser.OutputParserException¶
class langchain.schema.output_parser.OutputParserException(error: Any, observation: Optional[str] = None, llm_output: Optional[str] = None, send_to_llm: bool = False)[source]¶
Exception that output parsers should raise to signify a parsing error.
This exists to diff... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.output_parser.OutputParserException.html |
5a8e3a679f7a-0 | langchain.schema.runnable.config.get_config_list¶
langchain.schema.runnable.config.get_config_list(config: Optional[Union[RunnableConfig, List[RunnableConfig]]], length: int) → List[RunnableConfig][source]¶
Get a list of configs from a single config or a list of configs.
It is useful for subclasses overriding batch() o... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.config.get_config_list.html |
08af5e063a05-0 | langchain.schema.storage.BaseStore¶
class langchain.schema.storage.BaseStore[source]¶
Abstract interface for a key-value store.
Methods
__init__()
mdelete(keys)
Delete the given keys and their associated values.
mget(keys)
Get the values associated with the given keys.
mset(key_value_pairs)
Set the values for the given... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.storage.BaseStore.html |
345b08b5d37b-0 | langchain.schema.callbacks.tracers.schemas.Run¶
class langchain.schema.callbacks.tracers.schemas.Run[source]¶
Bases: RunBase
Run schema for the V2 API in the Tracer.
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 ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.Run.html |
345b08b5d37b-1 | The type of run, such as tool, chain, llm, retriever,
embedding, prompt, parser.
param serialized: Optional[dict] = None¶
Serialized object that executed the run for potential reuse.
param start_time: <module 'datetime' from '/home/docs/.asdf/installs/python/3.11.6/lib/python3.11/datetime.py'> [Required]¶
Start time of... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.schemas.Run.html |
345b08b5d37b-2 | 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.Run.html |
345b08b5d37b-3 | 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.Run.html |
d407a2a79f4f-0 | langchain.schema.runnable.utils.SupportsAdd¶
class langchain.schema.runnable.utils.SupportsAdd(*args, **kwargs)[source]¶
Protocol for objects that support addition.
Methods
__init__(*args, **kwargs)
__init__(*args, **kwargs)¶ | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.SupportsAdd.html |
077154bdb8a5-0 | langchain.schema.callbacks.tracers.stdout.ConsoleCallbackHandler¶
class langchain.schema.callbacks.tracers.stdout.ConsoleCallbackHandler(**kwargs: Any)[source]¶
Tracer that prints to the console.
Attributes
ignore_agent
Whether to ignore agent callbacks.
ignore_chain
Whether to ignore chain callbacks.
ignore_chat_model... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.ConsoleCallbackHandler.html |
077154bdb8a5-1 | 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 a retry event.
on_text(text, *... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.stdout.ConsoleCallbackHandler.html |
077154bdb8a5-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.ConsoleCallbackHandler.html |
077154bdb8a5-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.ConsoleCallbackHandler.html |
077154bdb8a5-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.ConsoleCallbackHandler.html |
4788775d9d4a-0 | langchain.schema.callbacks.manager.AsyncCallbackManagerForToolRun¶
class langchain.schema.callbacks.manager.AsyncCallbackManagerForToolRun(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheri... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForToolRun.html |
4788775d9d4a-1 | on_tool_error(error, **kwargs)
Run when tool errors.
__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]] = ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForToolRun.html |
4788775d9d4a-2 | Run when text is received.
Parameters
text (str) – The received text.
Returns
The result of the callback.
Return type
Any
async on_tool_end(output: str, **kwargs: Any) → None[source]¶
Run when tool ends running.
Parameters
output (str) – The output of the tool.
async on_tool_error(error: BaseException, **kwargs: Any) →... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.AsyncCallbackManagerForToolRun.html |
1863bad0f0d1-0 | langchain.schema.runnable.configurable.RunnableConfigurableAlternatives¶
class langchain.schema.runnable.configurable.RunnableConfigurableAlternatives[source]¶
Bases: DynamicRunnable[Input, Output]
A Runnable that can be dynamically configured.
Create a new model by parsing and validating input data from keyword argume... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.configurable.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.RunnableConfigurableAlternatives.html |
1863bad0f0d1-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.RunnableConfigurableAlternatives.html |
3305019b9fdd-0 | langchain.schema.callbacks.manager.env_var_is_set¶
langchain.schema.callbacks.manager.env_var_is_set(env_var: str) → bool[source]¶
Check if an environment variable is set.
Parameters
env_var (str) – The name of the environment variable.
Returns
True if the environment variable is set, False otherwise.
Return type
bool | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.env_var_is_set.html |
d65f69a1bb98-0 | langchain.schema.embeddings.Embeddings¶
class langchain.schema.embeddings.Embeddings[source]¶
Interface for embedding models.
Methods
__init__()
aembed_documents(texts)
Asynchronous Embed search docs.
aembed_query(text)
Asynchronous Embed query text.
embed_documents(texts)
Embed search docs.
embed_query(text)
Embed que... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.embeddings.Embeddings.html |
806a65b18166-0 | langchain.schema.callbacks.tracers.base.TracerException¶
class langchain.schema.callbacks.tracers.base.TracerException[source]¶
Base class for exceptions in tracers module. | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.base.TracerException.html |
9fb51039a255-0 | langchain.schema.runnable.base.RunnableLambda¶
class langchain.schema.runnable.base.RunnableLambda(func: Union[Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfig], Output]], Union[... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-1 | # Alternatively, can provide both synd and sync implementations
async def add_one_async(x: int) -> int:
return x + 1
runnable = RunnableLambda(add_one, afunc=add_one_async)
runnable.invoke(1) # Uses add_one
await runnable.ainvoke(1) # Uses add_one_async
Create a RunnableLambda from a callable, and async callable or... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-2 | 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])
The pydantic schema for the input to this runnable.
get_output_schema([config])
Get a pydantic model that can be used to v... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-3 | Bind input and output types to a Runnable, returning a new Runnable.
__init__(func: Union[Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfig], Output]], Union[Callable[[Input], Awa... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-4 | Invoke this runnable 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.
async astream_log(input: Any, confi... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-5 | 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.RunnableLambda.html |
9fb51039a255-6 | Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with each input.
stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they supp... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
9fb51039a255-7 | on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
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(*, ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableLambda.html |
715ff46443bb-0 | langchain.schema.runnable.base.RunnableEach¶
class langchain.schema.runnable.base.RunnableEach[source]¶
Bases: RunnableEachBase[Input, Output]
A runnable that delegates calls to another runnable
with each element of the input sequence.
Create a new model by parsing and validating input data from keyword arguments.
Rais... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
715ff46443bb-2 | e.g., if the underlying runnable uses an API which supports a batch mode.
bind(**kwargs: Any) → RunnableEach[Input, Output][source]¶
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 ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
715ff46443bb-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) → RunnableEach[Input, Output][source]¶
Bind config to a Runnable, returning... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.base.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
715ff46443bb-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.RunnableEach.html |
a499d952c09c-0 | langchain.schema.callbacks.base.RetrieverManagerMixin¶
class langchain.schema.callbacks.base.RetrieverManagerMixin[source]¶
Mixin for Retriever callbacks.
Methods
__init__()
on_retriever_end(documents, *, run_id[, ...])
Run when Retriever ends running.
on_retriever_error(error, *, run_id[, ...])
Run when Retriever erro... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.RetrieverManagerMixin.html |
e24e88c2b1b5-0 | langchain.schema.messages.ChatMessage¶
class langchain.schema.messages.ChatMessage[source]¶
Bases: BaseMessage
A Message that can be assigned an arbitrary speaker (i.e. role).
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to for... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.ChatMessage.html |
e24e88c2b1b5-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.ChatMessage.html |
e24e88c2b1b5-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.ChatMessage.html |
49972fbaffdb-0 | langchain.schema.runnable.utils.ConfigurableFieldSingleOption¶
class langchain.schema.runnable.utils.ConfigurableFieldSingleOption(id: str, options: Mapping[str, Any], default: str, name: Optional[str] = None, description: Optional[str] = None)[source]¶
A field that can be configured by the user with a default value.
C... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.utils.ConfigurableFieldSingleOption.html |
030d98063c34-0 | langchain.schema.runnable.configurable.StrEnum¶
class langchain.schema.runnable.configurable.StrEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
A string enum. | lang/api.python.langchain.com/en/latest/schema/langchain.schema.runnable.configurable.StrEnum.html |
90fac4f44fa8-0 | langchain.schema.callbacks.manager.tracing_enabled¶
langchain.schema.callbacks.manager.tracing_enabled(session_name: str = 'default') → Generator[TracerSessionV1, None, None][source]¶
Get the Deprecated LangChainTracer in a context manager.
Parameters
session_name (str, optional) – The name of the session.
Defaults to ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.tracing_enabled.html |
90cc1e30c50a-0 | langchain.schema.callbacks.tracers.evaluation.wait_for_all_evaluators¶
langchain.schema.callbacks.tracers.evaluation.wait_for_all_evaluators() → None[source]¶
Wait for all tracers to finish. | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.tracers.evaluation.wait_for_all_evaluators.html |
68caf26aa64f-0 | langchain.schema.retriever.BaseRetriever¶
class langchain.schema.retriever.BaseRetriever[source]¶
Bases: RunnableSerializable[str, List[Document]], ABC
Abstract base class for a Document retrieval system.
A retrieval system is defined as something that can take string queries and returnthe most ‘relevant’ Documents fro... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-1 | These tags will be associated with each call to this retriever,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a retriever with its
use case.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, ... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-2 | The default implementation allows usage of async code even if
the runnable did not implement a native async version of invoke.
Subclasses should override this method if they can run asynchronously.
async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Def... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-3 | 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.retriever.BaseRetriever.html |
68caf26aa64f-4 | 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.retriever.BaseRetriever.html |
68caf26aa64f-5 | 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]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “open... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-6 | and passed as arguments to the handlers defined in callbacks.
Returns
List of relevant documents
invoke(input: str, config: Optional[RunnableConfig] = None) → List[Document][source]¶
Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use wh... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-7 | 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¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.retriever.BaseRetriever.html |
68caf26aa64f-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.retriever.BaseRetriever.html |
68caf26aa64f-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.retriever.BaseRetriever.html |
530c49dec829-0 | langchain.schema.messages.AIMessageChunk¶
class langchain.schema.messages.AIMessageChunk[source]¶
Bases: AIMessage, BaseMessageChunk
A Message chunk 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... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.messages.AIMessageChunk.html |
530c49dec829-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.AIMessageChunk.html |
530c49dec829-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.AIMessageChunk.html |
eb030bbef4cd-0 | langchain.schema.messages.ToolMessageChunk¶
class langchain.schema.messages.ToolMessageChunk[source]¶
Bases: ToolMessage, BaseMessageChunk
A Tool 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.ToolMessageChunk.html |
eb030bbef4cd-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.ToolMessageChunk.html |
eb030bbef4cd-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.ToolMessageChunk.html |
e4260059832e-0 | langchain.schema.runnable.configurable.DynamicRunnable¶
class langchain.schema.runnable.configurable.DynamicRunnable[source]¶
Bases: RunnableSerializable[Input, Output]
A Serializable Runnable that can be dynamically configured.
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.runnable.configurable.DynamicRunnable.html |
e4260059832e-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.configurable.DynamicRunnable.html |
e4260059832e-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.configurable.DynamicRunnable.html |
e4260059832e-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.configurable.DynamicRunnable.html |
e4260059832e-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.DynamicRunnable.html |
e4260059832e-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.DynamicRunnable.html |
e4260059832e-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.DynamicRunnable.html |
e4260059832e-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.DynamicRunnable.html |
e4260059832e-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.DynamicRunnable.html |
c2ce2a5d4738-0 | langchain.schema.callbacks.base.BaseCallbackHandler¶
class langchain.schema.callbacks.base.BaseCallbackHandler[source]¶
Base callback handler that handles callbacks from LangChain.
Attributes
ignore_agent
Whether to ignore agent callbacks.
ignore_chain
Whether to ignore chain callbacks.
ignore_chat_model
Whether to ign... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackHandler.html |
c2ce2a5d4738-1 | on_retriever_error(error, *, run_id[, ...])
Run when Retriever errors.
on_retriever_start(serialized, query, *, run_id)
Run when Retriever starts running.
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.
on_tool_end(output, *, run_i... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackHandler.html |
c2ce2a5d4738-2 | Run when chain errors.
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, 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 chain starts running.
on_chat_model_start(serialized: Dict[str, Any... | lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.base.BaseCallbackHandler.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.