id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
8f411e6eec1f-0 | langchain.agents.agent_toolkits.office365.toolkit.O365Toolkit¶
class langchain.agents.agent_toolkits.office365.toolkit.O365Toolkit[source]¶
Bases: BaseToolkit
Toolkit for interacting with Office 365.
Security Note: This toolkit contains tools that can read and modifythe state of a service; e.g., by reading, creating, u... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.office365.toolkit.O365Toolkit.html |
8f411e6eec1f-1 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.office365.toolkit.O365Toolkit.html |
8f411e6eec1f-2 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.office365.toolkit.O365Toolkit.html |
12c96de7f01e-0 | langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser¶
class langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser[source]¶
Bases: MultiActionAgentOutputParser
Parses a message into agent actions/finish.
Is meant to be used with OpenAI models, as it relies on the specific
tool_ca... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-1 | Parse a list of candidate model Generations into a specific format.
The return value is parsed from only the first Generation in the result, whichis assumed to be the highest-likelihood Generation.
Parameters
result – A list of Generations to be parsed. The Generations are assumed
to be different candidate outputs for ... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-2 | 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, **kwargs: Optional[Any]) → List[Output]¶
Default implementation runs invoke... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-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/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-4 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and con... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-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/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-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/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-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/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
12c96de7f01e-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/agents/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html |
7e94a5b85b69-0 | langchain.agents.utils.validate_tools_single_input¶
langchain.agents.utils.validate_tools_single_input(class_name: str, tools: Sequence[BaseTool]) → None[source]¶
Validate tools for single input. | lang/api.python.langchain.com/en/latest/agents/langchain.agents.utils.validate_tools_single_input.html |
9782730f3d8c-0 | langchain.agents.mrkl.output_parser.MRKLOutputParser¶
class langchain.agents.mrkl.output_parser.MRKLOutputParser[source]¶
Bases: AgentOutputParser
MRKL Output parser for the chat agent.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = F... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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) → Union[AgentAction, AgentFinish][source]¶
Parse text into agent act... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
9782730f3d8c-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/agents/langchain.agents.mrkl.output_parser.MRKLOutputParser.html |
731a7c18ac5c-0 | langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser¶
class langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser[source]¶
Bases: AgentOutputParser
Parses ReAct-style LLM calls that have a single tool input in json format.
Expects output to be in on... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-1 | Default implementation of ainvoke, calls invoke from a thread.
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 aparse(text: str) → T¶
Parse a single string model ou... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-2 | This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops can be applied in order to construct state.
async atransform(input: As... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-3 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-4 | Instructions on how the LLM output should be formatted.
get_input_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
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 sc... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-5 | purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other keys. Please refer to the RunnableConfig
for more details.
Returns
The output of the runnable.
classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]]... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-6 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
parse_result(result: List[Generation], *, partial: bool = False) → T¶
Parse a list of candidate model Generations... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-7 | 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/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-8 | 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/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
731a7c18ac5c-9 | 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/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
256c2cc9b14f-0 | langchain.agents.agent_toolkits.json.base.create_json_agent¶ | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html |
256c2cc9b14f-1 | langchain.agents.agent_toolkits.json.base.create_json_agent(llm: BaseLanguageModel, toolkit: JsonToolkit, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the f... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html |
256c2cc9b14f-2 | to see what keys exist at that path.\nDo not simply refer the user to the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.\n', suffix: str = 'Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I ha... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html |
256c2cc9b14f-3 | Construct a json agent from an LLM and tools.
Examples using create_json_agent¶
JSON | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html |
383ccfc31616-0 | langchain.agents.agent_toolkits.github.toolkit.GitHubToolkit¶
class langchain.agents.agent_toolkits.github.toolkit.GitHubToolkit[source]¶
Bases: BaseToolkit
GitHub Toolkit.
Security Note: This toolkit contains tools that can read and modifythe state of a service; e.g., by creating, deleting, or updating,
reading underl... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.github.toolkit.GitHubToolkit.html |
383ccfc31616-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/agents/langchain.agents.agent_toolkits.github.toolkit.GitHubToolkit.html |
383ccfc31616-2 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.github.toolkit.GitHubToolkit.html |
bb816183208e-0 | langchain_experimental.agents.agent_toolkits.csv.base.create_csv_agent¶
langchain_experimental.agents.agent_toolkits.csv.base.create_csv_agent(llm: BaseLanguageModel, path: Union[str, IOBase, List[Union[str, IOBase]]], pandas_kwargs: Optional[dict] = None, **kwargs: Any) → AgentExecutor[source]¶
Create csv agent by loa... | lang/api.python.langchain.com/en/latest/agents/langchain_experimental.agents.agent_toolkits.csv.base.create_csv_agent.html |
2d35b513ea42-0 | langchain.agents.agent.LLMSingleActionAgent¶
class langchain.agents.agent.LLMSingleActionAgent[source]¶
Bases: BaseSingleActionAgent
Base class for single action agents.
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 va... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.LLMSingleActionAgent.html |
2d35b513ea42-1 | 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/agents/langchain.agents.agent.LLMSingleActionAgent.html |
2d35b513ea42-2 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
plan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], Base... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.LLMSingleActionAgent.html |
2d35b513ea42-3 | property input_keys: List[str]¶
Return the input keys.
Returns
List of input keys.
property return_values: List[str]¶
Return values of the agent.
Examples using LLMSingleActionAgent¶
Plug-and-Plai
Wikibase Agent
SalesGPT - Your Context-Aware AI Sales Assistant With Knowledge Base
Custom Agent with PlugIn Retrieval
Cust... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.LLMSingleActionAgent.html |
e4567c717eab-0 | langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent¶
class langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent[source]¶
Bases: BaseMultiActionAgent
An Agent driven by OpenAIs function powered API.
Parameters
llm – This should be an instance of ChatOpenAI, specifically a... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent.html |
e4567c717eab-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/agents/langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent.html |
e4567c717eab-2 | Construct an agent from an LLM and tools.
classmethod from_orm(obj: Any) → Model¶
get_allowed_tools() → List[str][source]¶
Get allowed tools.
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_d... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent.html |
e4567c717eab-3 | **kwargs – User inputs.
Returns
Action specifying what tool to use.
return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → AgentFinish¶
Return response when agent has been stopped due to max iterations.
save(file_path: Union[Path, str]) → None¶
Save the a... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent.html |
6bb7e65c3724-0 | langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit¶
class langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit[source]¶
Bases: BaseToolkit
Natural Language API Toolkit.
Security Note: This toolkit creates tools that enable making callsto an Open API compliant API.
The tools created by this toolkit may be able to ... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit.html |
6bb7e65c3724-1 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit.html |
6bb7e65c3724-2 | get_tools() → List[BaseTool][source]¶
Get the tools for all the API operations.
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, e... | lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit.html |
a664880ffa8b-0 | langchain_experimental.agents.agent_toolkits.python.base.create_python_agent¶
langchain_experimental.agents.agent_toolkits.python.base.create_python_agent(llm: BaseLanguageModel, tool: PythonREPLTool, agent_type: AgentType = AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager: Optional[BaseCallbackManager] = None, ... | lang/api.python.langchain.com/en/latest/agents/langchain_experimental.agents.agent_toolkits.python.base.create_python_agent.html |
5bced4ededf5-0 | langchain_experimental.llm_bash.prompt.BashOutputParser¶
class langchain_experimental.llm_bash.prompt.BashOutputParser[source]¶
Bases: BaseOutputParser
Parser for bash output.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kw... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-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/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-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/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-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/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-4 | Runnables that leverage the configurable_fields and configurable_alternatives
methods will have a dynamic output schema that depends on which
configuration the runnable is invoked with.
This method allows to get an output schema for a specific configuration.
Parameters
config – A config to use when generating the schem... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-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) → List[str][source]¶
Parse a single string model output into some st... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-6 | prompt – Input PromptValue.
Returns
Structured output
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Input, config: O... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-7 | exceptions_to_handle – A tuple of exception types to handle.
Returns
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
5bced4ededf5-8 | The type of input this runnable accepts specified as a type annotation.
property OutputType: Type[langchain.schema.output_parser.T]¶
The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for ... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.prompt.BashOutputParser.html |
6df6d662981c-0 | langchain_experimental.llm_bash.base.LLMBashChain¶
class langchain_experimental.llm_bash.base.LLMBashChain[source]¶
Bases: Chain
Chain that interprets a prompt and executes bash operations.
Example
from langchain.chains import LLMBashChain
from langchain.llms import OpenAI
llm_bash = LLMBashChain.from_llm(OpenAI())
Cre... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-1 | and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=BashOutputParser(), template='If someone asks you to perform a task, your job is ... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-2 | accessible via langchain.globals.get_verbose().
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = Non... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-3 | Default implementation runs ainvoke in parallel using asyncio.gather.
The default implementation of batch works well for IO bound runnables.
Subclasses should override this method if they can batch more efficiently;
e.g., if the underlying runnable uses an API which supports a batch mode.
async acall(inputs: Union[Dict... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-4 | Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code e... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-5 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
await chain.arun("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' s... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-6 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-7 | 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/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-8 | # -> {"_type": "foo", "verbose": False, ...}
classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=BashOutputParser(), template='If someone asks you to perform a task, your job is to come up with a series of bash commands that will perform t... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-9 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and con... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-10 | 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/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-11 | Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str,... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-12 | these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-13 | 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/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-14 | 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/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
6df6d662981c-15 | property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model.
Examples using LLMBashChain¶
Bash chain | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.base.LLMBashChain.html |
f6331a66746e-0 | langchain_experimental.llm_bash.bash.BashProcess¶
class langchain_experimental.llm_bash.bash.BashProcess(strip_newlines: bool = False, return_err_output: bool = False, persistent: bool = False)[source]¶
Wrapper class for starting subprocesses.
Uses the python built-in subprocesses.run()
Persistent processes are not ava... | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.bash.BashProcess.html |
f6331a66746e-1 | subprocess or on in a new subprocess environment.
Parameters
commands (List[str]) – a list of commands to
execute in the session
Examples using BashProcess¶
Bash chain | lang/api.python.langchain.com/en/latest/llm_bash/langchain_experimental.llm_bash.bash.BashProcess.html |
552ecd753d15-0 | langchain.model_laboratory.ModelLaboratory¶
class langchain.model_laboratory.ModelLaboratory(chains: Sequence[Chain], names: Optional[List[str]] = None)[source]¶
Experiment with different models.
Initialize with chains to experiment with.
Parameters
chains – list of chains to experiment with.
Methods
__init__(chains[, ... | lang/api.python.langchain.com/en/latest/model_laboratory/langchain.model_laboratory.ModelLaboratory.html |
109d6782666e-0 | langchain.callbacks.infino_callback.import_infino¶
langchain.callbacks.infino_callback.import_infino() → Any[source]¶
Import the infino client. | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.infino_callback.import_infino.html |
da1b0848b940-0 | langchain.callbacks.aim_callback.BaseMetadataCallbackHandler¶
class langchain.callbacks.aim_callback.BaseMetadataCallbackHandler[source]¶
This class handles the metadata and associated function states for callbacks.
step¶
The current step.
Type
int
starts¶
The number of times the start method has been called.
Type
int
... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.BaseMetadataCallbackHandler.html |
da1b0848b940-1 | Type
int
Attributes
always_verbose
Whether to call verbose callbacks even if verbose is False.
ignore_agent
Whether to ignore agent callbacks.
ignore_chain
Whether to ignore chain callbacks.
ignore_llm
Whether to ignore LLM callbacks.
ignore_retriever
Whether to ignore retriever callbacks.
Methods
__init__()
get_custom... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.BaseMetadataCallbackHandler.html |
55f477ad1fa8-0 | langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler¶
class langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler(*, answer_prefix_tokens: Optional[List[str]] = None, strip_tokens: bool = True, stream_prefix: bool = False)[source]¶
Callback handler for stream... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler.html |
55f477ad1fa8-1 | Run when LLM starts running.
on_llm_end(response, **kwargs)
Run when LLM ends running.
on_llm_error(error, **kwargs)
Run when LLM errors.
on_llm_new_token(token, **kwargs)
Run on new LLM token.
on_llm_start(serialized, prompts, **kwargs)
Run when LLM starts running.
on_retriever_end(documents, *, run_id[, ...])
Run whe... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler.html |
55f477ad1fa8-2 | append_to_last_tokens(token: str) → None[source]¶
check_if_answer_reached() → bool[source]¶
on_agent_action(action: AgentAction, **kwargs: Any) → Any¶
Run on agent action.
on_agent_finish(finish: AgentFinish, **kwargs: Any) → None¶
Run on agent end.
on_chain_end(outputs: Dict[str, Any], **kwargs: Any) → None¶
Run when ... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler.html |
55f477ad1fa8-3 | Run when Retriever errors.
on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when Retriever starts running.
on_retry(retry_state: RetryCallState, *, run_... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler.html |
a4b92d087707-0 | langchain.callbacks.context_callback.ContextCallbackHandler¶
class langchain.callbacks.context_callback.ContextCallbackHandler(token: str = '', verbose: bool = False, **kwargs: Any)[source]¶
Callback Handler that records transcripts to the Context service.
(https://context.ai).
Keyword Arguments
token (optional) – The ... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.context_callback.ContextCallbackHandler.html |
a4b92d087707-1 | ... [human_message_prompt]
... )
>>> callback = ContextCallbackHandler(token)
>>> # Note: the same callback object must be shared between the
... LLM and the chain.
>>> chat = ChatOpenAI(temperature=0.9, callbacks=[callback])
>>> chain = LLMChain(
... llm=chat,
... prompt=chat_prompt_template,
... callbacks=[... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.context_callback.ContextCallbackHandler.html |
a4b92d087707-2 | Run on new LLM token.
on_llm_start(serialized, prompts, *, run_id)
Run when LLM starts running.
on_retriever_end(documents, *, run_id[, ...])
Run when Retriever ends running.
on_retriever_error(error, *, run_id[, ...])
Run when Retriever errors.
on_retriever_start(serialized, query, *, run_id)
Run when Retriever starts... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.context_callback.ContextCallbackHandler.html |
a4b92d087707-3 | Run when chain errors.
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) → None[source]¶
Run when chain starts.
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, **kwargs: Any) → Any[source]¶
Run when the chat model is started.
on_llm_end... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.context_callback.ContextCallbackHandler.html |
a4b92d087707-4 | Run when Retriever ends running.
on_retriever_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when Retriever errors.
on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = ... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.context_callback.ContextCallbackHandler.html |
f3bc8681d60a-0 | langchain.callbacks.wandb_callback.import_wandb¶
langchain.callbacks.wandb_callback.import_wandb() → Any[source]¶
Import the wandb python package and raise an error if it is not installed. | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.wandb_callback.import_wandb.html |
572631c27259-0 | langchain.callbacks.aim_callback.AimCallbackHandler¶
class langchain.callbacks.aim_callback.AimCallbackHandler(repo: Optional[str] = None, experiment_name: Optional[str] = None, system_tracking_interval: Optional[int] = 10, log_system_params: bool = True)[source]¶
Callback Handler that logs to Aim.
Parameters
repo (str... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.AimCallbackHandler.html |
572631c27259-1 | get_custom_callback_meta()
on_agent_action(action, **kwargs)
Run on agent action.
on_agent_finish(finish, **kwargs)
Run when agent ends running.
on_chain_end(outputs, **kwargs)
Run when chain ends running.
on_chain_error(error, **kwargs)
Run when chain errors.
on_chain_start(serialized, inputs, **kwargs)
Run when chain... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.AimCallbackHandler.html |
572631c27259-2 | reset_callback_meta()
Reset the callback metadata.
setup(**kwargs)
__init__(repo: Optional[str] = None, experiment_name: Optional[str] = None, system_tracking_interval: Optional[int] = 10, log_system_params: bool = True) → None[source]¶
Initialize callback handler.
flush_tracker(repo: Optional[str] = None, experiment_n... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.AimCallbackHandler.html |
572631c27259-3 | Run when chain ends running.
on_chain_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when chain errors.
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) → None[source]¶
Run when chain starts running.
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[Bas... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.AimCallbackHandler.html |
572631c27259-4 | Run when Retriever errors.
on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when Retriever starts running.
on_retry(retry_state: RetryCallState, *, run_... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.aim_callback.AimCallbackHandler.html |
8c4d3a6397f3-0 | langchain.callbacks.infino_callback.InfinoCallbackHandler¶
class langchain.callbacks.infino_callback.InfinoCallbackHandler(model_id: Optional[str] = None, model_version: Optional[str] = None, verbose: bool = False)[source]¶
Callback Handler that logs to Infino.
Attributes
ignore_agent
Whether to ignore agent callbacks.... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.infino_callback.InfinoCallbackHandler.html |
8c4d3a6397f3-1 | Run when Retriever ends running.
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, **kwargs)
Do nothing.
on_tool_end(output[, obs... | lang/api.python.langchain.com/en/latest/callbacks/langchain.callbacks.infino_callback.InfinoCallbackHandler.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.