schema package
Submodules
schema.attachment_message module
This is the module for the attachment message
- class schema.attachment_message.AttachmentMessage(*, sender_name: str, icon: str, message: str, timestamp: datetime = None, message_type: Literal['AI', 'USER'], attachment_type: str)[source]
Bases:
GroupMessageThis is the class for an attachment message
- attachment_type: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'attachment_type': FieldInfo(annotation=str, required=True, description='The type of the attachment'), 'icon': FieldInfo(annotation=str, required=True, description='The icon of the sender'), 'message': FieldInfo(annotation=str, required=True, description='The message'), 'message_type': FieldInfo(annotation=Literal[str, str], required=True, description='The type of the message'), 'sender_name': FieldInfo(annotation=str, required=True, description='The sender of the message'), 'timestamp': FieldInfo(annotation=datetime, required=False, default_factory=builtin_function_or_method, description='The timestamp of the message')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
schema.config module
This module is used to define the config file schema
- class schema.config.ConfigFile(*, models: Dict[str, ModelMetaInfo], keys: set[str] = None, base_dir: str = None, group_chat_agents: Dict[str, GroupAgent], shared_state: Dict[str, Any] = None)[source]
Bases:
BaseModelThis class is used to store the information for the config file
- after_models_validate() ConfigFile[source]
This method is used to validate the models
- Returns:
The config file object
- Raises:
InvalidConfigError – If the models are invalid
- base_dir: str
- group_chat_agents: Dict[str, GroupAgent]
- keys: set[str]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'base_dir': FieldInfo(annotation=str, required=False, alias_priority=2, validation_alias='BaseDir', description='The base directory'), 'group_chat_agents': FieldInfo(annotation=Dict[str, GroupAgent], required=True, alias_priority=2, validation_alias='GroupChatAgents', description='The group chat agents'), 'keys': FieldInfo(annotation=set[str], required=False, default_factory=set, alias_priority=2, validation_alias='Keys', description='The model keys'), 'models': FieldInfo(annotation=Dict[str, ModelMetaInfo], required=True, alias_priority=2, validation_alias='Models', description='The models'), 'shared_state': FieldInfo(annotation=Dict[str, Any], required=False, default_factory=dict, alias_priority=2, validation_alias='SharedState', description='The shared state')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- models: Dict[str, ModelMetaInfo]
- classmethod validate_models_and_add_base_dir(data: Any) Any[source]
This method is used to validate the models
- Parameters:
data – The data
- Returns:
The data
This method is used to validate the shared state
- Parameters:
data – The data
- Returns:
The data
- schema.config.pydantic_validate_config(config_file: str, base_path: str) ConfigFile[source]
Validates the config file using pydantic :param config_file: The path to the config file :param base_path: The base path of the app
- Returns:
The validated config file
schema.group_agent module
- class schema.group_agent.GroupAgent(*, name: str, icon: str, description: str, usage_description: str, characters: list[GroupAgentCharacter], base_dir: str = None, examples: list[GroupExample], setting: MetaGPTSetting = None, flow_diagram: str)[source]
Bases:
BaseModelThis class is used to store the group agent information
- base_dir: str
- characters: list[GroupAgentCharacter]
- description: str
- examples: list[GroupExample]
- flow_diagram: str
- get_character(role: str) GroupAgentCharacter[source]
This method is used to get the character with the given role
- Parameters:
role – The role of the character
- Returns:
The character with the given role
- Raises:
ValueError – If the character with the given role is not found
- icon: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'base_dir': FieldInfo(annotation=str, required=False, alias_priority=2, validation_alias='BaseDir', description='The base directory of the group agent'), 'characters': FieldInfo(annotation=list[GroupAgentCharacter], required=True, alias_priority=2, validation_alias='Characters', description='The characters of the group agent'), 'description': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Description', description='The description of the group agent'), 'examples': FieldInfo(annotation=list[GroupExample], required=True, alias_priority=2, validation_alias='Examples', description='The examples of the group agent'), 'flow_diagram': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='FlowDiagram', description='The flow diagram of the group agent'), 'icon': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Icon', description='The icon of the group agent'), 'name': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Name', description='The name of the group agent'), 'setting': FieldInfo(annotation=MetaGPTSetting, required=False, default_factory=MetaGPTSetting, alias_priority=2, validation_alias='Setting', description='The setting of the group agent'), 'usage_description': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='UsageDescription', description='The usage description of the group agent')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- setting: MetaGPTSetting
- usage_description: str
- validate_group() GroupAgent[source]
This method is used to validate the group agent
- Returns:
The group agent object
- Raises:
InvalidConfigError – If the group agent is invalid
- class schema.group_agent.GroupAgentCharacter(*, name: str, icon: str, description: str, role: str, base_dir: str = None)[source]
Bases:
BaseModelThis class is used to store the group agent character information
- base_dir: str
- description: str
- icon: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'base_dir': FieldInfo(annotation=str, required=False, description='The base directory of the App'), 'description': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Description', description='The description of the group agent character'), 'icon': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Icon', description='The icon of the group agent character'), 'name': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Name', description='The name of the group agent character'), 'role': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Role', description='The role of the group agent character')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- role: str
- validate_character() GroupAgentCharacter[source]
This method is used to validate the group agent character
- class schema.group_agent.GroupExample(*, name: str, description: str)[source]
Bases:
BaseModelThis class is used to store the group example information
- description: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Description', description='The description of the group example'), 'name': FieldInfo(annotation=str, required=True, alias_priority=2, validation_alias='Name', description='The name of the group example')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
schema.group_message module
This is the schema for a group message
- class schema.group_message.GroupMessage(*, sender_name: str, icon: str, message: str, timestamp: datetime = None, message_type: Literal['AI', 'USER'])[source]
Bases:
BaseModelThis is the class for a group message
- icon: str
- message: str
- message_type: Literal['AI', 'USER']
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'icon': FieldInfo(annotation=str, required=True, description='The icon of the sender'), 'message': FieldInfo(annotation=str, required=True, description='The message'), 'message_type': FieldInfo(annotation=Literal[str, str], required=True, description='The type of the message'), 'sender_name': FieldInfo(annotation=str, required=True, description='The sender of the message'), 'timestamp': FieldInfo(annotation=datetime, required=False, default_factory=builtin_function_or_method, description='The timestamp of the message')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- sender_name: str
- timestamp: datetime
schema.message module
This is the module for the message data class
- class schema.message.Message(*, message: str, message_type: Literal['SYSTEM', 'USER', 'AI'], timestamp: datetime = None)[source]
Bases:
BaseModelThis is the class for a message
- message: str
- message_type: Literal['SYSTEM', 'USER', 'AI']
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'message': FieldInfo(annotation=str, required=True, description='The message'), 'message_type': FieldInfo(annotation=Literal[str, str, str], required=True, description='The type of message'), 'timestamp': FieldInfo(annotation=datetime, required=False, default_factory=builtin_function_or_method, description='The timestamp of the message')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- timestamp: datetime