parser
Module Contents
Classes
Base parser to process inputs and outputs of actions. |
|
Json parser to convert input string into a dictionary. |
|
Tuple parser to convert input string into a tuple. |
- exception lagent.actions.parser.ParseError(err_msg)
Bases:
ExceptionParsing exception class.
- 参数:
err_msg (str) –
- err_msg
- class lagent.actions.parser.BaseParser(action)
Base parser to process inputs and outputs of actions.
- 参数:
action (
BaseAction) – action to validate
- PARAMETER_DESCRIPTION
declare the input format which LLMs should follow when generating arguments for decided tools.
- Type:
str
- PARAMETER_DESCRIPTION: str = ''
- action
- parse_inputs(inputs, name='run')
Parse inputs LLMs generate for the action.
- 参数:
inputs (
str) – input string extracted from responsesname (str) –
- 返回:
processed input
- 返回类型:
dict
- parse_outputs(outputs)
Parser outputs returned by the action.
- 参数:
outputs (
Any) – raw output of the action- 返回:
- processed output of which each member is a
dictionary with two keys - ‘type’ and ‘content’.
- 返回类型:
List[dict]
- class lagent.actions.parser.JsonParser(action)
Bases:
BaseParserJson parser to convert input string into a dictionary.
- 参数:
action (
BaseAction) – action to validate
- PARAMETER_DESCRIPTION = 'If you call this tool, you must pass arguments in the JSON format {key: value}, where the key...
- parse_inputs(inputs, name='run')
Parse inputs LLMs generate for the action.
- 参数:
inputs (
str) – input string extracted from responsesname (str) –
- 返回:
processed input
- 返回类型:
dict
- class lagent.actions.parser.TupleParser(action)
Bases:
BaseParserTuple parser to convert input string into a tuple.
- 参数:
action (
BaseAction) – action to validate
- PARAMETER_DESCRIPTION = 'If you call this tool, you must pass arguments in the tuple format like (arg1, arg2, arg3), and...
- parse_inputs(inputs, name='run')
Parse inputs LLMs generate for the action.
- 参数:
inputs (
str) – input string extracted from responsesname (str) –
- 返回:
processed input
- 返回类型:
dict