add error_code_mapping and extracted_information_schema to task v2 (#1950)
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
"""add error_code_mapping and extracted_information_schema to task v2
|
||||||
|
|
||||||
|
Revision ID: c6c0eee7f88d
|
||||||
|
Revises: 268dcc995513
|
||||||
|
Create Date: 2025-03-18 18:50:28.930836+00:00
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = "c6c0eee7f88d"
|
||||||
|
down_revision: Union[str, None] = "268dcc995513"
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column("observer_cruises", sa.Column("extracted_information_schema", sa.JSON(), nullable=True))
|
||||||
|
op.add_column("observer_cruises", sa.Column("error_code_mapping", sa.JSON(), nullable=True))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column("observer_cruises", "error_code_mapping")
|
||||||
|
op.drop_column("observer_cruises", "extracted_information_schema")
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -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:
|
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.
|
"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:
|
||||||
```
|
```
|
||||||
{{ 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):
|
Task history (the earliest task is the first in the list and the latest is the last in the list):
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -588,6 +588,8 @@ class TaskV2Model(Base):
|
|||||||
totp_verification_url = Column(String, nullable=True)
|
totp_verification_url = Column(String, nullable=True)
|
||||||
totp_identifier = Column(String, nullable=True)
|
totp_identifier = Column(String, nullable=True)
|
||||||
proxy_location = 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)
|
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)
|
||||||
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)
|
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ class TaskV2(BaseModel):
|
|||||||
totp_identifier: str | None = None
|
totp_identifier: str | None = None
|
||||||
proxy_location: ProxyLocation | None = None
|
proxy_location: ProxyLocation | None = None
|
||||||
webhook_callback_url: str | 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
|
created_at: datetime
|
||||||
modified_at: datetime
|
modified_at: datetime
|
||||||
@@ -117,6 +119,8 @@ class TaskV2Request(BaseModel):
|
|||||||
totp_identifier: str | None = None
|
totp_identifier: str | None = None
|
||||||
proxy_location: ProxyLocation | None = None
|
proxy_location: ProxyLocation | None = None
|
||||||
publish_workflow: bool = False
|
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")
|
@field_validator("url", "webhook_callback_url", "totp_verification_url")
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -1395,6 +1395,7 @@ async def _summarize_task_v2(
|
|||||||
"task_v2_summary",
|
"task_v2_summary",
|
||||||
user_goal=task_v2.prompt,
|
user_goal=task_v2.prompt,
|
||||||
task_history=task_history,
|
task_history=task_history,
|
||||||
|
extracted_information_schema=task_v2.extracted_information_schema,
|
||||||
local_datetime=datetime.now(context.tz_info).isoformat(),
|
local_datetime=datetime.now(context.tz_info).isoformat(),
|
||||||
)
|
)
|
||||||
task_v2_summary_resp = await app.LLM_API_HANDLER(
|
task_v2_summary_resp = await app.LLM_API_HANDLER(
|
||||||
|
|||||||
Reference in New Issue
Block a user