File size: 4,848 Bytes
eab050b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
openapi: 3.1.0
info:
  # Do not change the title, if the title changes, the import paths will be broken
  title: Api
  version: 0.1.0
  description: API specification
servers:
  - url: /api
    description: Base API path
tags:
  - name: health
    description: Health operations
  - name: rasa
    description: Vedic Rasa analysis operations
paths:
  /healthz:
    get:
      operationId: healthCheck
      tags: [health]
      summary: Health check
      description: Returns server health status
      responses:
        "200":
          description: Healthy
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthStatus"
  /rasa/analyze:
    post:
      operationId: analyzeRasa
      tags: [rasa]
      summary: Analyze text for Vedic Rasa and hallucination detection
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AnalyzeRasaBody"
      responses:
        "200":
          description: Analysis result
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AnalysisResult"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiError"
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiError"
  /rasa/history:
    get:
      operationId: getRasaHistory
      tags: [rasa]
      summary: Get analysis history
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: List of past analyses
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AnalysisRecord"
  /rasa/history/{id}:
    delete:
      operationId: deleteRasaHistory
      tags: [rasa]
      summary: Delete a history entry
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Deleted
        "404":
          description: Not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiError"
components:
  schemas:
    HealthStatus:
      type: object
      properties:
        status:
          type: string
      required:
        - status
    AnalyzeRasaBody:
      type: object
      properties:
        text:
          type: string
      required:
        - text
    RasaResult:
      type: object
      properties:
        name:
          type: string
        confidence:
          type: number
        explanation:
          type: string
      required:
        - name
        - confidence
        - explanation
    HallucinationResult:
      type: object
      properties:
        score:
          type: number
        severity:
          type: string
        problematic_statements:
          type: array
          items:
            type: string
      required:
        - score
        - severity
        - problematic_statements
    AnalysisResult:
      type: object
      properties:
        rasa:
          $ref: "#/components/schemas/RasaResult"
        hallucination:
          $ref: "#/components/schemas/HallucinationResult"
        summary:
          type: string
        text:
          type: string
        timestamp:
          type: number
      required:
        - rasa
        - hallucination
        - summary
        - text
        - timestamp
    AnalysisRecord:
      type: object
      properties:
        id:
          type: integer
        text:
          type: string
        rasa_name:
          type: string
        rasa_confidence:
          type: number
        rasa_explanation:
          type: string
        hallucination_score:
          type: number
        hallucination_severity:
          type: string
        hallucination_problematic_statements:
          type: array
          items:
            type: string
        summary:
          type: string
        timestamp:
          type: number
        created_at:
          type: string
      required:
        - id
        - text
        - rasa_name
        - rasa_confidence
        - rasa_explanation
        - hallucination_score
        - hallucination_severity
        - hallucination_problematic_statements
        - summary
        - timestamp
        - created_at
    ApiError:
      type: object
      properties:
        error:
          type: string
      required:
        - error