Skip to content

ai: Add JSON format instruction to AI prompt system messages#1296

Open
elie222 wants to merge 1 commit intomainfrom
feat/add-json-format-instruction-to-ai-prompts
Open

ai: Add JSON format instruction to AI prompt system messages#1296
elie222 wants to merge 1 commit intomainfrom
feat/add-json-format-instruction-to-ai-prompts

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jan 16, 2026

User description

Adds explicit "Return your response in JSON format." instruction to system prompts across AI utility functions.

  • Ensures consistent JSON response format from LLM calls
  • Applied to digest, document filing, and report generation functions
  • Improves reliability of structured data parsing

Generated description

Below is a concise technical summary of the changes proposed in this PR:

graph LR
classDef added stroke:#15AA7A
classDef removed stroke:#CD5270
classDef modified stroke:#EDAC4C
linkStyle default stroke:#CBD5E1,font-size:13px
Loading

Enhances the reliability of AI-driven features by explicitly instructing the LLM to return responses in JSON format across multiple system prompts. This change affects core utility functions responsible for email summarization, document filing intent parsing, and comprehensive email behavior analysis.

Latest Contributors(2)
UserCommitDate
elie222security-add-prompt-ha...January 14, 2026
eduardoleliss@gmail.comUpdate-prompt-and-temp...August 28, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Jan 16, 2026 2:18pm

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

- Exclude opaque technical identifiers like account IDs, payment IDs, tracking tokens, or long alphanumeric strings that aren't meaningful to users.
`;

Return your response in JSON format.`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System prompt now demands JSON null for spam but the schema defined earlier only accepts { content: string }, so generateObject will throw a TypeValidationError whenever spam is reported and we end up treating it as a failure (with retries/logs) instead of a clean null summary; can we allow the schema/handler to accept null before parsing?

Suggested change
Return your response in JSON format.`;
Return your response in JSON format as an object matching the schema (with a "content" string property); for spam, promotional, or irrelevant emails, return { "content": "" }.`

Finding type: Breaking Changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant