refactor(models): replace ConfigDict with SQLModelConfig for model configuration
This commit is contained in:
@@ -7,7 +7,8 @@ from datetime import datetime
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from pydantic import ConfigDict, Field, field_validator
|
from pydantic import Field, field_validator
|
||||||
|
from sqlmodel._compat import SQLModelConfig
|
||||||
from sqlmodel import SQLModel
|
from sqlmodel import SQLModel
|
||||||
|
|
||||||
from app.schemas.common import NonEmptyStr
|
from app.schemas.common import NonEmptyStr
|
||||||
@@ -42,7 +43,7 @@ def _normalize_identity_profile(
|
|||||||
class AgentBase(SQLModel):
|
class AgentBase(SQLModel):
|
||||||
"""Common fields shared by agent create/read/update payloads."""
|
"""Common fields shared by agent create/read/update payloads."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_profile",
|
"x-llm-intent": "agent_profile",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -129,7 +130,7 @@ class AgentCreate(AgentBase):
|
|||||||
class AgentUpdate(SQLModel):
|
class AgentUpdate(SQLModel):
|
||||||
"""Payload for patching an existing agent."""
|
"""Payload for patching an existing agent."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_profile_update",
|
"x-llm-intent": "agent_profile_update",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -214,7 +215,7 @@ class AgentUpdate(SQLModel):
|
|||||||
class AgentRead(AgentBase):
|
class AgentRead(AgentBase):
|
||||||
"""Public agent representation returned by the API."""
|
"""Public agent representation returned by the API."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_profile_lookup",
|
"x-llm-intent": "agent_profile_lookup",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -251,7 +252,7 @@ class AgentRead(AgentBase):
|
|||||||
class AgentHeartbeat(SQLModel):
|
class AgentHeartbeat(SQLModel):
|
||||||
"""Heartbeat status payload sent by agents."""
|
"""Heartbeat status payload sent by agents."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_health_signal",
|
"x-llm-intent": "agent_health_signal",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -272,7 +273,7 @@ class AgentHeartbeat(SQLModel):
|
|||||||
class AgentHeartbeatCreate(AgentHeartbeat):
|
class AgentHeartbeatCreate(AgentHeartbeat):
|
||||||
"""Heartbeat payload used to create an agent lazily."""
|
"""Heartbeat payload used to create an agent lazily."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_bootstrap",
|
"x-llm-intent": "agent_bootstrap",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -298,7 +299,7 @@ class AgentHeartbeatCreate(AgentHeartbeat):
|
|||||||
class AgentNudge(SQLModel):
|
class AgentNudge(SQLModel):
|
||||||
"""Nudge message payload for pinging an agent."""
|
"""Nudge message payload for pinging an agent."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "agent_nudge",
|
"x-llm-intent": "agent_nudge",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
|
|||||||
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pydantic import ConfigDict, Field
|
from pydantic import Field
|
||||||
from sqlmodel import SQLModel
|
from sqlmodel import SQLModel
|
||||||
|
from sqlmodel._compat import SQLModelConfig
|
||||||
|
|
||||||
|
|
||||||
class LLMErrorResponse(SQLModel):
|
class LLMErrorResponse(SQLModel):
|
||||||
"""Standardized LLM-facing error payload used by API contracts."""
|
"""Standardized LLM-facing error payload used by API contracts."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"title": "LLMErrorResponse",
|
"title": "LLMErrorResponse",
|
||||||
"x-llm-intent": "llm_error_handling",
|
"x-llm-intent": "llm_error_handling",
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ from __future__ import annotations
|
|||||||
from typing import Literal
|
from typing import Literal
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from pydantic import ConfigDict, Field
|
from pydantic import Field
|
||||||
|
from sqlmodel._compat import SQLModelConfig
|
||||||
from sqlmodel import SQLModel
|
from sqlmodel import SQLModel
|
||||||
|
|
||||||
from app.schemas.common import NonEmptyStr
|
from app.schemas.common import NonEmptyStr
|
||||||
@@ -24,7 +25,7 @@ def _user_reply_tags() -> list[str]:
|
|||||||
class GatewayLeadMessageRequest(SQLModel):
|
class GatewayLeadMessageRequest(SQLModel):
|
||||||
"""Request payload for sending a message to a board lead agent."""
|
"""Request payload for sending a message to a board lead agent."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "lead_direct_message",
|
"x-llm-intent": "lead_direct_message",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -71,7 +72,7 @@ class GatewayLeadMessageRequest(SQLModel):
|
|||||||
class GatewayLeadMessageResponse(SQLModel):
|
class GatewayLeadMessageResponse(SQLModel):
|
||||||
"""Response payload for a lead-message dispatch attempt."""
|
"""Response payload for a lead-message dispatch attempt."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "lead_direct_message_result",
|
"x-llm-intent": "lead_direct_message_result",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -104,7 +105,7 @@ class GatewayLeadMessageResponse(SQLModel):
|
|||||||
class GatewayLeadBroadcastRequest(SQLModel):
|
class GatewayLeadBroadcastRequest(SQLModel):
|
||||||
"""Request payload for broadcasting a message to multiple board leads."""
|
"""Request payload for broadcasting a message to multiple board leads."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "lead_broadcast_message",
|
"x-llm-intent": "lead_broadcast_message",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -154,7 +155,7 @@ class GatewayLeadBroadcastRequest(SQLModel):
|
|||||||
class GatewayLeadBroadcastBoardResult(SQLModel):
|
class GatewayLeadBroadcastBoardResult(SQLModel):
|
||||||
"""Per-board result entry for a lead broadcast operation."""
|
"""Per-board result entry for a lead broadcast operation."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "lead_broadcast_status",
|
"x-llm-intent": "lead_broadcast_status",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -184,7 +185,7 @@ class GatewayLeadBroadcastBoardResult(SQLModel):
|
|||||||
class GatewayLeadBroadcastResponse(SQLModel):
|
class GatewayLeadBroadcastResponse(SQLModel):
|
||||||
"""Aggregate response for a lead broadcast operation."""
|
"""Aggregate response for a lead broadcast operation."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "lead_broadcast_summary",
|
"x-llm-intent": "lead_broadcast_summary",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -208,7 +209,7 @@ class GatewayLeadBroadcastResponse(SQLModel):
|
|||||||
class GatewayMainAskUserRequest(SQLModel):
|
class GatewayMainAskUserRequest(SQLModel):
|
||||||
"""Request payload for asking the end user via a main gateway agent."""
|
"""Request payload for asking the end user via a main gateway agent."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "human_escalation_request",
|
"x-llm-intent": "human_escalation_request",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
@@ -252,7 +253,7 @@ class GatewayMainAskUserRequest(SQLModel):
|
|||||||
class GatewayMainAskUserResponse(SQLModel):
|
class GatewayMainAskUserResponse(SQLModel):
|
||||||
"""Response payload for user-question dispatch via gateway main agent."""
|
"""Response payload for user-question dispatch via gateway main agent."""
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = SQLModelConfig(
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"x-llm-intent": "human_escalation_result",
|
"x-llm-intent": "human_escalation_result",
|
||||||
"x-when-to-use": [
|
"x-when-to-use": [
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ from __future__ import annotations
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from pydantic import AnyHttpUrl, ConfigDict
|
from pydantic import AnyHttpUrl
|
||||||
from sqlmodel import Field, SQLModel
|
from sqlmodel import Field, SQLModel
|
||||||
|
from sqlmodel._compat import SQLModelConfig
|
||||||
|
|
||||||
from app.schemas.common import NonEmptyStr
|
from app.schemas.common import NonEmptyStr
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ class SkillPackCreate(SQLModel):
|
|||||||
branch: str = "main"
|
branch: str = "main"
|
||||||
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
||||||
|
|
||||||
model_config = ConfigDict(validate_by_name=True)
|
model_config = SQLModelConfig(validate_by_name=True)
|
||||||
|
|
||||||
|
|
||||||
class MarketplaceSkillRead(SQLModel):
|
class MarketplaceSkillRead(SQLModel):
|
||||||
@@ -46,7 +47,7 @@ class MarketplaceSkillRead(SQLModel):
|
|||||||
source_url: str
|
source_url: str
|
||||||
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
||||||
|
|
||||||
model_config = ConfigDict(validate_by_name=True)
|
model_config = SQLModelConfig(validate_by_name=True)
|
||||||
|
|
||||||
created_at: datetime
|
created_at: datetime
|
||||||
updated_at: datetime
|
updated_at: datetime
|
||||||
@@ -63,7 +64,7 @@ class SkillPackRead(SQLModel):
|
|||||||
branch: str
|
branch: str
|
||||||
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
metadata_: dict[str, object] = Field(default_factory=dict, alias="metadata")
|
||||||
|
|
||||||
model_config = ConfigDict(validate_by_name=True)
|
model_config = SQLModelConfig(validate_by_name=True)
|
||||||
|
|
||||||
skill_count: int = 0
|
skill_count: int = 0
|
||||||
created_at: datetime
|
created_at: datetime
|
||||||
|
|||||||
Reference in New Issue
Block a user