agentscope.parsers.parser_base module
The base class for model response parser.
- class DictFilterMixin(keys_to_memory: str | bool | Sequence[str], keys_to_content: str | bool | Sequence[str], keys_to_metadata: str | bool | Sequence[str])[source]
Bases:
object
A mixin class to filter the parsed response by keys. It allows users to set keys to be filtered during speaking, storing in memory, and returning in the agent reply function.
- to_content(parsed_response: dict, allow_missing: bool = False) str | dict | None [source]
Filter the fields that will be fed into the content field in the returned message, which will be exposed to other agents.
- class ParserBase[source]
Bases:
ABC
The base class for model response parser.
- abstract parse(response: ModelResponse) ModelResponse [source]
Parse the response text to a specific object, and stored in the parsed field of the response object.