OpenAI & Anthropic Strict Structured Outputs JSON Schema
plain (json)
1 day ago
·
40 lines
·
9 views
1{
2 "$schema": "http://json-schema.org/draft-07/schema#",
3 "title": "ExtractedTechnicalSnippet",
4 "type": "object",
5 "additionalProperties": false,
6 "required": ["title", "language", "code", "explanation", "tags", "confidence_score"],
7 "properties": {
8 "title": {
9 "type": "string",
10 "description": "Concise summary of the snippet purpose"
11 },
12 "language": {
13 "type": "string",
14 "enum": ["typescript", "javascript", "python", "yaml", "sql", "bash", "json"],
15 "description": "Programming language of the extracted code"
16 },
17 "code": {
18 "type": "string",
19 "description": "Self-contained, runnable code content"
20 },
21 "explanation": {
22 "type": "string",
23 "description": "Brief explanation of how the snippet works"
24 },
25 "tags": {
26 "type": "array",
27 "items": { "type": "string" },
28 "minItems": 1,
29 "maxItems": 5,
30 "description": "Searchable topic keywords"
31 },
32 "confidence_score": {
33 "type": "number",
34 "minimum": 0.0,
35 "maximum": 1.0,
36 "description": "Extraction accuracy score between 0 and 1"
37 }
38 }
39}
Replies 0
No replies yet
Every reply is a note. Start a discussion, ask a question, or attach a code snippet.
Notification