-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
822 lines (822 loc) · 24.4 KB
/
Copy pathopenapi.yaml
File metadata and controls
822 lines (822 loc) · 24.4 KB
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
openapi: 3.1.0
info:
title: Tracia API
description: REST API for managing and running AI prompts with tracing
version: 1.0.0
servers:
- url: https://app.tracia.io/api/v1
description: Production server
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: "API key starting with `tr_`"
schemas:
Message:
type: object
required:
- id
- role
- content
properties:
id:
type: string
description: Unique identifier for the message
role:
type: string
enum: [system, user, assistant]
description: Message role
content:
type: string
description: Message content (may include `{{variables}}`)
Prompt:
type: object
properties:
id:
type: string
description: Unique identifier for the prompt
slug:
type: string
description: URL-friendly identifier
name:
type: string
description: Display name of the prompt
description:
type: string
nullable: true
description: Description of the prompt
provider:
type: string
nullable: true
enum: [OPENAI, ANTHROPIC, GOOGLE, AMAZON_BEDROCK]
description: Model provider
model:
type: string
nullable: true
description: Default model for this prompt
temperature:
type: number
nullable: true
description: Temperature setting for the model (0-2)
topP:
type: number
nullable: true
description: Top-p (nucleus) sampling setting (0-1)
maxOutputTokens:
type: integer
nullable: true
description: Maximum output tokens limit
currentVersion:
type: integer
description: Current version number
content:
type: array
items:
$ref: '#/components/schemas/Message'
description: Array of prompt messages
variables:
type: array
items:
type: string
description: List of template variables extracted from content
createdAt:
type: string
format: date-time
description: ISO 8601 timestamp of creation
updatedAt:
type: string
format: date-time
description: ISO 8601 timestamp of last update
PromptSummary:
type: object
properties:
id:
type: string
slug:
type: string
name:
type: string
description:
type: string
nullable: true
provider:
type: string
nullable: true
model:
type: string
nullable: true
temperature:
type: number
nullable: true
topP:
type: number
nullable: true
maxOutputTokens:
type: integer
nullable: true
currentVersion:
type: integer
variables:
type: array
items:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
Span:
type: object
properties:
id:
type: string
description: Internal identifier
spanId:
type: string
description: External span ID (e.g., `sp_abc123`)
traceId:
type: string
nullable: true
description: Session/trace ID for multi-turn conversations
parentSpanId:
type: string
nullable: true
description: Parent span ID for chained conversations
promptSlug:
type: string
nullable: true
description: Slug of the prompt that was run (null for runLocal spans)
promptVersion:
type: integer
nullable: true
description: Version of the prompt used
model:
type: string
description: Model used (e.g., `gpt-4o`)
provider:
type: string
description: Provider name (e.g., `openai`, `amazon_bedrock`)
input:
type: object
properties:
messages:
type: array
items:
type: object
properties:
role:
type: string
content:
type: string
variables:
type: object
nullable: true
additionalProperties:
type: string
description: Template variables used in the prompt
output:
type: string
nullable: true
description: Model response text
status:
type: string
enum: [SUCCESS, ERROR]
error:
type: string
nullable: true
description: Error message if status is ERROR
latencyMs:
type: integer
description: Execution time in milliseconds
inputTokens:
type: integer
outputTokens:
type: integer
totalTokens:
type: integer
cost:
type: number
nullable: true
description: Cost in USD
tags:
type: array
items:
type: string
userId:
type: string
nullable: true
sessionId:
type: string
nullable: true
createdAt:
type: string
format: date-time
SpanSummary:
type: object
properties:
id:
type: string
spanId:
type: string
traceId:
type: string
nullable: true
promptSlug:
type: string
nullable: true
model:
type: string
status:
type: string
enum: [SUCCESS, ERROR]
latencyMs:
type: integer
inputTokens:
type: integer
outputTokens:
type: integer
totalTokens:
type: integer
cost:
type: number
nullable: true
createdAt:
type: string
format: date-time
Error:
type: object
properties:
error:
type: object
properties:
code:
type: string
description: Error code
message:
type: string
description: Error message
Evaluation:
type: object
properties:
id:
type: string
description: Unique identifier for the evaluation
evaluatorKey:
type: string
description: Key of the evaluator used
evaluatorName:
type: string
description: Display name of the evaluator
value:
type: number
description: The evaluation score
source:
type: string
description: Source of the evaluation (e.g., `api`, `dashboard`)
note:
type: string
nullable: true
description: Optional note explaining the evaluation
createdAt:
type: string
format: date-time
description: ISO 8601 timestamp of creation
paths:
/prompts:
get:
operationId: listPrompts
summary: List Prompts
description: Get all prompts for the authenticated user
tags:
- Prompts
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
prompts:
type: array
items:
$ref: '#/components/schemas/PromptSummary'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
operationId: createPrompt
summary: Create Prompt
description: Create a new prompt
tags:
- Prompts
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- content
properties:
name:
type: string
description: Display name for the prompt
slug:
type: string
description: URL-friendly identifier. Auto-generated from name if not provided.
description:
type: string
description: Description of the prompt
content:
type: array
items:
$ref: '#/components/schemas/Message'
description: Array of prompt messages
responses:
'201':
description: Prompt created
content:
application/json:
schema:
$ref: '#/components/schemas/Prompt'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Conflict - slug already exists
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/prompts/{slug}:
get:
operationId: getPrompt
summary: Get Prompt
description: Get a single prompt with its content
tags:
- Prompts
parameters:
- name: slug
in: path
required: true
schema:
type: string
description: The prompt slug
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Prompt'
'404':
description: Prompt not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
operationId: updatePrompt
summary: Update Prompt
description: Update an existing prompt. If the content changes, a new version is automatically created.
tags:
- Prompts
parameters:
- name: slug
in: path
required: true
schema:
type: string
description: The prompt slug to update
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: New display name
slug:
type: string
description: New URL-friendly identifier
description:
type: string
description: New description (set to empty string to clear)
content:
type: array
items:
$ref: '#/components/schemas/Message'
description: New array of prompt messages
responses:
'200':
description: Prompt updated
content:
application/json:
schema:
$ref: '#/components/schemas/Prompt'
'404':
description: Prompt not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Conflict - new slug already exists
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
operationId: deletePrompt
summary: Delete Prompt
description: Delete a prompt and all its versions
tags:
- Prompts
parameters:
- name: slug
in: path
required: true
schema:
type: string
description: The prompt slug to delete
responses:
'200':
description: Prompt deleted
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
'404':
description: Prompt not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/prompts/{slug}/run:
post:
operationId: runPrompt
summary: Run Prompt
description: Execute a prompt and get the LLM response
tags:
- Prompts
parameters:
- name: slug
in: path
required: true
schema:
type: string
description: The prompt slug to run
requestBody:
content:
application/json:
schema:
type: object
properties:
variables:
type: object
additionalProperties:
type: string
description: Key-value pairs for template variables
model:
type: string
description: Override the default model (e.g., `gpt-4o`, `claude-sonnet-4-20250514`)
version:
type: integer
description: Run a specific prompt version (uses latest if omitted)
tags:
type: array
items:
type: string
description: Tags for filtering spans in the dashboard
userId:
type: string
description: End user identifier for tracking
sessionId:
type: string
description: Session identifier for grouping related spans
traceId:
type: string
description: Group related spans together (session ID for multi-turn conversations)
parentSpanId:
type: string
description: Link to parent span (creates a chain)
messages:
type: array
description: Full conversation messages for multi-turn (skips template rendering when provided)
items:
type: object
required:
- role
- content
properties:
role:
type: string
enum: [system, developer, user, assistant, tool]
content:
type: string
tool_call_id:
type: string
description: Required when role is tool - the ID of the tool call being responded to
tool_name:
type: string
description: Required when role is tool - the name of the tool that was called
tool_calls:
type: array
description: Tool calls in assistant messages
items:
type: object
properties:
id:
type: string
type:
type: string
enum: [function]
function:
type: object
properties:
name:
type: string
arguments:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
text:
type: string
description: The generated text from the LLM
spanId:
type: string
description: Unique identifier for this span
traceId:
type: string
description: Session identifier (same as spanId if not part of session)
promptVersion:
type: integer
description: Version of the prompt that was used
latencyMs:
type: integer
description: Total request latency in milliseconds
usage:
type: object
properties:
inputTokens:
type: integer
outputTokens:
type: integer
totalTokens:
type: integer
cost:
type: number
description: Estimated cost in USD
finishReason:
type: string
enum: [stop, max_tokens, tool_calls]
nullable: true
description: Why the model stopped generating
toolCalls:
type: array
nullable: true
description: Tool calls made by the model
items:
type: object
properties:
id:
type: string
name:
type: string
arguments:
type: object
structuredOutput:
type: object
nullable: true
description: Parsed JSON when the prompt has an output schema configured
messages:
type: array
description: Full conversation messages for multi-turn continuation (input messages + assistant response)
items:
type: object
properties:
role:
type: string
enum: [system, developer, user, assistant, tool]
content:
type: string
tool_call_id:
type: string
tool_name:
type: string
tool_calls:
type: array
items:
type: object
properties:
id:
type: string
type:
type: string
function:
type: object
properties:
name:
type: string
arguments:
type: string
'400':
description: Bad request (missing variables or provider key)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Prompt not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Provider error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/spans:
get:
operationId: listSpans
summary: List Spans
description: Get spans with optional filters and pagination
tags:
- Spans
parameters:
- name: promptSlug
in: query
schema:
type: string
description: Filter by prompt slug
- name: status
in: query
schema:
type: string
enum: [SUCCESS, ERROR]
description: Filter by status
- name: startDate
in: query
schema:
type: string
format: date-time
description: Filter spans created after this ISO 8601 date
- name: endDate
in: query
schema:
type: string
format: date-time
description: Filter spans created before this ISO 8601 date
- name: userId
in: query
schema:
type: string
description: Filter by end user ID
- name: sessionId
in: query
schema:
type: string
description: Filter by session ID
- name: tags
in: query
schema:
type: string
description: Comma-separated list of tags (AND logic)
- name: limit
in: query
schema:
type: integer
default: 50
maximum: 100
description: Number of results per page (max 100, default 50)
- name: cursor
in: query
schema:
type: string
description: Cursor for pagination (from previous response)
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
spans:
type: array
items:
$ref: '#/components/schemas/SpanSummary'
nextCursor:
type: string
nullable: true
description: Cursor for the next page of results
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/spans/{spanId}:
get:
operationId: getSpan
summary: Get Span
description: Get full details of a single span
tags:
- Spans
parameters:
- name: spanId
in: path
required: true
schema:
type: string
description: The span ID (e.g., `sp_abc123def456`)
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Span'
'404':
description: Span not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/spans/{spanId}/evaluations:
post:
operationId: evaluateSpan
summary: Evaluate Span
description: Submit an evaluation for a span. Evaluations allow you to score spans using custom evaluators.
tags:
- Spans
parameters:
- name: spanId
in: path
required: true
schema:
type: string
description: The span ID to evaluate (e.g., `sp_abc123def456`)
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- evaluatorKey
- value
properties:
evaluatorKey:
type: string
description: The evaluator key. Currently only `quality` is supported.
value:
type: number
description: The evaluation score. Use `1` for positive or `0` for negative.
note:
type: string
description: Optional note explaining the evaluation
responses:
'201':
description: Evaluation created
content:
application/json:
schema:
$ref: '#/components/schemas/Evaluation'
'400':
description: Invalid request (e.g., value is not a number)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Span not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'