add error_code_mapping and extracted_information_schema to task v2 (#1950)

This commit is contained in:
Shuchang Zheng
2025-03-18 11:53:54 -07:00
committed by GitHub
parent e4a986d286
commit 39162ded9b
5 changed files with 44 additions and 2 deletions

View File

@@ -5,13 +5,15 @@ You want to present the response in a clear way so that user can clearly underst
Reply in JSON format with the following keys:
{
"description": str, // Summarize what has been achieved and describe the information extracted related to the user goal if any. Be precise and concise.
"output": json, // Structured data related to the user goal if any.
"output": json, // Structured data related to the user goal if any.{% if extracted_information_schema %} Use the data schema for the output field.{% endif %}
}
User goal:
```
{{ user_goal }}
```
```{% if extracted_information_schema %}
The ideal schema for the "output" field: {{ extracted_information_schema }}{% endif %}
Task history (the earliest task is the first in the list and the latest is the last in the list):
```

View File

@@ -588,6 +588,8 @@ class TaskV2Model(Base):
totp_verification_url = Column(String, nullable=True)
totp_identifier = Column(String, nullable=True)
proxy_location = Column(String, nullable=True)
extracted_information_schema = Column(JSON, nullable=True)
error_code_mapping = Column(JSON, nullable=True)
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)

View File

@@ -41,6 +41,8 @@ class TaskV2(BaseModel):
totp_identifier: str | None = None
proxy_location: ProxyLocation | None = None
webhook_callback_url: str | None = None
extracted_information_schema: dict | list | str | None = None
error_code_mapping: dict | None = None
created_at: datetime
modified_at: datetime
@@ -117,6 +119,8 @@ class TaskV2Request(BaseModel):
totp_identifier: str | None = None
proxy_location: ProxyLocation | None = None
publish_workflow: bool = False
extracted_information_schema: dict | list | str | None = None
error_code_mapping: dict[str, str] | None = None
@field_validator("url", "webhook_callback_url", "totp_verification_url")
@classmethod

View File

@@ -1395,6 +1395,7 @@ async def _summarize_task_v2(
"task_v2_summary",
user_goal=task_v2.prompt,
task_history=task_history,
extracted_information_schema=task_v2.extracted_information_schema,
local_datetime=datetime.now(context.tz_info).isoformat(),
)
task_v2_summary_resp = await app.LLM_API_HANDLER(