File size: 2,751 Bytes
20001bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Semantic Extraction Output",
  "type": "object",
  "required": [
    "document_type",
    "summary",
    "workflow",
    "entities",
    "decisions",
    "action_items",
    "metadata"
  ],
  "properties": {
    "document_type": {
      "type": "string",
      "enum": [
        "sop",
        "meeting_notes",
        "email",
        "support_ticket"
      ]
    },
    "summary": {
      "type": "string"
    },
    "workflow": {
      "type": "object",
      "required": ["steps"],
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["order", "action", "owner", "condition"],
            "properties": {
              "order": {"type": "integer", "minimum": 1},
              "action": {"type": "string"},
              "owner": {"type": ["string", "null"]},
              "condition": {"type": ["string", "null"]}
            }
          }
        }
      }
    },
    "entities": {
      "type": "object",
      "required": [
        "people",
        "organizations",
        "monetary_values",
        "dates",
        "systems"
      ],
      "properties": {
        "people": {"type": "array", "items": {"type": "string"}},
        "organizations": {"type": "array", "items": {"type": "string"}},
        "monetary_values": {"type": "array", "items": {"type": "string"}},
        "dates": {"type": "array", "items": {"type": "string"}},
        "systems": {"type": "array", "items": {"type": "string"}}
      }
    },
    "decisions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["condition", "action", "confidence"],
        "properties": {
          "condition": {"type": "string"},
          "action": {"type": "string"},
          "confidence": {"type": "number", "minimum": 0, "maximum": 1}
        }
      }
    },
    "action_items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["task", "owner", "deadline", "priority"],
        "properties": {
          "task": {"type": "string"},
          "owner": {"type": ["string", "null"]},
          "deadline": {"type": ["string", "null"]},
          "priority": {
            "type": "string",
            "enum": ["high", "medium", "low"]
          }
        }
      }
    },
    "metadata": {
      "type": "object",
      "required": ["extraction_method", "confidence", "token_count"],
      "properties": {
        "extraction_method": {"type": "string", "enum": ["gemini", "heuristic"]},
        "confidence": {"type": "number", "minimum": 0, "maximum": 1},
        "token_count": {"type": "integer", "minimum": 0}
      }
    }
  }
}