coaiajs 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1201 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Langfuse Ceremony Observations
4
+ version: 0.4.0
5
+ description: >-
6
+ Focused Langfuse v4 action surface for a Custom GPT. It can create a trace,
7
+ append nested observations to an existing trace through OTLP/HTTP JSON,
8
+ inspect observations, and perform the ceremony's core prompt, dataset,
9
+ score, comment, and project operations. A trace is created by exporting a
10
+ root observation; append a child by reusing the 32-character traceId,
11
+ generating a fresh 16-character spanId, and setting parentSpanId to the
12
+ parent observation's ID. Spans are immutable.
13
+ license:
14
+ name: MIT
15
+ identifier: MIT
16
+ x-documentation:
17
+ langfuseOtel: https://langfuse.com/integrations/native/opentelemetry
18
+ langfuseDataModel: https://langfuse.com/docs/observability/data-model
19
+ otlpJson: https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding
20
+ gptActions: https://developers.openai.com/api/docs/actions/introduction
21
+ servers:
22
+ - url: https://cloud.langfuse.com
23
+ description: Langfuse Cloud EU. Replace this URL before import for another region or a self-hosted deployment.
24
+ security:
25
+ - LangfuseAuthorization: []
26
+ tags:
27
+ - name: Observations
28
+ description: Create and inspect Langfuse v4 observations and traces.
29
+ - name: Projects
30
+ description: Discover Langfuse project IDs.
31
+ - name: Prompts
32
+ description: Read and version managed prompts.
33
+ - name: Datasets
34
+ description: Manage ceremony datasets and their items.
35
+ - name: Scores
36
+ description: Apply and inspect evaluations and score configurations.
37
+ - name: Comments
38
+ description: Attach and inspect comments on Langfuse objects.
39
+ paths:
40
+ /api/public/otel/v1/traces:
41
+ post:
42
+ operationId: observations_export
43
+ summary: Create a trace or append observations
44
+ description: |-
45
+ Export one or more complete, immutable OTLP spans to Langfuse.
46
+
47
+ To create a trace, export a root span with a new 32-hex traceId, a new
48
+ 16-hex spanId, and no parentSpanId. The root span is the trace's root
49
+ observation.
50
+
51
+ To append an observation, reuse the traceId, generate a new spanId,
52
+ and set parentSpanId to the 16-hex ID of its parent observation. Use
53
+ the same traceId on every span in a trace. Never reuse a spanId.
54
+
55
+ Include trace attributes such as langfuse.trace.name,
56
+ langfuse.user.id, langfuse.session.id, and langfuse.trace.tags on every
57
+ appended span because Langfuse v4 stores trace context on observations.
58
+ Serialize observation input/output JSON into stringValue. Use current
59
+ Unix epoch nanoseconds encoded as decimal strings; endTimeUnixNano must
60
+ be greater than or equal to startTimeUnixNano.
61
+ tags: [Observations]
62
+ parameters:
63
+ - name: x-langfuse-ingestion-version
64
+ in: header
65
+ required: true
66
+ description: Always send the literal value 4 for real-time Langfuse v4 ingestion.
67
+ schema:
68
+ type: string
69
+ enum: ["4"]
70
+ default: "4"
71
+ requestBody:
72
+ required: true
73
+ content:
74
+ application/json:
75
+ schema:
76
+ $ref: "#/components/schemas/OtlpTraceExportRequest"
77
+ examples:
78
+ createRootAndChild:
79
+ summary: Create a trace containing a root span and one child observation
80
+ value:
81
+ resourceSpans:
82
+ - resource:
83
+ attributes:
84
+ - key: service.name
85
+ value:
86
+ stringValue: custom-gpt-ceremony
87
+ scopeSpans:
88
+ - scope:
89
+ name: custom-gpt-ceremony
90
+ version: "0.4.0"
91
+ spans:
92
+ - traceId: 4bf92f3577b34da6a3ce929d0e0e4736
93
+ spanId: 00f067aa0ba902b7
94
+ name: ceremony-trace
95
+ kind: 1
96
+ startTimeUnixNano: "1735689600000000000"
97
+ endTimeUnixNano: "1735689601000000000"
98
+ attributes:
99
+ - key: langfuse.observation.type
100
+ value:
101
+ stringValue: span
102
+ - key: langfuse.trace.name
103
+ value:
104
+ stringValue: ceremony-trace
105
+ - key: langfuse.observation.input
106
+ value:
107
+ stringValue: '{"request":"begin ceremony"}'
108
+ - key: langfuse.observation.output
109
+ value:
110
+ stringValue: '{"status":"started"}'
111
+ - key: langfuse.trace.tags
112
+ value:
113
+ arrayValue:
114
+ values:
115
+ - stringValue: ceremony
116
+ status:
117
+ code: 1
118
+ - traceId: 4bf92f3577b34da6a3ce929d0e0e4736
119
+ spanId: b7ad6b7169203331
120
+ parentSpanId: 00f067aa0ba902b7
121
+ name: invoke-model
122
+ kind: 1
123
+ startTimeUnixNano: "1735689600200000000"
124
+ endTimeUnixNano: "1735689600900000000"
125
+ attributes:
126
+ - key: langfuse.observation.type
127
+ value:
128
+ stringValue: generation
129
+ - key: langfuse.trace.name
130
+ value:
131
+ stringValue: ceremony-trace
132
+ - key: langfuse.observation.model.name
133
+ value:
134
+ stringValue: gpt-4.1
135
+ - key: langfuse.observation.input
136
+ value:
137
+ stringValue: '{"prompt":"Reflect"}'
138
+ - key: langfuse.observation.output
139
+ value:
140
+ stringValue: '{"answer":"Reflection complete"}'
141
+ status:
142
+ code: 1
143
+ appendChild:
144
+ summary: Append one child observation to an existing trace
145
+ value:
146
+ resourceSpans:
147
+ - resource:
148
+ attributes:
149
+ - key: service.name
150
+ value:
151
+ stringValue: custom-gpt-ceremony
152
+ scopeSpans:
153
+ - scope:
154
+ name: custom-gpt-ceremony
155
+ version: "0.4.0"
156
+ spans:
157
+ - traceId: 4bf92f3577b34da6a3ce929d0e0e4736
158
+ spanId: 3c16a3e45742d4c7
159
+ parentSpanId: 00f067aa0ba902b7
160
+ name: ceremony-step
161
+ kind: 1
162
+ startTimeUnixNano: "1735689602000000000"
163
+ endTimeUnixNano: "1735689602500000000"
164
+ attributes:
165
+ - key: langfuse.observation.type
166
+ value:
167
+ stringValue: span
168
+ - key: langfuse.trace.name
169
+ value:
170
+ stringValue: ceremony-trace
171
+ - key: langfuse.observation.input
172
+ value:
173
+ stringValue: '{"step":"continue"}'
174
+ - key: langfuse.observation.output
175
+ value:
176
+ stringValue: '{"status":"complete"}'
177
+ status:
178
+ code: 1
179
+ responses:
180
+ "200":
181
+ description: OTLP export accepted. The response is normally an empty JSON object.
182
+ content:
183
+ application/json:
184
+ schema:
185
+ $ref: "#/components/schemas/OtlpTraceExportResponse"
186
+ "400":
187
+ $ref: "#/components/responses/ApiError"
188
+ "401":
189
+ $ref: "#/components/responses/ApiError"
190
+ default:
191
+ $ref: "#/components/responses/ApiError"
192
+ x-openai-isConsequential: true
193
+
194
+ /api/public/v2/observations:
195
+ get:
196
+ operationId: observations_list
197
+ summary: List observations or inspect a trace
198
+ description: >-
199
+ Query observations with cursor pagination. To inspect a trace after an
200
+ export, pass its traceId and request fields
201
+ core,basic,time,io,metadata,model,usage,trace_context. The returned id
202
+ is the observation/span ID and parentObservationId is its physical
203
+ parent. Input and output are raw JSON strings and may need parsing.
204
+ tags: [Observations]
205
+ parameters:
206
+ - $ref: "#/components/parameters/ObservationFields"
207
+ - $ref: "#/components/parameters/Cursor"
208
+ - $ref: "#/components/parameters/ObservationLimit"
209
+ - name: traceId
210
+ in: query
211
+ schema: { type: string }
212
+ description: Exact 32-hex trace ID.
213
+ - name: parentObservationId
214
+ in: query
215
+ schema: { type: string }
216
+ description: Return direct children of this 16-hex observation ID.
217
+ - name: isRootObservation
218
+ in: query
219
+ schema: { type: boolean }
220
+ description: Set true to return logical root observations only.
221
+ - name: name
222
+ in: query
223
+ schema: { type: string }
224
+ - name: userId
225
+ in: query
226
+ schema: { type: string }
227
+ - name: sessionId
228
+ in: query
229
+ schema: { type: string }
230
+ - name: type
231
+ in: query
232
+ schema:
233
+ type: string
234
+ enum: [SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING, GUARDRAIL]
235
+ - name: level
236
+ in: query
237
+ schema:
238
+ type: string
239
+ enum: [DEBUG, DEFAULT, WARNING, ERROR]
240
+ - name: fromStartTime
241
+ in: query
242
+ schema: { type: string, format: date-time }
243
+ - name: toStartTime
244
+ in: query
245
+ schema: { type: string, format: date-time }
246
+ responses:
247
+ "200":
248
+ description: Observations and an optional next-page cursor.
249
+ content:
250
+ application/json:
251
+ schema:
252
+ $ref: "#/components/schemas/ObservationListResponse"
253
+ "400":
254
+ $ref: "#/components/responses/ApiError"
255
+ "401":
256
+ $ref: "#/components/responses/ApiError"
257
+ default:
258
+ $ref: "#/components/responses/ApiError"
259
+ x-openai-isConsequential: false
260
+
261
+ /api/public/projects:
262
+ get:
263
+ operationId: projects_list
264
+ summary: List projects
265
+ description: List projects accessible to the configured Langfuse API credentials. Use project IDs when creating comments.
266
+ tags: [Projects]
267
+ responses:
268
+ "200":
269
+ description: Project list.
270
+ content:
271
+ application/json:
272
+ schema:
273
+ $ref: "#/components/schemas/ProjectListResponse"
274
+ "400":
275
+ $ref: "#/components/responses/ApiError"
276
+ "401":
277
+ $ref: "#/components/responses/ApiError"
278
+ default:
279
+ $ref: "#/components/responses/ApiError"
280
+ x-openai-isConsequential: false
281
+
282
+ /api/public/v2/prompts:
283
+ get:
284
+ operationId: prompts_list
285
+ summary: List managed prompts
286
+ tags: [Prompts]
287
+ parameters:
288
+ - name: name
289
+ in: query
290
+ schema: { type: string }
291
+ - name: label
292
+ in: query
293
+ schema: { type: string }
294
+ - name: tag
295
+ in: query
296
+ schema: { type: string }
297
+ - $ref: "#/components/parameters/Page"
298
+ - $ref: "#/components/parameters/PageLimit"
299
+ responses:
300
+ "200":
301
+ description: Prompt summaries.
302
+ content:
303
+ application/json:
304
+ schema:
305
+ $ref: "#/components/schemas/PaginatedResponse"
306
+ "400":
307
+ $ref: "#/components/responses/ApiError"
308
+ "401":
309
+ $ref: "#/components/responses/ApiError"
310
+ default:
311
+ $ref: "#/components/responses/ApiError"
312
+ x-openai-isConsequential: false
313
+ post:
314
+ operationId: prompts_create
315
+ summary: Create a managed prompt version
316
+ description: Create a text or chat prompt. Reusing a prompt name creates another version.
317
+ tags: [Prompts]
318
+ requestBody:
319
+ required: true
320
+ content:
321
+ application/json:
322
+ schema:
323
+ $ref: "#/components/schemas/CreatePromptRequest"
324
+ responses:
325
+ "200":
326
+ description: Created prompt version.
327
+ content:
328
+ application/json:
329
+ schema: { $ref: "#/components/schemas/GenericObject" }
330
+ "400":
331
+ $ref: "#/components/responses/ApiError"
332
+ "401":
333
+ $ref: "#/components/responses/ApiError"
334
+ default:
335
+ $ref: "#/components/responses/ApiError"
336
+ x-openai-isConsequential: true
337
+
338
+ /api/public/v2/prompts/{promptName}:
339
+ get:
340
+ operationId: prompts_get
341
+ summary: Get a managed prompt
342
+ tags: [Prompts]
343
+ parameters:
344
+ - name: promptName
345
+ in: path
346
+ required: true
347
+ schema: { type: string }
348
+ description: Prompt name, including folder prefixes when present.
349
+ - name: version
350
+ in: query
351
+ schema: { type: integer }
352
+ description: Exact version. Do not combine with label.
353
+ - name: label
354
+ in: query
355
+ schema: { type: string }
356
+ description: Label selector. Do not combine with version. Defaults to production.
357
+ - name: resolve
358
+ in: query
359
+ schema: { type: boolean, default: true }
360
+ responses:
361
+ "200":
362
+ description: Selected prompt.
363
+ content:
364
+ application/json:
365
+ schema: { $ref: "#/components/schemas/GenericObject" }
366
+ "400":
367
+ $ref: "#/components/responses/ApiError"
368
+ "401":
369
+ $ref: "#/components/responses/ApiError"
370
+ default:
371
+ $ref: "#/components/responses/ApiError"
372
+ x-openai-isConsequential: false
373
+
374
+ /api/public/v2/prompts/{name}/versions/{version}:
375
+ patch:
376
+ operationId: prompt_versions_setLabels
377
+ summary: Replace labels on a prompt version
378
+ tags: [Prompts]
379
+ parameters:
380
+ - name: name
381
+ in: path
382
+ required: true
383
+ schema: { type: string }
384
+ - name: version
385
+ in: path
386
+ required: true
387
+ schema: { type: integer }
388
+ requestBody:
389
+ required: true
390
+ content:
391
+ application/json:
392
+ schema:
393
+ type: object
394
+ additionalProperties: false
395
+ properties:
396
+ newLabels:
397
+ type: array
398
+ items: { type: string }
399
+ description: Complete replacement label set. The latest label is reserved.
400
+ required: [newLabels]
401
+ responses:
402
+ "200":
403
+ description: Updated prompt version.
404
+ content:
405
+ application/json:
406
+ schema: { $ref: "#/components/schemas/GenericObject" }
407
+ "400":
408
+ $ref: "#/components/responses/ApiError"
409
+ "401":
410
+ $ref: "#/components/responses/ApiError"
411
+ default:
412
+ $ref: "#/components/responses/ApiError"
413
+ x-openai-isConsequential: true
414
+
415
+ /api/public/v2/datasets:
416
+ get:
417
+ operationId: datasets_list
418
+ summary: List datasets
419
+ tags: [Datasets]
420
+ parameters:
421
+ - $ref: "#/components/parameters/Page"
422
+ - $ref: "#/components/parameters/PageLimit"
423
+ responses:
424
+ "200":
425
+ description: Paginated datasets.
426
+ content:
427
+ application/json:
428
+ schema: { $ref: "#/components/schemas/PaginatedResponse" }
429
+ "400":
430
+ $ref: "#/components/responses/ApiError"
431
+ "401":
432
+ $ref: "#/components/responses/ApiError"
433
+ default:
434
+ $ref: "#/components/responses/ApiError"
435
+ x-openai-isConsequential: false
436
+ post:
437
+ operationId: datasets_create
438
+ summary: Create a dataset
439
+ tags: [Datasets]
440
+ requestBody:
441
+ required: true
442
+ content:
443
+ application/json:
444
+ schema:
445
+ $ref: "#/components/schemas/CreateDatasetRequest"
446
+ responses:
447
+ "200":
448
+ description: Created dataset.
449
+ content:
450
+ application/json:
451
+ schema: { $ref: "#/components/schemas/GenericObject" }
452
+ "400":
453
+ $ref: "#/components/responses/ApiError"
454
+ "401":
455
+ $ref: "#/components/responses/ApiError"
456
+ default:
457
+ $ref: "#/components/responses/ApiError"
458
+ x-openai-isConsequential: true
459
+
460
+ /api/public/v2/datasets/{datasetName}:
461
+ get:
462
+ operationId: datasets_get
463
+ summary: Get a dataset
464
+ tags: [Datasets]
465
+ parameters:
466
+ - name: datasetName
467
+ in: path
468
+ required: true
469
+ schema: { type: string }
470
+ responses:
471
+ "200":
472
+ description: Dataset details.
473
+ content:
474
+ application/json:
475
+ schema: { $ref: "#/components/schemas/GenericObject" }
476
+ "400":
477
+ $ref: "#/components/responses/ApiError"
478
+ "401":
479
+ $ref: "#/components/responses/ApiError"
480
+ default:
481
+ $ref: "#/components/responses/ApiError"
482
+ x-openai-isConsequential: false
483
+
484
+ /api/public/dataset-items:
485
+ get:
486
+ operationId: dataset_items_list
487
+ summary: List dataset items
488
+ tags: [Datasets]
489
+ parameters:
490
+ - name: datasetName
491
+ in: query
492
+ schema: { type: string }
493
+ - name: sourceTraceId
494
+ in: query
495
+ schema: { type: string }
496
+ - name: sourceObservationId
497
+ in: query
498
+ schema: { type: string }
499
+ - $ref: "#/components/parameters/Page"
500
+ - $ref: "#/components/parameters/PageLimit"
501
+ responses:
502
+ "200":
503
+ description: Paginated dataset items.
504
+ content:
505
+ application/json:
506
+ schema: { $ref: "#/components/schemas/PaginatedResponse" }
507
+ "400":
508
+ $ref: "#/components/responses/ApiError"
509
+ "401":
510
+ $ref: "#/components/responses/ApiError"
511
+ default:
512
+ $ref: "#/components/responses/ApiError"
513
+ x-openai-isConsequential: false
514
+ post:
515
+ operationId: dataset_items_upsert
516
+ summary: Create or upsert a dataset item
517
+ tags: [Datasets]
518
+ requestBody:
519
+ required: true
520
+ content:
521
+ application/json:
522
+ schema:
523
+ $ref: "#/components/schemas/CreateDatasetItemRequest"
524
+ responses:
525
+ "200":
526
+ description: Created or updated dataset item.
527
+ content:
528
+ application/json:
529
+ schema: { $ref: "#/components/schemas/GenericObject" }
530
+ "400":
531
+ $ref: "#/components/responses/ApiError"
532
+ "401":
533
+ $ref: "#/components/responses/ApiError"
534
+ default:
535
+ $ref: "#/components/responses/ApiError"
536
+ x-openai-isConsequential: true
537
+
538
+ /api/public/dataset-items/{id}:
539
+ get:
540
+ operationId: dataset_items_get
541
+ summary: Get a dataset item
542
+ tags: [Datasets]
543
+ parameters:
544
+ - name: id
545
+ in: path
546
+ required: true
547
+ schema: { type: string }
548
+ responses:
549
+ "200":
550
+ description: Dataset item.
551
+ content:
552
+ application/json:
553
+ schema: { $ref: "#/components/schemas/GenericObject" }
554
+ "400":
555
+ $ref: "#/components/responses/ApiError"
556
+ "401":
557
+ $ref: "#/components/responses/ApiError"
558
+ default:
559
+ $ref: "#/components/responses/ApiError"
560
+ x-openai-isConsequential: false
561
+
562
+ /api/public/scores:
563
+ post:
564
+ operationId: scores_create
565
+ summary: Apply a score
566
+ description: Apply a numeric, boolean, categorical, text, or correction score to a trace, observation, session, or dataset run.
567
+ tags: [Scores]
568
+ requestBody:
569
+ required: true
570
+ content:
571
+ application/json:
572
+ schema:
573
+ $ref: "#/components/schemas/CreateScoreRequest"
574
+ responses:
575
+ "200":
576
+ description: Created score.
577
+ content:
578
+ application/json:
579
+ schema: { $ref: "#/components/schemas/GenericObject" }
580
+ "400":
581
+ $ref: "#/components/responses/ApiError"
582
+ "401":
583
+ $ref: "#/components/responses/ApiError"
584
+ default:
585
+ $ref: "#/components/responses/ApiError"
586
+ x-openai-isConsequential: true
587
+
588
+ /api/public/v3/scores:
589
+ get:
590
+ operationId: scores_list
591
+ summary: List scores using Scores API v3
592
+ tags: [Scores]
593
+ parameters:
594
+ - $ref: "#/components/parameters/Cursor"
595
+ - name: limit
596
+ in: query
597
+ schema: { type: integer, minimum: 1, maximum: 100, default: 50 }
598
+ - name: fields
599
+ in: query
600
+ schema: { type: string, default: "details,subject" }
601
+ description: Comma-separated optional groups; use details,subject for ceremony work.
602
+ - name: id
603
+ in: query
604
+ schema: { type: string }
605
+ - name: name
606
+ in: query
607
+ schema: { type: string }
608
+ - name: source
609
+ in: query
610
+ schema: { type: string }
611
+ - name: dataType
612
+ in: query
613
+ schema: { type: string }
614
+ - name: configId
615
+ in: query
616
+ schema: { type: string }
617
+ - name: traceId
618
+ in: query
619
+ schema: { type: string }
620
+ - name: observationId
621
+ in: query
622
+ schema: { type: string }
623
+ description: Requires traceId.
624
+ - name: sessionId
625
+ in: query
626
+ schema: { type: string }
627
+ - name: experimentId
628
+ in: query
629
+ schema: { type: string }
630
+ - name: fromTimestamp
631
+ in: query
632
+ schema: { type: string, format: date-time }
633
+ - name: toTimestamp
634
+ in: query
635
+ schema: { type: string, format: date-time }
636
+ responses:
637
+ "200":
638
+ description: Cursor-paginated polymorphic scores.
639
+ content:
640
+ application/json:
641
+ schema: { $ref: "#/components/schemas/CursorPaginatedResponse" }
642
+ "400":
643
+ $ref: "#/components/responses/ApiError"
644
+ "401":
645
+ $ref: "#/components/responses/ApiError"
646
+ default:
647
+ $ref: "#/components/responses/ApiError"
648
+ x-openai-isConsequential: false
649
+
650
+ /api/public/score-configs:
651
+ get:
652
+ operationId: score_configs_list
653
+ summary: List score configurations
654
+ tags: [Scores]
655
+ parameters:
656
+ - $ref: "#/components/parameters/Page"
657
+ - $ref: "#/components/parameters/PageLimit"
658
+ responses:
659
+ "200":
660
+ description: Score configurations.
661
+ content:
662
+ application/json:
663
+ schema: { $ref: "#/components/schemas/PaginatedResponse" }
664
+ "400":
665
+ $ref: "#/components/responses/ApiError"
666
+ "401":
667
+ $ref: "#/components/responses/ApiError"
668
+ default:
669
+ $ref: "#/components/responses/ApiError"
670
+ x-openai-isConsequential: false
671
+ post:
672
+ operationId: score_configs_create
673
+ summary: Create a score configuration
674
+ tags: [Scores]
675
+ requestBody:
676
+ required: true
677
+ content:
678
+ application/json:
679
+ schema: { $ref: "#/components/schemas/CreateScoreConfigRequest" }
680
+ responses:
681
+ "200":
682
+ description: Created score configuration.
683
+ content:
684
+ application/json:
685
+ schema: { $ref: "#/components/schemas/GenericObject" }
686
+ "400":
687
+ $ref: "#/components/responses/ApiError"
688
+ "401":
689
+ $ref: "#/components/responses/ApiError"
690
+ default:
691
+ $ref: "#/components/responses/ApiError"
692
+ x-openai-isConsequential: true
693
+
694
+ /api/public/score-configs/{configId}:
695
+ get:
696
+ operationId: score_configs_get
697
+ summary: Get a score configuration
698
+ tags: [Scores]
699
+ parameters:
700
+ - name: configId
701
+ in: path
702
+ required: true
703
+ schema: { type: string }
704
+ responses:
705
+ "200":
706
+ description: Score configuration.
707
+ content:
708
+ application/json:
709
+ schema: { $ref: "#/components/schemas/GenericObject" }
710
+ "400":
711
+ $ref: "#/components/responses/ApiError"
712
+ "401":
713
+ $ref: "#/components/responses/ApiError"
714
+ default:
715
+ $ref: "#/components/responses/ApiError"
716
+ x-openai-isConsequential: false
717
+
718
+ /api/public/comments:
719
+ get:
720
+ operationId: comments_list
721
+ summary: List comments
722
+ tags: [Comments]
723
+ parameters:
724
+ - $ref: "#/components/parameters/Page"
725
+ - $ref: "#/components/parameters/PageLimit"
726
+ - name: objectType
727
+ in: query
728
+ schema:
729
+ type: string
730
+ enum: [TRACE, OBSERVATION, SESSION, PROMPT]
731
+ - name: objectId
732
+ in: query
733
+ schema: { type: string }
734
+ description: objectType is required whenever objectId is used.
735
+ - name: authorUserId
736
+ in: query
737
+ schema: { type: string }
738
+ responses:
739
+ "200":
740
+ description: Comments.
741
+ content:
742
+ application/json:
743
+ schema: { $ref: "#/components/schemas/PaginatedResponse" }
744
+ "400":
745
+ $ref: "#/components/responses/ApiError"
746
+ "401":
747
+ $ref: "#/components/responses/ApiError"
748
+ default:
749
+ $ref: "#/components/responses/ApiError"
750
+ x-openai-isConsequential: false
751
+ post:
752
+ operationId: comments_create
753
+ summary: Create a comment
754
+ tags: [Comments]
755
+ requestBody:
756
+ required: true
757
+ content:
758
+ application/json:
759
+ schema: { $ref: "#/components/schemas/CreateCommentRequest" }
760
+ responses:
761
+ "200":
762
+ description: Created comment.
763
+ content:
764
+ application/json:
765
+ schema: { $ref: "#/components/schemas/GenericObject" }
766
+ "400":
767
+ $ref: "#/components/responses/ApiError"
768
+ "401":
769
+ $ref: "#/components/responses/ApiError"
770
+ default:
771
+ $ref: "#/components/responses/ApiError"
772
+ x-openai-isConsequential: true
773
+
774
+ components:
775
+ securitySchemes:
776
+ LangfuseAuthorization:
777
+ type: apiKey
778
+ in: header
779
+ name: Authorization
780
+ description: >-
781
+ In the GPT Action authentication UI choose API Key with a custom
782
+ Authorization header. Enter the complete value "Basic BASE64", where
783
+ BASE64 is the base64 encoding of LANGFUSE_PUBLIC_KEY:LANGFUSE_SECRET_KEY.
784
+ Do not expose either key in GPT instructions or conversation text.
785
+ parameters:
786
+ Page:
787
+ name: page
788
+ in: query
789
+ schema: { type: integer, minimum: 1, default: 1 }
790
+ PageLimit:
791
+ name: limit
792
+ in: query
793
+ schema: { type: integer, minimum: 1, maximum: 100, default: 50 }
794
+ Cursor:
795
+ name: cursor
796
+ in: query
797
+ schema: { type: string }
798
+ description: Cursor returned by the preceding response.
799
+ ObservationLimit:
800
+ name: limit
801
+ in: query
802
+ schema: { type: integer, minimum: 1, maximum: 1000, default: 50 }
803
+ ObservationFields:
804
+ name: fields
805
+ in: query
806
+ schema:
807
+ type: string
808
+ default: core,basic,time,io,metadata,model,usage,trace_context
809
+ description: Comma-separated v2 observation field groups.
810
+ responses:
811
+ ApiError:
812
+ description: Langfuse rejected the request or authentication failed.
813
+ content:
814
+ application/json:
815
+ schema:
816
+ $ref: "#/components/schemas/ApiError"
817
+ schemas:
818
+ OtlpTraceExportRequest:
819
+ type: object
820
+ additionalProperties: false
821
+ properties:
822
+ resourceSpans:
823
+ type: array
824
+ minItems: 1
825
+ maxItems: 1
826
+ items:
827
+ $ref: "#/components/schemas/OtlpResourceSpans"
828
+ required: [resourceSpans]
829
+ OtlpResourceSpans:
830
+ type: object
831
+ additionalProperties: false
832
+ properties:
833
+ resource:
834
+ $ref: "#/components/schemas/OtlpResource"
835
+ scopeSpans:
836
+ type: array
837
+ minItems: 1
838
+ maxItems: 1
839
+ items:
840
+ $ref: "#/components/schemas/OtlpScopeSpans"
841
+ required: [resource, scopeSpans]
842
+ OtlpResource:
843
+ type: object
844
+ additionalProperties: false
845
+ properties:
846
+ attributes:
847
+ type: array
848
+ minItems: 1
849
+ items:
850
+ $ref: "#/components/schemas/OtlpAttribute"
851
+ required: [attributes]
852
+ OtlpScopeSpans:
853
+ type: object
854
+ additionalProperties: false
855
+ properties:
856
+ scope:
857
+ $ref: "#/components/schemas/OtlpScope"
858
+ spans:
859
+ type: array
860
+ minItems: 1
861
+ maxItems: 25
862
+ items:
863
+ $ref: "#/components/schemas/OtlpSpan"
864
+ required: [scope, spans]
865
+ OtlpScope:
866
+ type: object
867
+ additionalProperties: false
868
+ properties:
869
+ name:
870
+ type: string
871
+ default: custom-gpt-ceremony
872
+ version:
873
+ type: string
874
+ default: "0.4.0"
875
+ required: [name]
876
+ OtlpSpan:
877
+ type: object
878
+ additionalProperties: false
879
+ description: >-
880
+ One complete immutable observation. Omit parentSpanId only for the root.
881
+ For every child, traceId must match the root and parentSpanId must be an
882
+ existing observation/span ID in that trace.
883
+ properties:
884
+ traceId:
885
+ type: string
886
+ minLength: 32
887
+ maxLength: 32
888
+ pattern: "^[0-9a-fA-F]{32}$"
889
+ description: Reuse for every observation in one trace.
890
+ spanId:
891
+ type: string
892
+ minLength: 16
893
+ maxLength: 16
894
+ pattern: "^[0-9a-fA-F]{16}$"
895
+ description: Generate a fresh non-zero random ID for every new observation.
896
+ parentSpanId:
897
+ type: string
898
+ minLength: 16
899
+ maxLength: 16
900
+ pattern: "^[0-9a-fA-F]{16}$"
901
+ description: Parent observation ID. Omit for a root span.
902
+ name:
903
+ type: string
904
+ minLength: 1
905
+ kind:
906
+ type: integer
907
+ enum: [1]
908
+ default: 1
909
+ description: OTLP SPAN_KIND_INTERNAL.
910
+ startTimeUnixNano:
911
+ type: string
912
+ pattern: "^[0-9]{16,20}$"
913
+ description: Unix epoch nanoseconds represented as a decimal string.
914
+ endTimeUnixNano:
915
+ type: string
916
+ pattern: "^[0-9]{16,20}$"
917
+ description: Unix epoch nanoseconds represented as a decimal string; must not precede start time.
918
+ attributes:
919
+ type: array
920
+ minItems: 1
921
+ items:
922
+ $ref: "#/components/schemas/OtlpAttribute"
923
+ description: >-
924
+ Always include langfuse.observation.type. Include trace context on
925
+ every span. Observation input/output and model parameter/usage
926
+ objects must be JSON-serialized strings in stringValue.
927
+ status:
928
+ $ref: "#/components/schemas/OtlpStatus"
929
+ required: [traceId, spanId, name, kind, startTimeUnixNano, endTimeUnixNano, attributes]
930
+ OtlpAttribute:
931
+ type: object
932
+ additionalProperties: false
933
+ properties:
934
+ key:
935
+ type: string
936
+ description: >-
937
+ Common keys include langfuse.observation.type,
938
+ langfuse.observation.input, langfuse.observation.output,
939
+ langfuse.observation.model.name, langfuse.observation.usage_details,
940
+ langfuse.observation.metadata.KEY, langfuse.trace.name,
941
+ langfuse.user.id, langfuse.session.id, langfuse.trace.tags,
942
+ langfuse.release, langfuse.version, and langfuse.environment.
943
+ value:
944
+ $ref: "#/components/schemas/OtlpAnyValue"
945
+ required: [key, value]
946
+ OtlpAnyValue:
947
+ type: object
948
+ additionalProperties: false
949
+ minProperties: 1
950
+ maxProperties: 1
951
+ properties:
952
+ stringValue:
953
+ type: string
954
+ boolValue:
955
+ type: boolean
956
+ intValue:
957
+ oneOf:
958
+ - type: integer
959
+ - type: string
960
+ pattern: "^-?[0-9]+$"
961
+ doubleValue:
962
+ type: number
963
+ arrayValue:
964
+ type: object
965
+ additionalProperties: false
966
+ properties:
967
+ values:
968
+ type: array
969
+ items:
970
+ $ref: "#/components/schemas/OtlpPrimitiveValue"
971
+ required: [values]
972
+ OtlpPrimitiveValue:
973
+ type: object
974
+ additionalProperties: false
975
+ minProperties: 1
976
+ maxProperties: 1
977
+ properties:
978
+ stringValue: { type: string }
979
+ boolValue: { type: boolean }
980
+ intValue:
981
+ oneOf:
982
+ - type: integer
983
+ - type: string
984
+ pattern: "^-?[0-9]+$"
985
+ doubleValue: { type: number }
986
+ OtlpStatus:
987
+ type: object
988
+ additionalProperties: false
989
+ properties:
990
+ code:
991
+ type: integer
992
+ enum: [0, 1, 2]
993
+ description: 0 unset, 1 OK, 2 error.
994
+ message:
995
+ type: string
996
+ required: [code]
997
+ OtlpTraceExportResponse:
998
+ type: object
999
+ additionalProperties: true
1000
+ description: Empty on complete success; may contain partialSuccess for partial acceptance.
1001
+ ObservationListResponse:
1002
+ type: object
1003
+ properties:
1004
+ data:
1005
+ type: array
1006
+ items:
1007
+ $ref: "#/components/schemas/Observation"
1008
+ meta:
1009
+ type: object
1010
+ properties:
1011
+ cursor:
1012
+ type: [string, "null"]
1013
+ required: [data, meta]
1014
+ Observation:
1015
+ type: object
1016
+ additionalProperties: true
1017
+ properties:
1018
+ id: { type: string }
1019
+ traceId: { type: string }
1020
+ parentObservationId: { type: [string, "null"] }
1021
+ isRootObservation: { type: boolean }
1022
+ type: { type: string }
1023
+ name: { type: [string, "null"] }
1024
+ startTime: { type: string, format: date-time }
1025
+ endTime: { type: [string, "null"], format: date-time }
1026
+ traceName: { type: [string, "null"] }
1027
+ userId: { type: [string, "null"] }
1028
+ sessionId: { type: [string, "null"] }
1029
+ input: {}
1030
+ output: {}
1031
+ metadata: {}
1032
+ ProjectListResponse:
1033
+ type: object
1034
+ additionalProperties: true
1035
+ properties:
1036
+ data:
1037
+ type: array
1038
+ items:
1039
+ $ref: "#/components/schemas/GenericObject"
1040
+ PaginatedResponse:
1041
+ type: object
1042
+ additionalProperties: true
1043
+ properties:
1044
+ data:
1045
+ type: array
1046
+ items:
1047
+ $ref: "#/components/schemas/GenericObject"
1048
+ meta:
1049
+ $ref: "#/components/schemas/GenericObject"
1050
+ CursorPaginatedResponse:
1051
+ type: object
1052
+ additionalProperties: true
1053
+ properties:
1054
+ data:
1055
+ type: array
1056
+ items:
1057
+ $ref: "#/components/schemas/GenericObject"
1058
+ meta:
1059
+ type: object
1060
+ additionalProperties: true
1061
+ properties:
1062
+ cursor:
1063
+ type: [string, "null"]
1064
+ CreatePromptRequest:
1065
+ type: object
1066
+ additionalProperties: false
1067
+ properties:
1068
+ name: { type: string }
1069
+ prompt:
1070
+ oneOf:
1071
+ - type: string
1072
+ - type: array
1073
+ items:
1074
+ type: object
1075
+ additionalProperties: false
1076
+ properties:
1077
+ role: { type: string }
1078
+ content: { type: string }
1079
+ required: [role, content]
1080
+ type:
1081
+ type: string
1082
+ enum: [text, chat]
1083
+ description: Use chat when prompt is an array; text may be omitted for a string prompt.
1084
+ config:
1085
+ type: object
1086
+ additionalProperties: true
1087
+ labels:
1088
+ type: array
1089
+ items: { type: string }
1090
+ tags:
1091
+ type: array
1092
+ items: { type: string }
1093
+ commitMessage: { type: string }
1094
+ required: [name, prompt]
1095
+ CreateDatasetRequest:
1096
+ type: object
1097
+ additionalProperties: false
1098
+ properties:
1099
+ name: { type: string }
1100
+ description: { type: string }
1101
+ metadata:
1102
+ type: object
1103
+ additionalProperties: true
1104
+ inputSchema:
1105
+ type: object
1106
+ additionalProperties: true
1107
+ expectedOutputSchema:
1108
+ type: object
1109
+ additionalProperties: true
1110
+ required: [name]
1111
+ CreateDatasetItemRequest:
1112
+ type: object
1113
+ additionalProperties: false
1114
+ properties:
1115
+ datasetName: { type: string }
1116
+ input: {}
1117
+ expectedOutput: {}
1118
+ metadata:
1119
+ type: object
1120
+ additionalProperties: true
1121
+ sourceTraceId: { type: string }
1122
+ sourceObservationId: { type: string }
1123
+ id:
1124
+ type: string
1125
+ maxLength: 255
1126
+ description: Stable project-unique ID. Providing it makes this an upsert.
1127
+ status:
1128
+ type: string
1129
+ enum: [ACTIVE, ARCHIVED]
1130
+ required: [datasetName]
1131
+ CreateScoreRequest:
1132
+ type: object
1133
+ additionalProperties: false
1134
+ properties:
1135
+ id: { type: string }
1136
+ traceId: { type: string }
1137
+ observationId:
1138
+ type: string
1139
+ description: Observation ID; include its traceId as well.
1140
+ sessionId: { type: string }
1141
+ datasetRunId: { type: string }
1142
+ name: { type: string }
1143
+ value:
1144
+ oneOf:
1145
+ - type: number
1146
+ - type: string
1147
+ description: Number for numeric/boolean scores; string for categorical/text/correction scores.
1148
+ comment: { type: string }
1149
+ metadata:
1150
+ type: object
1151
+ additionalProperties: true
1152
+ environment: { type: string }
1153
+ dataType:
1154
+ type: string
1155
+ enum: [NUMERIC, BOOLEAN, CATEGORICAL, TEXT, CORRECTION]
1156
+ configId: { type: string }
1157
+ source:
1158
+ type: string
1159
+ enum: [API, ANNOTATION]
1160
+ required: [name, value]
1161
+ CreateScoreConfigRequest:
1162
+ type: object
1163
+ additionalProperties: false
1164
+ properties:
1165
+ name: { type: string, maxLength: 35 }
1166
+ dataType:
1167
+ type: string
1168
+ enum: [NUMERIC, BOOLEAN, CATEGORICAL, TEXT]
1169
+ categories:
1170
+ type: array
1171
+ items:
1172
+ type: object
1173
+ additionalProperties: false
1174
+ properties:
1175
+ label: { type: string }
1176
+ value: { type: number }
1177
+ required: [label, value]
1178
+ minValue: { type: number }
1179
+ maxValue: { type: number }
1180
+ description: { type: string }
1181
+ required: [name, dataType]
1182
+ CreateCommentRequest:
1183
+ type: object
1184
+ additionalProperties: false
1185
+ properties:
1186
+ projectId: { type: string }
1187
+ objectType:
1188
+ type: string
1189
+ enum: [TRACE, OBSERVATION, SESSION, PROMPT]
1190
+ objectId: { type: string }
1191
+ content: { type: string, maxLength: 5000 }
1192
+ authorUserId: { type: string }
1193
+ required: [projectId, objectType, objectId, content]
1194
+ GenericObject:
1195
+ type: object
1196
+ additionalProperties: true
1197
+ ApiError:
1198
+ type: object
1199
+ additionalProperties: true
1200
+ properties:
1201
+ message: { type: string }