Skip to content

Commit 916a6f5

Browse files
committed
fix(ai): revert schema to optional and explicitly instruct LLM to pass null for Groq tool compatibility
1 parent 122861f commit 916a6f5

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
@@ -59,7 +59,7 @@ class CollectionCreatorRequest(BaseModel):
5959
class CollectionCreatorResponse(BaseModel):
6060
type: Literal["clarify", "schema", "complete"]
6161
message: str
62-
schema_: list[CollectionSchema] = Field(..., alias="schema", description="Must be an empty array [] if type is 'clarify'")
62+
schema_: list[CollectionSchema] | None = Field(default=None, alias="schema", description="MUST be null if type is 'clarify' or 'complete'")
6363

6464
model_config = ConfigDict(populate_by_name=True)
6565

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

0 commit comments

Comments
 (0)