agentsociety.webapi.api.agent_template¶
Module Contents¶
Classes¶
Parameter edited at frontend |
|
Name, type and description of agent to describe context / status attribute |
|
Agent parameter |
|
Block parameter |
Functions¶
List all agent templates |
|
Get agent template by ID |
|
Convert agent template from DB format to API format |
|
Create a new agent template |
|
Update an existing agent template |
|
Delete an agent template |
|
Get available block types |
|
Convert type annotation to a simplified string format for human readable |
|
解析pydantic model为适合前端表格呈现的JSON格式 |
|
解析pydantic model为适合AntDesign表单的JSON格式 |
|
Get agent’s parameters including ParamsType, BlockOutputType, Context and StatusAttributes based on agent type and class |
|
Get Block’s parameters including ParamsType and Context for specified block type |
|
Get available agent classes base on agent type |
|
Get available workflow function names |
Data¶
API¶
- agentsociety.webapi.api.agent_template.__all__¶
[‘router’]
- agentsociety.webapi.api.agent_template.router¶
‘APIRouter(…)’
- async agentsociety.webapi.api.agent_template.list_agent_templates(request: fastapi.Request) agentsociety.webapi.models.ApiResponseWrapper[List[agentsociety.webapi.models.agent_template.ApiAgentTemplate]]¶
List all agent templates
- async agentsociety.webapi.api.agent_template.get_agent_template(request: fastapi.Request, template_id: str) agentsociety.webapi.models.ApiResponseWrapper[agentsociety.webapi.models.agent_template.ApiAgentTemplate]¶
Get agent template by ID
- agentsociety.webapi.api.agent_template.convert_agent_template_from_db_to_api(template: agentsociety.webapi.models.agent_template.AgentTemplateDB) agentsociety.webapi.models.agent_template.ApiAgentTemplate¶
Convert agent template from DB format to API format
- async agentsociety.webapi.api.agent_template.create_agent_template(request: fastapi.Request, template: agentsociety.webapi.models.agent_template.ApiAgentTemplate = Body(...)) agentsociety.webapi.models.ApiResponseWrapper[agentsociety.webapi.models.agent_template.ApiAgentTemplate]¶
Create a new agent template
- async agentsociety.webapi.api.agent_template.update_agent_template(request: fastapi.Request, template_id: str, template: agentsociety.webapi.models.agent_template.ApiAgentTemplate = Body(...)) agentsociety.webapi.models.ApiResponseWrapper[agentsociety.webapi.models.agent_template.ApiAgentTemplate]¶
Update an existing agent template
- async agentsociety.webapi.api.agent_template.delete_agent_template(request: fastapi.Request, template_id: str) agentsociety.webapi.models.ApiResponseWrapper[Dict[str, str]]¶
Delete an agent template
- async agentsociety.webapi.api.agent_template.get_agent_blocks(request: fastapi.Request) agentsociety.webapi.models.ApiResponseWrapper[List[str]]¶
Get available block types
- class agentsociety.webapi.api.agent_template.ParamOption¶
Bases:
pydantic.BaseModel
- class agentsociety.webapi.api.agent_template.Param¶
Bases:
pydantic.BaseModelParameter edited at frontend
- options: List[agentsociety.webapi.api.agent_template.ParamOption]¶
[]
- class agentsociety.webapi.api.agent_template.NameTypeDescription¶
Bases:
pydantic.BaseModelName, type and description of agent to describe context / status attribute
- agentsociety.webapi.api.agent_template.simplify_type(type_annotation)¶
Convert type annotation to a simplified string format for human readable
- agentsociety.webapi.api.agent_template.parse_pydantic_to_table(model_class: type[pydantic.BaseModel], exclude_fields: list[str] = []) list[agentsociety.webapi.api.agent_template.NameTypeDescription]¶
解析pydantic model为适合前端表格呈现的JSON格式
Args: model_class: Pydantic BaseModel子类
Returns: list: 包含表格配置的列表
- agentsociety.webapi.api.agent_template.parse_pydantic_to_antd_form(model_class: type[pydantic.BaseModel], exclude_fields: list[str] = []) list[agentsociety.webapi.api.agent_template.Param]¶
解析pydantic model为适合AntDesign表单的JSON格式
Args: model_class: Pydantic BaseModel子类
Returns: list: 包含表格配置的列表
- class agentsociety.webapi.api.agent_template.AgentParam¶
Bases:
pydantic.BaseModelAgent parameter
- params_type: List[agentsociety.webapi.api.agent_template.Param]¶
None
- context: List[agentsociety.webapi.api.agent_template.NameTypeDescription]¶
None
- status_attributes: List[agentsociety.webapi.api.agent_template.NameTypeDescription]¶
None
- async agentsociety.webapi.api.agent_template.get_agent_param(request: fastapi.Request, agent_type: str, agent_class: str) agentsociety.webapi.models.ApiResponseWrapper[agentsociety.webapi.api.agent_template.AgentParam]¶
Get agent’s parameters including ParamsType, BlockOutputType, Context and StatusAttributes based on agent type and class
- class agentsociety.webapi.api.agent_template.BlockParam¶
Bases:
pydantic.BaseModelBlock parameter
- params_type: List[agentsociety.webapi.api.agent_template.Param]¶
None
- context: List[agentsociety.webapi.api.agent_template.NameTypeDescription]¶
None
- async agentsociety.webapi.api.agent_template.get_block_param(request: fastapi.Request, block_type: str) agentsociety.webapi.models.ApiResponseWrapper[agentsociety.webapi.api.agent_template.BlockParam]¶
Get Block’s parameters including ParamsType and Context for specified block type
- async agentsociety.webapi.api.agent_template.get_agent_classes(request: fastapi.Request, agent_type: str) agentsociety.webapi.models.ApiResponseWrapper[List[Dict[str, str]]]¶
Get available agent classes base on agent type
- async agentsociety.webapi.api.agent_template.get_workflow_functions(request: fastapi.Request) agentsociety.webapi.models.ApiResponseWrapper[List[str]]¶
Get available workflow function names