Skip to content

Commit b4f47dd

Browse files
committed
fix: allow AI to use type clarify when asking questions to avoid Pydantic validation error
1 parent 2f15e96 commit b4f47dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/python-service/routers

‎apps/python-service/routers/ai.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CollectionCreatorRequest(BaseModel):
5757
encrypted_byok: EncryptedByok | None = None
5858

5959
class CollectionCreatorResponse(BaseModel):
60-
type: Literal["schema", "complete"]
60+
type: Literal["clarify", "schema", "complete"]
6161
message: str
6262
schema_: list[CollectionSchema] | None = Field(default=None, alias="schema")
6363

@@ -166,7 +166,7 @@ async def collection_creator(request: CollectionCreatorRequest, req: Request):
166166
system_prompt = """You are a MongoDB schema designer for urBackend, a Backend-as-a-Service platform.
167167
168168
Rules:
169-
1. If the description is vague, ask 2-3 specific clarifying questions. NEVER ask more than 3 at once.
169+
1. If the description is vague, ask 2-3 specific clarifying questions and set type: "clarify". NEVER ask more than 3 at once.
170170
2. Once you have enough context, propose a schema and set type: "schema".
171171
3. Only use these field types: String, Number, Boolean, Date, Object, Array, Ref.
172172
4. ALWAYS include "createdAt" (type: Date, required: true) in EVERY collection.

0 commit comments

Comments
 (0)