braintrust 0.3.15__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
Files changed (78) hide show
  1. braintrust/_generated_types.py +737 -672
  2. braintrust/audit.py +2 -2
  3. braintrust/cli/eval.py +6 -7
  4. braintrust/cli/push.py +11 -11
  5. braintrust/context.py +12 -17
  6. braintrust/contrib/temporal/__init__.py +16 -27
  7. braintrust/contrib/temporal/test_temporal.py +8 -3
  8. braintrust/devserver/auth.py +8 -8
  9. braintrust/devserver/cache.py +3 -4
  10. braintrust/devserver/cors.py +8 -7
  11. braintrust/devserver/dataset.py +3 -5
  12. braintrust/devserver/eval_hooks.py +7 -6
  13. braintrust/devserver/schemas.py +22 -19
  14. braintrust/devserver/server.py +19 -12
  15. braintrust/devserver/test_cached_login.py +4 -4
  16. braintrust/framework.py +128 -140
  17. braintrust/framework2.py +88 -87
  18. braintrust/functions/invoke.py +66 -59
  19. braintrust/functions/stream.py +3 -2
  20. braintrust/generated_types.py +3 -1
  21. braintrust/git_fields.py +11 -11
  22. braintrust/gitutil.py +2 -3
  23. braintrust/graph_util.py +10 -10
  24. braintrust/id_gen.py +2 -2
  25. braintrust/logger.py +346 -357
  26. braintrust/merge_row_batch.py +10 -9
  27. braintrust/oai.py +21 -20
  28. braintrust/otel/__init__.py +49 -49
  29. braintrust/otel/context.py +16 -30
  30. braintrust/otel/test_distributed_tracing.py +14 -11
  31. braintrust/otel/test_otel_bt_integration.py +32 -31
  32. braintrust/parameters.py +8 -8
  33. braintrust/prompt.py +14 -14
  34. braintrust/prompt_cache/disk_cache.py +5 -4
  35. braintrust/prompt_cache/lru_cache.py +3 -2
  36. braintrust/prompt_cache/prompt_cache.py +13 -14
  37. braintrust/queue.py +4 -4
  38. braintrust/score.py +4 -4
  39. braintrust/serializable_data_class.py +4 -4
  40. braintrust/span_identifier_v1.py +1 -2
  41. braintrust/span_identifier_v2.py +3 -4
  42. braintrust/span_identifier_v3.py +23 -20
  43. braintrust/span_identifier_v4.py +34 -25
  44. braintrust/test_framework.py +16 -6
  45. braintrust/test_helpers.py +5 -5
  46. braintrust/test_id_gen.py +2 -3
  47. braintrust/test_otel.py +61 -53
  48. braintrust/test_queue.py +0 -1
  49. braintrust/test_score.py +1 -3
  50. braintrust/test_span_components.py +29 -44
  51. braintrust/util.py +9 -8
  52. braintrust/version.py +2 -2
  53. braintrust/wrappers/_anthropic_utils.py +4 -4
  54. braintrust/wrappers/agno/__init__.py +3 -4
  55. braintrust/wrappers/agno/agent.py +1 -2
  56. braintrust/wrappers/agno/function_call.py +1 -2
  57. braintrust/wrappers/agno/model.py +1 -2
  58. braintrust/wrappers/agno/team.py +1 -2
  59. braintrust/wrappers/agno/utils.py +12 -12
  60. braintrust/wrappers/anthropic.py +7 -8
  61. braintrust/wrappers/claude_agent_sdk/__init__.py +3 -4
  62. braintrust/wrappers/claude_agent_sdk/_wrapper.py +29 -27
  63. braintrust/wrappers/dspy.py +15 -17
  64. braintrust/wrappers/google_genai/__init__.py +16 -16
  65. braintrust/wrappers/langchain.py +22 -24
  66. braintrust/wrappers/litellm.py +4 -3
  67. braintrust/wrappers/openai.py +15 -15
  68. braintrust/wrappers/pydantic_ai.py +21 -20
  69. braintrust/wrappers/test_agno.py +0 -1
  70. braintrust/wrappers/test_dspy.py +0 -1
  71. braintrust/wrappers/test_google_genai.py +2 -3
  72. braintrust/wrappers/test_litellm.py +0 -1
  73. {braintrust-0.3.15.dist-info → braintrust-0.4.0.dist-info}/METADATA +3 -2
  74. braintrust-0.4.0.dist-info/RECORD +120 -0
  75. braintrust-0.3.15.dist-info/RECORD +0 -120
  76. {braintrust-0.3.15.dist-info → braintrust-0.4.0.dist-info}/WHEEL +0 -0
  77. {braintrust-0.3.15.dist-info → braintrust-0.4.0.dist-info}/entry_points.txt +0 -0
  78. {braintrust-0.3.15.dist-info → braintrust-0.4.0.dist-info}/top_level.txt +0 -0
@@ -6,9 +6,10 @@ Auto-generated file -- do not modify.
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
- from typing import Any, Literal, Mapping, Optional, Sequence, TypedDict, Union
9
+ from collections.abc import Mapping, Sequence
10
+ from typing import Any, Literal, TypeAlias, TypedDict
10
11
 
11
- from typing_extensions import NotRequired, TypeAlias
12
+ from typing_extensions import NotRequired
12
13
 
13
14
  AclObjectType: TypeAlias = Literal[
14
15
  'organization',
@@ -33,11 +34,11 @@ class AISecret(TypedDict):
33
34
  """
34
35
  Unique identifier for the AI secret
35
36
  """
36
- created: NotRequired[Optional[str]]
37
+ created: NotRequired[str | None]
37
38
  """
38
39
  Date of AI secret creation
39
40
  """
40
- updated_at: NotRequired[Optional[str]]
41
+ updated_at: NotRequired[str | None]
41
42
  """
42
43
  Date of last AI secret update
43
44
  """
@@ -49,9 +50,9 @@ class AISecret(TypedDict):
49
50
  """
50
51
  Name of the AI secret
51
52
  """
52
- type: NotRequired[Optional[str]]
53
- metadata: NotRequired[Optional[Mapping[str, Any]]]
54
- preview_secret: NotRequired[Optional[str]]
53
+ type: NotRequired[str | None]
54
+ metadata: NotRequired[Mapping[str, Any] | None]
55
+ preview_secret: NotRequired[str | None]
55
56
 
56
57
 
57
58
  class AnyModelParamsToolChoiceFunction(TypedDict):
@@ -72,7 +73,7 @@ class ApiKey(TypedDict):
72
73
  """
73
74
  Unique identifier for the api key
74
75
  """
75
- created: NotRequired[Optional[str]]
76
+ created: NotRequired[str | None]
76
77
  """
77
78
  Date of api key creation
78
79
  """
@@ -81,23 +82,23 @@ class ApiKey(TypedDict):
81
82
  Name of the api key
82
83
  """
83
84
  preview_name: str
84
- user_id: NotRequired[Optional[str]]
85
+ user_id: NotRequired[str | None]
85
86
  """
86
87
  Unique identifier for the user
87
88
  """
88
- user_email: NotRequired[Optional[str]]
89
+ user_email: NotRequired[str | None]
89
90
  """
90
91
  The user's email
91
92
  """
92
- user_given_name: NotRequired[Optional[str]]
93
+ user_given_name: NotRequired[str | None]
93
94
  """
94
95
  Given name of the user
95
96
  """
96
- user_family_name: NotRequired[Optional[str]]
97
+ user_family_name: NotRequired[str | None]
97
98
  """
98
99
  Family name of the user
99
100
  """
100
- org_id: NotRequired[Optional[str]]
101
+ org_id: NotRequired[str | None]
101
102
  """
102
103
  Unique identifier for the organization
103
104
  """
@@ -120,14 +121,14 @@ class AsyncScoringStateAsyncScoringState(TypedDict):
120
121
  status: Literal['enabled']
121
122
  token: str
122
123
  function_ids: Sequence[Any]
123
- skip_logging: NotRequired[Optional[bool]]
124
+ skip_logging: NotRequired[bool | None]
124
125
 
125
126
 
126
127
  class AsyncScoringStateAsyncScoringState1(TypedDict):
127
128
  status: Literal['disabled']
128
129
 
129
130
 
130
- AsyncScoringState: TypeAlias = Optional[Union[AsyncScoringStateAsyncScoringState, AsyncScoringStateAsyncScoringState1]]
131
+ AsyncScoringState: TypeAlias = AsyncScoringStateAsyncScoringState | AsyncScoringStateAsyncScoringState1 | None
131
132
 
132
133
 
133
134
  class BraintrustAttachmentReference(TypedDict):
@@ -150,75 +151,75 @@ class BraintrustAttachmentReference(TypedDict):
150
151
 
151
152
 
152
153
  class BraintrustModelParams(TypedDict):
153
- use_cache: NotRequired[Optional[bool]]
154
- reasoning_enabled: NotRequired[Optional[bool]]
155
- reasoning_budget: NotRequired[Optional[float]]
154
+ use_cache: NotRequired[bool | None]
155
+ reasoning_enabled: NotRequired[bool | None]
156
+ reasoning_budget: NotRequired[float | None]
156
157
 
157
158
 
158
159
  class CallEventCallEvent(TypedDict):
159
- id: NotRequired[Optional[str]]
160
+ id: NotRequired[str | None]
160
161
  data: str
161
162
  event: Literal['text_delta']
162
163
 
163
164
 
164
165
  class CallEventCallEvent1(TypedDict):
165
- id: NotRequired[Optional[str]]
166
+ id: NotRequired[str | None]
166
167
  data: str
167
168
  event: Literal['reasoning_delta']
168
169
 
169
170
 
170
171
  class CallEventCallEvent2(TypedDict):
171
- id: NotRequired[Optional[str]]
172
+ id: NotRequired[str | None]
172
173
  data: str
173
174
  event: Literal['json_delta']
174
175
 
175
176
 
176
177
  class CallEventCallEvent3(TypedDict):
177
- id: NotRequired[Optional[str]]
178
+ id: NotRequired[str | None]
178
179
  data: str
179
180
  event: Literal['progress']
180
181
 
181
182
 
182
183
  class CallEventCallEvent4(TypedDict):
183
- id: NotRequired[Optional[str]]
184
+ id: NotRequired[str | None]
184
185
  data: str
185
186
  event: Literal['error']
186
187
 
187
188
 
188
189
  class CallEventCallEvent5(TypedDict):
189
- id: NotRequired[Optional[str]]
190
+ id: NotRequired[str | None]
190
191
  data: str
191
192
  event: Literal['console']
192
193
 
193
194
 
194
195
  class CallEventCallEvent6(TypedDict):
195
- id: NotRequired[Optional[str]]
196
+ id: NotRequired[str | None]
196
197
  event: Literal['start']
197
198
  data: Literal['']
198
199
 
199
200
 
200
201
  class CallEventCallEvent7(TypedDict):
201
- id: NotRequired[Optional[str]]
202
+ id: NotRequired[str | None]
202
203
  event: Literal['done']
203
204
  data: Literal['']
204
205
 
205
206
 
206
- CallEvent: TypeAlias = Union[
207
- CallEventCallEvent,
208
- CallEventCallEvent1,
209
- CallEventCallEvent2,
210
- CallEventCallEvent3,
211
- CallEventCallEvent4,
212
- CallEventCallEvent5,
213
- CallEventCallEvent6,
214
- CallEventCallEvent7,
215
- ]
207
+ CallEvent: TypeAlias = (
208
+ CallEventCallEvent
209
+ | CallEventCallEvent1
210
+ | CallEventCallEvent2
211
+ | CallEventCallEvent3
212
+ | CallEventCallEvent4
213
+ | CallEventCallEvent5
214
+ | CallEventCallEvent6
215
+ | CallEventCallEvent7
216
+ )
216
217
 
217
218
 
218
219
  class ChatCompletionContentPartFileFile(TypedDict):
219
- file_data: NotRequired[Optional[str]]
220
- filename: NotRequired[Optional[str]]
221
- file_id: NotRequired[Optional[str]]
220
+ file_data: NotRequired[str | None]
221
+ filename: NotRequired[str | None]
222
+ file_id: NotRequired[str | None]
222
223
 
223
224
 
224
225
  class ChatCompletionContentPartFileWithTitle(TypedDict):
@@ -228,7 +229,7 @@ class ChatCompletionContentPartFileWithTitle(TypedDict):
228
229
 
229
230
  class ChatCompletionContentPartImageWithTitleImageUrl(TypedDict):
230
231
  url: str
231
- detail: NotRequired[Optional[Union[Literal['auto'], Literal['low'], Literal['high']]]]
232
+ detail: NotRequired[Literal['auto'] | Literal['low'] | Literal['high'] | None]
232
233
 
233
234
 
234
235
  class ChatCompletionContentPartImageWithTitle(TypedDict):
@@ -243,7 +244,7 @@ class ChatCompletionContentPartTextCacheControl(TypedDict):
243
244
  class ChatCompletionContentPartText(TypedDict):
244
245
  text: str
245
246
  type: Literal['text']
246
- cache_control: NotRequired[Optional[ChatCompletionContentPartTextCacheControl]]
247
+ cache_control: NotRequired[ChatCompletionContentPartTextCacheControl | None]
247
248
 
248
249
 
249
250
  class ChatCompletionContentPartTextWithTitleCacheControl(TypedDict):
@@ -253,13 +254,13 @@ class ChatCompletionContentPartTextWithTitleCacheControl(TypedDict):
253
254
  class ChatCompletionContentPartTextWithTitle(TypedDict):
254
255
  text: str
255
256
  type: Literal['text']
256
- cache_control: NotRequired[Optional[ChatCompletionContentPartTextWithTitleCacheControl]]
257
+ cache_control: NotRequired[ChatCompletionContentPartTextWithTitleCacheControl | None]
257
258
 
258
259
 
259
260
  class ChatCompletionMessageParamChatCompletionMessageParam(TypedDict):
260
- content: Union[str, Sequence[ChatCompletionContentPartText]]
261
+ content: str | Sequence[ChatCompletionContentPartText]
261
262
  role: Literal['system']
262
- name: NotRequired[Optional[str]]
263
+ name: NotRequired[str | None]
263
264
 
264
265
 
265
266
  class ChatCompletionMessageParamChatCompletionMessageParam2FunctionCall(TypedDict):
@@ -268,31 +269,31 @@ class ChatCompletionMessageParamChatCompletionMessageParam2FunctionCall(TypedDic
268
269
 
269
270
 
270
271
  class ChatCompletionMessageParamChatCompletionMessageParam3(TypedDict):
271
- content: Union[str, Sequence[ChatCompletionContentPartText]]
272
+ content: str | Sequence[ChatCompletionContentPartText]
272
273
  role: Literal['tool']
273
274
  tool_call_id: str
274
275
 
275
276
 
276
277
  class ChatCompletionMessageParamChatCompletionMessageParam4(TypedDict):
277
- content: Optional[str]
278
+ content: str | None
278
279
  name: str
279
280
  role: Literal['function']
280
281
 
281
282
 
282
283
  class ChatCompletionMessageParamChatCompletionMessageParam5(TypedDict):
283
- content: Union[str, Sequence[ChatCompletionContentPartText]]
284
+ content: str | Sequence[ChatCompletionContentPartText]
284
285
  role: Literal['developer']
285
- name: NotRequired[Optional[str]]
286
+ name: NotRequired[str | None]
286
287
 
287
288
 
288
289
  class ChatCompletionMessageParamChatCompletionMessageParam6(TypedDict):
289
290
  role: Literal['model']
290
- content: NotRequired[Optional[str]]
291
+ content: NotRequired[str | None]
291
292
 
292
293
 
293
294
  class ChatCompletionMessageReasoning(TypedDict):
294
- id: NotRequired[Optional[str]]
295
- content: NotRequired[Optional[str]]
295
+ id: NotRequired[str | None]
296
+ content: NotRequired[str | None]
296
297
 
297
298
 
298
299
  class ChatCompletionMessageToolCallFunction(TypedDict):
@@ -307,9 +308,9 @@ class ChatCompletionMessageToolCall(TypedDict):
307
308
 
308
309
 
309
310
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam(TypedDict):
310
- content: Union[str, Sequence[ChatCompletionContentPartText]]
311
+ content: str | Sequence[ChatCompletionContentPartText]
311
312
  role: Literal['system']
312
- name: NotRequired[Optional[str]]
313
+ name: NotRequired[str | None]
313
314
 
314
315
 
315
316
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2FunctionCall(TypedDict):
@@ -319,35 +320,35 @@ class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2FunctionC
319
320
 
320
321
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2(TypedDict):
321
322
  role: Literal['assistant']
322
- content: NotRequired[Optional[Union[str, Sequence[ChatCompletionContentPartText]]]]
323
- function_call: NotRequired[Optional[ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2FunctionCall]]
324
- name: NotRequired[Optional[str]]
325
- tool_calls: NotRequired[Optional[Sequence[ChatCompletionMessageToolCall]]]
326
- reasoning: NotRequired[Optional[Sequence[ChatCompletionMessageReasoning]]]
323
+ content: NotRequired[str | Sequence[ChatCompletionContentPartText] | None]
324
+ function_call: NotRequired[ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2FunctionCall | None]
325
+ name: NotRequired[str | None]
326
+ tool_calls: NotRequired[Sequence[ChatCompletionMessageToolCall] | None]
327
+ reasoning: NotRequired[Sequence[ChatCompletionMessageReasoning] | None]
327
328
 
328
329
 
329
330
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam3(TypedDict):
330
- content: Union[str, Sequence[ChatCompletionContentPartText]]
331
+ content: str | Sequence[ChatCompletionContentPartText]
331
332
  role: Literal['tool']
332
333
  tool_call_id: str
333
334
 
334
335
 
335
336
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam4(TypedDict):
336
- content: Optional[str]
337
+ content: str | None
337
338
  name: str
338
339
  role: Literal['function']
339
340
 
340
341
 
341
342
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam5(TypedDict):
342
- content: Union[str, Sequence[ChatCompletionContentPartText]]
343
+ content: str | Sequence[ChatCompletionContentPartText]
343
344
  role: Literal['developer']
344
- name: NotRequired[Optional[str]]
345
+ name: NotRequired[str | None]
345
346
 
346
347
 
347
348
  class ChatCompletionToolFunction(TypedDict):
348
349
  name: str
349
- description: NotRequired[Optional[str]]
350
- parameters: NotRequired[Optional[Mapping[str, Any]]]
350
+ description: NotRequired[str | None]
351
+ parameters: NotRequired[Mapping[str, Any] | None]
351
352
 
352
353
 
353
354
  class ChatCompletionTool(TypedDict):
@@ -372,7 +373,7 @@ class CodeBundleLocationPosition1(TypedDict):
372
373
  class CodeBundleLocation(TypedDict):
373
374
  type: Literal['experiment']
374
375
  eval_name: str
375
- position: Union[CodeBundleLocationPosition, CodeBundleLocationPosition1]
376
+ position: CodeBundleLocationPosition | CodeBundleLocationPosition1
376
377
 
377
378
 
378
379
  class CodeBundleLocation1(TypedDict):
@@ -382,9 +383,9 @@ class CodeBundleLocation1(TypedDict):
382
383
 
383
384
  class CodeBundle(TypedDict):
384
385
  runtime_context: CodeBundleRuntimeContext
385
- location: Union[CodeBundleLocation, CodeBundleLocation1]
386
+ location: CodeBundleLocation | CodeBundleLocation1
386
387
  bundle_id: str
387
- preview: NotRequired[Optional[str]]
388
+ preview: NotRequired[str | None]
388
389
  """
389
390
  A preview of the code
390
391
  """
@@ -403,30 +404,30 @@ class Dataset(TypedDict):
403
404
  """
404
405
  Name of the dataset. Within a project, dataset names are unique
405
406
  """
406
- description: NotRequired[Optional[str]]
407
+ description: NotRequired[str | None]
407
408
  """
408
409
  Textual description of the dataset
409
410
  """
410
- created: NotRequired[Optional[str]]
411
+ created: NotRequired[str | None]
411
412
  """
412
413
  Date of dataset creation
413
414
  """
414
- deleted_at: NotRequired[Optional[str]]
415
+ deleted_at: NotRequired[str | None]
415
416
  """
416
417
  Date of dataset deletion, or null if the dataset is still active
417
418
  """
418
- user_id: NotRequired[Optional[str]]
419
+ user_id: NotRequired[str | None]
419
420
  """
420
421
  Identifies the user who created the dataset
421
422
  """
422
- metadata: NotRequired[Optional[Mapping[str, Any]]]
423
+ metadata: NotRequired[Mapping[str, Any] | None]
423
424
  """
424
425
  User-controlled metadata about the dataset
425
426
  """
426
427
 
427
428
 
428
429
  class DatasetEventMetadata(TypedDict):
429
- model: NotRequired[Optional[str]]
430
+ model: NotRequired[str | None]
430
431
  """
431
432
  The model used for this example
432
433
  """
@@ -449,80 +450,80 @@ class EnvVar(TypedDict):
449
450
  """
450
451
  The name of the environment variable
451
452
  """
452
- created: NotRequired[Optional[str]]
453
+ created: NotRequired[str | None]
453
454
  """
454
455
  Date of environment variable creation
455
456
  """
456
- used: NotRequired[Optional[str]]
457
+ used: NotRequired[str | None]
457
458
  """
458
459
  Date the environment variable was last used
459
460
  """
460
- metadata: NotRequired[Optional[Mapping[str, Any]]]
461
+ metadata: NotRequired[Mapping[str, Any] | None]
461
462
  """
462
463
  Optional metadata associated with the environment variable when managed via the function secrets API
463
464
  """
464
- secret_type: NotRequired[Optional[str]]
465
+ secret_type: NotRequired[str | None]
465
466
  """
466
467
  Optional classification for the secret (for example, the AI provider name)
467
468
  """
468
- secret_category: NotRequired[Optional[Literal['env_var', 'ai_provider']]]
469
+ secret_category: NotRequired[Literal['env_var', 'ai_provider'] | None]
469
470
  """
470
471
  The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys
471
472
  """
472
473
 
473
474
 
474
475
  class ExperimentEventMetadata(TypedDict):
475
- model: NotRequired[Optional[str]]
476
+ model: NotRequired[str | None]
476
477
  """
477
478
  The model used for this example
478
479
  """
479
480
 
480
481
 
481
482
  class ExperimentEventMetrics(TypedDict):
482
- start: NotRequired[Optional[float]]
483
+ start: NotRequired[float | None]
483
484
  """
484
485
  A unix timestamp recording when the section of code which produced the experiment event started
485
486
  """
486
- end: NotRequired[Optional[float]]
487
+ end: NotRequired[float | None]
487
488
  """
488
489
  A unix timestamp recording when the section of code which produced the experiment event finished
489
490
  """
490
- prompt_tokens: NotRequired[Optional[int]]
491
+ prompt_tokens: NotRequired[int | None]
491
492
  """
492
493
  The number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span)
493
494
  """
494
- completion_tokens: NotRequired[Optional[int]]
495
+ completion_tokens: NotRequired[int | None]
495
496
  """
496
497
  The number of tokens in the completion generated by the model (only set if this is an LLM span)
497
498
  """
498
- tokens: NotRequired[Optional[int]]
499
+ tokens: NotRequired[int | None]
499
500
  """
500
501
  The total number of tokens in the input and output of the experiment event.
501
502
  """
502
- caller_functionname: NotRequired[Optional[Any]]
503
+ caller_functionname: NotRequired[Any | None]
503
504
  """
504
505
  This metric is deprecated
505
506
  """
506
- caller_filename: NotRequired[Optional[Any]]
507
+ caller_filename: NotRequired[Any | None]
507
508
  """
508
509
  This metric is deprecated
509
510
  """
510
- caller_lineno: NotRequired[Optional[Any]]
511
+ caller_lineno: NotRequired[Any | None]
511
512
  """
512
513
  This metric is deprecated
513
514
  """
514
515
 
515
516
 
516
517
  class ExperimentEventContext(TypedDict):
517
- caller_functionname: NotRequired[Optional[str]]
518
+ caller_functionname: NotRequired[str | None]
518
519
  """
519
520
  The function in code which created the experiment event
520
521
  """
521
- caller_filename: NotRequired[Optional[str]]
522
+ caller_filename: NotRequired[str | None]
522
523
  """
523
524
  Name of the file in code where the experiment event was created
524
525
  """
525
- caller_lineno: NotRequired[Optional[int]]
526
+ caller_lineno: NotRequired[int | None]
526
527
  """
527
528
  Line of code where the experiment event was created
528
529
  """
@@ -533,24 +534,12 @@ class ExtendedSavedFunctionIdExtendedSavedFunctionId(TypedDict):
533
534
  id: str
534
535
 
535
536
 
536
- class ExtendedSavedFunctionIdExtendedSavedFunctionId1(TypedDict):
537
- type: Literal['global']
538
- name: str
539
-
540
-
541
537
  class ExtendedSavedFunctionIdExtendedSavedFunctionId2(TypedDict):
542
538
  type: Literal['slug']
543
539
  project_id: str
544
540
  slug: str
545
541
 
546
542
 
547
- ExtendedSavedFunctionId: TypeAlias = Union[
548
- ExtendedSavedFunctionIdExtendedSavedFunctionId,
549
- ExtendedSavedFunctionIdExtendedSavedFunctionId1,
550
- ExtendedSavedFunctionIdExtendedSavedFunctionId2,
551
- ]
552
-
553
-
554
543
  class ExternalAttachmentReference(TypedDict):
555
544
  type: Literal['external_attachment']
556
545
  """
@@ -575,11 +564,6 @@ class PreprocessorPreprocessor(TypedDict):
575
564
  id: str
576
565
 
577
566
 
578
- class PreprocessorPreprocessor1(TypedDict):
579
- type: Literal['global']
580
- name: str
581
-
582
-
583
567
  class PreprocessorPreprocessor2(TypedDict):
584
568
  pass
585
569
 
@@ -588,45 +572,21 @@ class PreprocessorPreprocessor3(PreprocessorPreprocessor, PreprocessorPreprocess
588
572
  pass
589
573
 
590
574
 
591
- class PreprocessorPreprocessor4(PreprocessorPreprocessor1, PreprocessorPreprocessor2):
592
- pass
593
-
594
-
595
- Preprocessor: TypeAlias = Union[PreprocessorPreprocessor3, PreprocessorPreprocessor4]
596
-
597
-
598
- class FacetData(TypedDict):
599
- type: Literal['facet']
600
- preprocessor: NotRequired[Optional[Preprocessor]]
601
- prompt: str
602
- """
603
- The prompt to use for LLM extraction. The preprocessed text will be provided as context.
604
- """
605
- model: NotRequired[Optional[str]]
606
- """
607
- The model to use for facet extraction
608
- """
609
- no_match_pattern: NotRequired[Optional[str]]
610
- """
611
- Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match'
612
- """
613
-
614
-
615
575
  class FunctionOrigin(TypedDict):
616
- object_type: Optional[AclObjectType]
576
+ object_type: AclObjectType
617
577
  object_id: str
618
578
  """
619
579
  Id of the object the function is originating from
620
580
  """
621
- internal: NotRequired[Optional[bool]]
581
+ internal: NotRequired[bool | None]
622
582
  """
623
583
  The function exists for internal purposes and should not be displayed in the list of functions.
624
584
  """
625
585
 
626
586
 
627
587
  class FunctionFunctionSchema(TypedDict):
628
- parameters: NotRequired[Optional[Any]]
629
- returns: NotRequired[Optional[Any]]
588
+ parameters: NotRequired[Any | None]
589
+ returns: NotRequired[Any | None]
630
590
 
631
591
 
632
592
  class FunctionDataFunctionData(TypedDict):
@@ -646,7 +606,7 @@ class FunctionDataFunctionData1Data(TypedDict):
646
606
  type: Literal['inline']
647
607
  runtime_context: FunctionDataFunctionData1DataRuntimeContext
648
608
  code: str
649
- code_hash: NotRequired[Optional[str]]
609
+ code_hash: NotRequired[str | None]
650
610
  """
651
611
  SHA256 hash of the code, computed at save time
652
612
  """
@@ -654,7 +614,7 @@ class FunctionDataFunctionData1Data(TypedDict):
654
614
 
655
615
  class FunctionDataFunctionData1(TypedDict):
656
616
  type: Literal['code']
657
- data: Union[Data, FunctionDataFunctionData1Data]
617
+ data: Data | FunctionDataFunctionData1Data
658
618
 
659
619
 
660
620
  class FunctionDataFunctionData2(TypedDict):
@@ -664,15 +624,6 @@ class FunctionDataFunctionData2(TypedDict):
664
624
  parameters: Mapping[str, Any]
665
625
 
666
626
 
667
- class FunctionDataFunctionData3(TypedDict):
668
- type: Literal['global']
669
- name: str
670
- config: NotRequired[Optional[Mapping[str, Any]]]
671
- """
672
- Configuration options to pass to the global function (e.g., for preprocessor customization)
673
- """
674
-
675
-
676
627
  FunctionFormat: TypeAlias = Literal['llm', 'code', 'global', 'graph']
677
628
 
678
629
 
@@ -681,7 +632,7 @@ class FunctionIdFunctionId(TypedDict):
681
632
  """
682
633
  The ID of the function
683
634
  """
684
- version: NotRequired[Optional[str]]
635
+ version: NotRequired[str | None]
685
636
  """
686
637
  The version of the function
687
638
  """
@@ -696,19 +647,12 @@ class FunctionIdFunctionId1(TypedDict):
696
647
  """
697
648
  The slug of the function
698
649
  """
699
- version: NotRequired[Optional[str]]
650
+ version: NotRequired[str | None]
700
651
  """
701
652
  The version of the function
702
653
  """
703
654
 
704
655
 
705
- class FunctionIdFunctionId2(TypedDict):
706
- global_function: str
707
- """
708
- The name of the global function. Currently, the global namespace includes the functions in autoevals
709
- """
710
-
711
-
712
656
  class FunctionIdFunctionId3(TypedDict):
713
657
  prompt_session_id: str
714
658
  """
@@ -718,7 +662,7 @@ class FunctionIdFunctionId3(TypedDict):
718
662
  """
719
663
  The ID of the function in the prompt session
720
664
  """
721
- version: NotRequired[Optional[str]]
665
+ version: NotRequired[str | None]
722
666
  """
723
667
  The version of the function
724
668
  """
@@ -735,7 +679,7 @@ class FunctionIdFunctionId4(TypedDict):
735
679
  """
736
680
  The inline code to execute
737
681
  """
738
- name: NotRequired[Optional[str]]
682
+ name: NotRequired[str | None]
739
683
  """
740
684
  The name of the inline code function
741
685
  """
@@ -814,11 +758,11 @@ class GraphNodeGraphNodePosition(TypedDict):
814
758
 
815
759
 
816
760
  class GraphNodeGraphNode(TypedDict):
817
- description: NotRequired[Optional[str]]
761
+ description: NotRequired[str | None]
818
762
  """
819
763
  The description of the node
820
764
  """
821
- position: NotRequired[Optional[GraphNodeGraphNodePosition]]
765
+ position: NotRequired[GraphNodeGraphNodePosition | None]
822
766
  """
823
767
  The position of the node
824
768
  """
@@ -838,11 +782,11 @@ class GraphNodeGraphNode1Position(TypedDict):
838
782
 
839
783
 
840
784
  class GraphNodeGraphNode1(TypedDict):
841
- description: NotRequired[Optional[str]]
785
+ description: NotRequired[str | None]
842
786
  """
843
787
  The description of the node
844
788
  """
845
- position: NotRequired[Optional[GraphNodeGraphNode1Position]]
789
+ position: NotRequired[GraphNodeGraphNode1Position | None]
846
790
  """
847
791
  The position of the node
848
792
  """
@@ -864,11 +808,11 @@ class GraphNodeGraphNode2Position(TypedDict):
864
808
 
865
809
 
866
810
  class GraphNodeGraphNode2(TypedDict):
867
- description: NotRequired[Optional[str]]
811
+ description: NotRequired[str | None]
868
812
  """
869
813
  The description of the node
870
814
  """
871
- position: NotRequired[Optional[GraphNodeGraphNode2Position]]
815
+ position: NotRequired[GraphNodeGraphNode2Position | None]
872
816
  """
873
817
  The position of the node
874
818
  """
@@ -890,16 +834,16 @@ class GraphNodeGraphNode3Position(TypedDict):
890
834
 
891
835
 
892
836
  class GraphNodeGraphNode3(TypedDict):
893
- description: NotRequired[Optional[str]]
837
+ description: NotRequired[str | None]
894
838
  """
895
839
  The description of the node
896
840
  """
897
- position: NotRequired[Optional[GraphNodeGraphNode3Position]]
841
+ position: NotRequired[GraphNodeGraphNode3Position | None]
898
842
  """
899
843
  The position of the node
900
844
  """
901
845
  type: Literal['literal']
902
- value: NotRequired[Optional[Any]]
846
+ value: NotRequired[Any | None]
903
847
  """
904
848
  A literal value to be returned
905
849
  """
@@ -917,11 +861,11 @@ class GraphNodeGraphNode4Position(TypedDict):
917
861
 
918
862
 
919
863
  class GraphNodeGraphNode4(TypedDict):
920
- description: NotRequired[Optional[str]]
864
+ description: NotRequired[str | None]
921
865
  """
922
866
  The description of the node
923
867
  """
924
- position: NotRequired[Optional[GraphNodeGraphNode4Position]]
868
+ position: NotRequired[GraphNodeGraphNode4Position | None]
925
869
  """
926
870
  The position of the node
927
871
  """
@@ -944,16 +888,16 @@ class GraphNodeGraphNode5Position(TypedDict):
944
888
 
945
889
 
946
890
  class GraphNodeGraphNode5(TypedDict):
947
- description: NotRequired[Optional[str]]
891
+ description: NotRequired[str | None]
948
892
  """
949
893
  The description of the node
950
894
  """
951
- position: NotRequired[Optional[GraphNodeGraphNode5Position]]
895
+ position: NotRequired[GraphNodeGraphNode5Position | None]
952
896
  """
953
897
  The position of the node
954
898
  """
955
899
  type: Literal['gate']
956
- condition: NotRequired[Optional[str]]
900
+ condition: NotRequired[str | None]
957
901
  """
958
902
  A BTQL expression to be evaluated
959
903
  """
@@ -971,11 +915,11 @@ class GraphNodeGraphNode6Position(TypedDict):
971
915
 
972
916
 
973
917
  class GraphNodeGraphNode6(TypedDict):
974
- description: NotRequired[Optional[str]]
918
+ description: NotRequired[str | None]
975
919
  """
976
920
  The description of the node
977
921
  """
978
- position: NotRequired[Optional[GraphNodeGraphNode6Position]]
922
+ position: NotRequired[GraphNodeGraphNode6Position | None]
979
923
  """
980
924
  The position of the node
981
925
  """
@@ -1004,11 +948,11 @@ class Group(TypedDict):
1004
948
 
1005
949
  It is forbidden to change the org after creating a group
1006
950
  """
1007
- user_id: NotRequired[Optional[str]]
951
+ user_id: NotRequired[str | None]
1008
952
  """
1009
953
  Identifies the user who created the group
1010
954
  """
1011
- created: NotRequired[Optional[str]]
955
+ created: NotRequired[str | None]
1012
956
  """
1013
957
  Date of group creation
1014
958
  """
@@ -1016,19 +960,19 @@ class Group(TypedDict):
1016
960
  """
1017
961
  Name of the group
1018
962
  """
1019
- description: NotRequired[Optional[str]]
963
+ description: NotRequired[str | None]
1020
964
  """
1021
965
  Textual description of the group
1022
966
  """
1023
- deleted_at: NotRequired[Optional[str]]
967
+ deleted_at: NotRequired[str | None]
1024
968
  """
1025
969
  Date of group deletion, or null if the group is still active
1026
970
  """
1027
- member_users: NotRequired[Optional[Sequence[str]]]
971
+ member_users: NotRequired[Sequence[str] | None]
1028
972
  """
1029
973
  Ids of users which belong to this group
1030
974
  """
1031
- member_groups: NotRequired[Optional[Sequence[str]]]
975
+ member_groups: NotRequired[Sequence[str] | None]
1032
976
  """
1033
977
  Ids of the groups this group inherits from
1034
978
 
@@ -1044,7 +988,7 @@ class InvokeFunctionInvokeFunction(TypedDict):
1044
988
  """
1045
989
  The ID of the function
1046
990
  """
1047
- version: NotRequired[Optional[str]]
991
+ version: NotRequired[str | None]
1048
992
  """
1049
993
  The version of the function
1050
994
  """
@@ -1059,19 +1003,12 @@ class InvokeFunctionInvokeFunction1(TypedDict):
1059
1003
  """
1060
1004
  The slug of the function
1061
1005
  """
1062
- version: NotRequired[Optional[str]]
1006
+ version: NotRequired[str | None]
1063
1007
  """
1064
1008
  The version of the function
1065
1009
  """
1066
1010
 
1067
1011
 
1068
- class InvokeFunctionInvokeFunction2(TypedDict):
1069
- global_function: str
1070
- """
1071
- The name of the global function. Currently, the global namespace includes the functions in autoevals
1072
- """
1073
-
1074
-
1075
1012
  class InvokeFunctionInvokeFunction3(TypedDict):
1076
1013
  prompt_session_id: str
1077
1014
  """
@@ -1081,7 +1018,7 @@ class InvokeFunctionInvokeFunction3(TypedDict):
1081
1018
  """
1082
1019
  The ID of the function in the prompt session
1083
1020
  """
1084
- version: NotRequired[Optional[str]]
1021
+ version: NotRequired[str | None]
1085
1022
  """
1086
1023
  The version of the function
1087
1024
  """
@@ -1098,14 +1035,14 @@ class InvokeFunctionInvokeFunction4(TypedDict):
1098
1035
  """
1099
1036
  The inline code to execute
1100
1037
  """
1101
- name: NotRequired[Optional[str]]
1038
+ name: NotRequired[str | None]
1102
1039
  """
1103
1040
  The name of the inline code function
1104
1041
  """
1105
1042
 
1106
1043
 
1107
1044
  class InvokeFunctionMcpAuth(TypedDict):
1108
- oauth_token: NotRequired[Optional[str]]
1045
+ oauth_token: NotRequired[str | None]
1109
1046
  """
1110
1047
  The OAuth token to use
1111
1048
  """
@@ -1132,17 +1069,17 @@ class InvokeParentInvokeParent(TypedDict):
1132
1069
  """
1133
1070
  The id of the container object you are logging to
1134
1071
  """
1135
- row_ids: NotRequired[Optional[InvokeParentInvokeParentRowIds]]
1072
+ row_ids: NotRequired[InvokeParentInvokeParentRowIds | None]
1136
1073
  """
1137
1074
  Identifiers for the row to to log a subspan under
1138
1075
  """
1139
- propagated_event: NotRequired[Optional[Mapping[str, Any]]]
1076
+ propagated_event: NotRequired[Mapping[str, Any] | None]
1140
1077
  """
1141
1078
  Include these properties in every span created under this parent
1142
1079
  """
1143
1080
 
1144
1081
 
1145
- InvokeParent: TypeAlias = Union[InvokeParentInvokeParent, str]
1082
+ InvokeParent: TypeAlias = InvokeParentInvokeParent | str
1146
1083
  """
1147
1084
  Options for tracing the function call
1148
1085
  """
@@ -1157,15 +1094,15 @@ class MCPServer(TypedDict):
1157
1094
  """
1158
1095
  Unique identifier for the project that the MCP server belongs under
1159
1096
  """
1160
- user_id: NotRequired[Optional[str]]
1097
+ user_id: NotRequired[str | None]
1161
1098
  """
1162
1099
  Identifies the user who created the MCP server
1163
1100
  """
1164
- created: NotRequired[Optional[str]]
1101
+ created: NotRequired[str | None]
1165
1102
  """
1166
1103
  Date of MCP server creation
1167
1104
  """
1168
- deleted_at: NotRequired[Optional[str]]
1105
+ deleted_at: NotRequired[str | None]
1169
1106
  """
1170
1107
  Date of MCP server deletion, or null if the MCP server is still active
1171
1108
  """
@@ -1173,7 +1110,7 @@ class MCPServer(TypedDict):
1173
1110
  """
1174
1111
  Name of the MCP server. Within a project, MCP server names are unique
1175
1112
  """
1176
- description: NotRequired[Optional[str]]
1113
+ description: NotRequired[str | None]
1177
1114
  """
1178
1115
  Textual description of the MCP server
1179
1116
  """
@@ -1200,42 +1137,48 @@ class ModelParamsModelParamsFunctionCall(TypedDict):
1200
1137
 
1201
1138
 
1202
1139
  class ModelParamsModelParams1(TypedDict):
1203
- use_cache: NotRequired[Optional[bool]]
1204
- reasoning_enabled: NotRequired[Optional[bool]]
1205
- reasoning_budget: NotRequired[Optional[float]]
1140
+ use_cache: NotRequired[bool | None]
1141
+ reasoning_enabled: NotRequired[bool | None]
1142
+ reasoning_budget: NotRequired[float | None]
1206
1143
  max_tokens: float
1207
1144
  temperature: float
1208
- top_p: NotRequired[Optional[float]]
1209
- top_k: NotRequired[Optional[float]]
1210
- stop_sequences: NotRequired[Optional[Sequence[str]]]
1211
- max_tokens_to_sample: NotRequired[Optional[float]]
1145
+ top_p: NotRequired[float | None]
1146
+ top_k: NotRequired[float | None]
1147
+ stop_sequences: NotRequired[Sequence[str] | None]
1148
+ max_tokens_to_sample: NotRequired[float | None]
1212
1149
  """
1213
1150
  This is a legacy parameter that should not be used.
1214
1151
  """
1215
1152
 
1216
1153
 
1217
1154
  class ModelParamsModelParams2(TypedDict):
1218
- use_cache: NotRequired[Optional[bool]]
1219
- reasoning_enabled: NotRequired[Optional[bool]]
1220
- reasoning_budget: NotRequired[Optional[float]]
1221
- temperature: NotRequired[Optional[float]]
1222
- maxOutputTokens: NotRequired[Optional[float]]
1223
- topP: NotRequired[Optional[float]]
1224
- topK: NotRequired[Optional[float]]
1155
+ use_cache: NotRequired[bool | None]
1156
+ reasoning_enabled: NotRequired[bool | None]
1157
+ reasoning_budget: NotRequired[float | None]
1158
+ temperature: NotRequired[float | None]
1159
+ maxOutputTokens: NotRequired[float | None]
1160
+ topP: NotRequired[float | None]
1161
+ topK: NotRequired[float | None]
1225
1162
 
1226
1163
 
1227
1164
  class ModelParamsModelParams3(TypedDict):
1228
- use_cache: NotRequired[Optional[bool]]
1229
- reasoning_enabled: NotRequired[Optional[bool]]
1230
- reasoning_budget: NotRequired[Optional[float]]
1231
- temperature: NotRequired[Optional[float]]
1232
- topK: NotRequired[Optional[float]]
1165
+ use_cache: NotRequired[bool | None]
1166
+ reasoning_enabled: NotRequired[bool | None]
1167
+ reasoning_budget: NotRequired[float | None]
1168
+ temperature: NotRequired[float | None]
1169
+ topK: NotRequired[float | None]
1233
1170
 
1234
1171
 
1235
1172
  class ModelParamsModelParams4(TypedDict):
1236
- use_cache: NotRequired[Optional[bool]]
1237
- reasoning_enabled: NotRequired[Optional[bool]]
1238
- reasoning_budget: NotRequired[Optional[float]]
1173
+ use_cache: NotRequired[bool | None]
1174
+ reasoning_enabled: NotRequired[bool | None]
1175
+ reasoning_budget: NotRequired[float | None]
1176
+
1177
+
1178
+ NullableFunctionTypeEnum: TypeAlias = Literal['llm', 'scorer', 'task', 'tool', 'custom_view', 'preprocessor', 'facet']
1179
+ """
1180
+ The type of global function. If unspecified, defaults to 'scorer' for backward compatibility.
1181
+ """
1239
1182
 
1240
1183
 
1241
1184
  class NullableSavedFunctionIdNullableSavedFunctionId(TypedDict):
@@ -1246,11 +1189,12 @@ class NullableSavedFunctionIdNullableSavedFunctionId(TypedDict):
1246
1189
  class NullableSavedFunctionIdNullableSavedFunctionId1(TypedDict):
1247
1190
  type: Literal['global']
1248
1191
  name: str
1192
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
1249
1193
 
1250
1194
 
1251
- NullableSavedFunctionId: TypeAlias = Optional[
1252
- Union[NullableSavedFunctionIdNullableSavedFunctionId, NullableSavedFunctionIdNullableSavedFunctionId1]
1253
- ]
1195
+ NullableSavedFunctionId: TypeAlias = (
1196
+ NullableSavedFunctionIdNullableSavedFunctionId | NullableSavedFunctionIdNullableSavedFunctionId1 | None
1197
+ )
1254
1198
  """
1255
1199
  Default preprocessor for this project. When set, functions that use preprocessors will use this instead of their built-in default.
1256
1200
  """
@@ -1269,11 +1213,11 @@ class ObjectReference(TypedDict):
1269
1213
  """
1270
1214
  ID of the original event.
1271
1215
  """
1272
- _xact_id: NotRequired[Optional[str]]
1216
+ _xact_id: NotRequired[str | None]
1273
1217
  """
1274
1218
  Transaction ID of the original event.
1275
1219
  """
1276
- created: NotRequired[Optional[str]]
1220
+ created: NotRequired[str | None]
1277
1221
  """
1278
1222
  Created timestamp of the original event. Used to help sort in the UI
1279
1223
  """
@@ -1292,11 +1236,11 @@ class ObjectReferenceNullish(TypedDict):
1292
1236
  """
1293
1237
  ID of the original event.
1294
1238
  """
1295
- _xact_id: NotRequired[Optional[str]]
1239
+ _xact_id: NotRequired[str | None]
1296
1240
  """
1297
1241
  Transaction ID of the original event.
1298
1242
  """
1299
- created: NotRequired[Optional[str]]
1243
+ created: NotRequired[str | None]
1300
1244
  """
1301
1245
  Created timestamp of the original event. Used to help sort in the UI
1302
1246
  """
@@ -1311,11 +1255,11 @@ class Organization(TypedDict):
1311
1255
  """
1312
1256
  Name of the organization
1313
1257
  """
1314
- api_url: NotRequired[Optional[str]]
1315
- is_universal_api: NotRequired[Optional[bool]]
1316
- proxy_url: NotRequired[Optional[str]]
1317
- realtime_url: NotRequired[Optional[str]]
1318
- created: NotRequired[Optional[str]]
1258
+ api_url: NotRequired[str | None]
1259
+ is_universal_api: NotRequired[bool | None]
1260
+ proxy_url: NotRequired[str | None]
1261
+ realtime_url: NotRequired[str | None]
1262
+ created: NotRequired[str | None]
1319
1263
  """
1320
1264
  Date of organization creation
1321
1265
  """
@@ -1355,7 +1299,7 @@ class ProjectAutomationConfigAction1(TypedDict):
1355
1299
  """
1356
1300
  The Slack channel ID to post to
1357
1301
  """
1358
- message_template: NotRequired[Optional[str]]
1302
+ message_template: NotRequired[str | None]
1359
1303
  """
1360
1304
  Custom message template for the alert
1361
1305
  """
@@ -1374,7 +1318,7 @@ class ProjectAutomationConfig(TypedDict):
1374
1318
  """
1375
1319
  Perform the triggered action at most once in this interval of seconds
1376
1320
  """
1377
- action: Union[ProjectAutomationConfigAction, ProjectAutomationConfigAction1]
1321
+ action: ProjectAutomationConfigAction | ProjectAutomationConfigAction1
1378
1322
  """
1379
1323
  The action to take when the automation rule is triggered
1380
1324
  """
@@ -1413,11 +1357,11 @@ class ProjectAutomationConfig1(TypedDict):
1413
1357
  """
1414
1358
  The type of automation.
1415
1359
  """
1416
- export_definition: Union[
1417
- ProjectAutomationConfig1ExportDefinition,
1418
- ProjectAutomationConfig1ExportDefinition1,
1419
- ProjectAutomationConfig1ExportDefinition2,
1420
- ]
1360
+ export_definition: (
1361
+ ProjectAutomationConfig1ExportDefinition
1362
+ | ProjectAutomationConfig1ExportDefinition1
1363
+ | ProjectAutomationConfig1ExportDefinition2
1364
+ )
1421
1365
  """
1422
1366
  The definition of what to export
1423
1367
  """
@@ -1434,64 +1378,109 @@ class ProjectAutomationConfig1(TypedDict):
1434
1378
  Perform the triggered action at most once in this interval of seconds
1435
1379
  """
1436
1380
  credentials: ProjectAutomationConfig1Credentials
1437
- batch_size: NotRequired[Optional[float]]
1381
+ batch_size: NotRequired[float | None]
1438
1382
  """
1439
1383
  The number of rows to export in each batch
1440
1384
  """
1441
1385
 
1442
1386
 
1387
+ class ProjectAutomationConfig3Action(TypedDict):
1388
+ type: Literal['webhook']
1389
+ """
1390
+ The type of action to take
1391
+ """
1392
+ url: str
1393
+ """
1394
+ The webhook URL to send the request to
1395
+ """
1396
+
1397
+
1398
+ class ProjectAutomationConfig3Action1(TypedDict):
1399
+ type: Literal['slack']
1400
+ """
1401
+ The type of action to take
1402
+ """
1403
+ workspace_id: str
1404
+ """
1405
+ The Slack workspace ID to post to
1406
+ """
1407
+ channel: str
1408
+ """
1409
+ The Slack channel ID to post to
1410
+ """
1411
+ message_template: NotRequired[str | None]
1412
+ """
1413
+ Custom message template for the alert
1414
+ """
1415
+
1416
+
1417
+ class ProjectAutomationConfig3(TypedDict):
1418
+ event_type: Literal['environment_update']
1419
+ """
1420
+ The type of automation.
1421
+ """
1422
+ environment_filter: NotRequired[Sequence[str] | None]
1423
+ """
1424
+ Optional list of environment slugs to filter by
1425
+ """
1426
+ action: ProjectAutomationConfig3Action | ProjectAutomationConfig3Action1
1427
+ """
1428
+ The action to take when the automation rule is triggered
1429
+ """
1430
+
1431
+
1443
1432
  class ProjectLogsEventMetadata(TypedDict):
1444
- model: NotRequired[Optional[str]]
1433
+ model: NotRequired[str | None]
1445
1434
  """
1446
1435
  The model used for this example
1447
1436
  """
1448
1437
 
1449
1438
 
1450
1439
  class ProjectLogsEventMetrics(TypedDict):
1451
- start: NotRequired[Optional[float]]
1440
+ start: NotRequired[float | None]
1452
1441
  """
1453
1442
  A unix timestamp recording when the section of code which produced the project logs event started
1454
1443
  """
1455
- end: NotRequired[Optional[float]]
1444
+ end: NotRequired[float | None]
1456
1445
  """
1457
1446
  A unix timestamp recording when the section of code which produced the project logs event finished
1458
1447
  """
1459
- prompt_tokens: NotRequired[Optional[int]]
1448
+ prompt_tokens: NotRequired[int | None]
1460
1449
  """
1461
1450
  The number of tokens in the prompt used to generate the project logs event (only set if this is an LLM span)
1462
1451
  """
1463
- completion_tokens: NotRequired[Optional[int]]
1452
+ completion_tokens: NotRequired[int | None]
1464
1453
  """
1465
1454
  The number of tokens in the completion generated by the model (only set if this is an LLM span)
1466
1455
  """
1467
- tokens: NotRequired[Optional[int]]
1456
+ tokens: NotRequired[int | None]
1468
1457
  """
1469
1458
  The total number of tokens in the input and output of the project logs event.
1470
1459
  """
1471
- caller_functionname: NotRequired[Optional[Any]]
1460
+ caller_functionname: NotRequired[Any | None]
1472
1461
  """
1473
1462
  This metric is deprecated
1474
1463
  """
1475
- caller_filename: NotRequired[Optional[Any]]
1464
+ caller_filename: NotRequired[Any | None]
1476
1465
  """
1477
1466
  This metric is deprecated
1478
1467
  """
1479
- caller_lineno: NotRequired[Optional[Any]]
1468
+ caller_lineno: NotRequired[Any | None]
1480
1469
  """
1481
1470
  This metric is deprecated
1482
1471
  """
1483
1472
 
1484
1473
 
1485
1474
  class ProjectLogsEventContext(TypedDict):
1486
- caller_functionname: NotRequired[Optional[str]]
1475
+ caller_functionname: NotRequired[str | None]
1487
1476
  """
1488
1477
  The function in code which created the project logs event
1489
1478
  """
1490
- caller_filename: NotRequired[Optional[str]]
1479
+ caller_filename: NotRequired[str | None]
1491
1480
  """
1492
1481
  Name of the file in code where the project logs event was created
1493
1482
  """
1494
- caller_lineno: NotRequired[Optional[int]]
1483
+ caller_lineno: NotRequired[int | None]
1495
1484
  """
1496
1485
  Line of code where the project logs event was created
1497
1486
  """
@@ -1518,37 +1507,37 @@ class ProjectSettingsSpanFieldOrderItem(TypedDict):
1518
1507
  object_type: str
1519
1508
  column_id: str
1520
1509
  position: str
1521
- layout: NotRequired[Optional[Union[Literal['full'], Literal['two_column']]]]
1510
+ layout: NotRequired[Literal['full'] | Literal['two_column'] | None]
1522
1511
 
1523
1512
 
1524
1513
  class ProjectSettingsRemoteEvalSource(TypedDict):
1525
1514
  url: str
1526
1515
  name: str
1527
- description: NotRequired[Optional[str]]
1516
+ description: NotRequired[str | None]
1528
1517
 
1529
1518
 
1530
1519
  class ProjectSettings(TypedDict):
1531
- comparison_key: NotRequired[Optional[str]]
1520
+ comparison_key: NotRequired[str | None]
1532
1521
  """
1533
1522
  The key used to join two experiments (defaults to `input`)
1534
1523
  """
1535
- baseline_experiment_id: NotRequired[Optional[str]]
1524
+ baseline_experiment_id: NotRequired[str | None]
1536
1525
  """
1537
1526
  The id of the experiment to use as the default baseline for comparisons
1538
1527
  """
1539
- spanFieldOrder: NotRequired[Optional[Sequence[ProjectSettingsSpanFieldOrderItem]]]
1528
+ spanFieldOrder: NotRequired[Sequence[ProjectSettingsSpanFieldOrderItem] | None]
1540
1529
  """
1541
1530
  The order of the fields to display in the trace view
1542
1531
  """
1543
- remote_eval_sources: NotRequired[Optional[Sequence[ProjectSettingsRemoteEvalSource]]]
1532
+ remote_eval_sources: NotRequired[Sequence[ProjectSettingsRemoteEvalSource] | None]
1544
1533
  """
1545
1534
  The remote eval sources to use for the project
1546
1535
  """
1547
- disable_realtime_queries: NotRequired[Optional[bool]]
1536
+ disable_realtime_queries: NotRequired[bool | None]
1548
1537
  """
1549
1538
  If true, disable real-time queries for this project. This can improve query performance for high-volume logs.
1550
1539
  """
1551
- default_preprocessor: NotRequired[Optional[NullableSavedFunctionId]]
1540
+ default_preprocessor: NotRequired[NullableSavedFunctionId | None]
1552
1541
 
1553
1542
 
1554
1543
  class ProjectTag(TypedDict):
@@ -1561,7 +1550,7 @@ class ProjectTag(TypedDict):
1561
1550
  Unique identifier for the project that the project tag belongs under
1562
1551
  """
1563
1552
  user_id: str
1564
- created: NotRequired[Optional[str]]
1553
+ created: NotRequired[str | None]
1565
1554
  """
1566
1555
  Date of project tag creation
1567
1556
  """
@@ -1569,15 +1558,15 @@ class ProjectTag(TypedDict):
1569
1558
  """
1570
1559
  Name of the project tag
1571
1560
  """
1572
- description: NotRequired[Optional[str]]
1561
+ description: NotRequired[str | None]
1573
1562
  """
1574
1563
  Textual description of the project tag
1575
1564
  """
1576
- color: NotRequired[Optional[str]]
1565
+ color: NotRequired[str | None]
1577
1566
  """
1578
1567
  Color of the tag for the UI
1579
1568
  """
1580
- position: NotRequired[Optional[str]]
1569
+ position: NotRequired[str | None]
1581
1570
  """
1582
1571
  An optional LexoRank-based string that sets the sort position for the tag in the UI
1583
1572
  """
@@ -1594,15 +1583,15 @@ class PromptBlockDataNullishPromptBlockDataNullish1(TypedDict):
1594
1583
 
1595
1584
 
1596
1585
  class PromptDataOrigin(TypedDict):
1597
- prompt_id: NotRequired[Optional[str]]
1598
- project_id: NotRequired[Optional[str]]
1599
- prompt_version: NotRequired[Optional[str]]
1586
+ prompt_id: NotRequired[str | None]
1587
+ project_id: NotRequired[str | None]
1588
+ prompt_version: NotRequired[str | None]
1600
1589
 
1601
1590
 
1602
1591
  class PromptDataNullishOrigin(TypedDict):
1603
- prompt_id: NotRequired[Optional[str]]
1604
- project_id: NotRequired[Optional[str]]
1605
- prompt_version: NotRequired[Optional[str]]
1592
+ prompt_id: NotRequired[str | None]
1593
+ project_id: NotRequired[str | None]
1594
+ prompt_version: NotRequired[str | None]
1606
1595
 
1607
1596
 
1608
1597
  class PromptParserNullish(TypedDict):
@@ -1624,7 +1613,7 @@ class PromptSessionEvent(TypedDict):
1624
1613
  """
1625
1614
  The timestamp the prompt session event was created
1626
1615
  """
1627
- _pagination_key: NotRequired[Optional[str]]
1616
+ _pagination_key: NotRequired[str | None]
1628
1617
  """
1629
1618
  A stable, time-ordered key that can be used to paginate over prompt session events. This field is auto-generated by Braintrust and only exists in Brainstore.
1630
1619
  """
@@ -1636,67 +1625,67 @@ class PromptSessionEvent(TypedDict):
1636
1625
  """
1637
1626
  Unique identifier for the prompt
1638
1627
  """
1639
- prompt_session_data: NotRequired[Optional[Any]]
1628
+ prompt_session_data: NotRequired[Any | None]
1640
1629
  """
1641
1630
  Data about the prompt session
1642
1631
  """
1643
- prompt_data: NotRequired[Optional[Any]]
1632
+ prompt_data: NotRequired[Any | None]
1644
1633
  """
1645
1634
  Data about the prompt
1646
1635
  """
1647
- function_data: NotRequired[Optional[Any]]
1636
+ function_data: NotRequired[Any | None]
1648
1637
  """
1649
1638
  Data about the function
1650
1639
  """
1651
- function_type: NotRequired[Optional[FunctionTypeEnumNullish]]
1652
- object_data: NotRequired[Optional[Any]]
1640
+ function_type: NotRequired[FunctionTypeEnumNullish | None]
1641
+ object_data: NotRequired[Any | None]
1653
1642
  """
1654
1643
  Data about the mapped data
1655
1644
  """
1656
- completion: NotRequired[Optional[Any]]
1645
+ completion: NotRequired[Any | None]
1657
1646
  """
1658
1647
  Data about the completion
1659
1648
  """
1660
- tags: NotRequired[Optional[Sequence[str]]]
1649
+ tags: NotRequired[Sequence[str] | None]
1661
1650
  """
1662
1651
  A list of tags to log
1663
1652
  """
1664
1653
 
1665
1654
 
1666
1655
  class RepoInfo(TypedDict):
1667
- commit: NotRequired[Optional[str]]
1656
+ commit: NotRequired[str | None]
1668
1657
  """
1669
1658
  SHA of most recent commit
1670
1659
  """
1671
- branch: NotRequired[Optional[str]]
1660
+ branch: NotRequired[str | None]
1672
1661
  """
1673
1662
  Name of the branch the most recent commit belongs to
1674
1663
  """
1675
- tag: NotRequired[Optional[str]]
1664
+ tag: NotRequired[str | None]
1676
1665
  """
1677
1666
  Name of the tag on the most recent commit
1678
1667
  """
1679
- dirty: NotRequired[Optional[bool]]
1668
+ dirty: NotRequired[bool | None]
1680
1669
  """
1681
1670
  Whether or not the repo had uncommitted changes when snapshotted
1682
1671
  """
1683
- author_name: NotRequired[Optional[str]]
1672
+ author_name: NotRequired[str | None]
1684
1673
  """
1685
1674
  Name of the author of the most recent commit
1686
1675
  """
1687
- author_email: NotRequired[Optional[str]]
1676
+ author_email: NotRequired[str | None]
1688
1677
  """
1689
1678
  Email of the author of the most recent commit
1690
1679
  """
1691
- commit_message: NotRequired[Optional[str]]
1680
+ commit_message: NotRequired[str | None]
1692
1681
  """
1693
1682
  Most recent commit message
1694
1683
  """
1695
- commit_time: NotRequired[Optional[str]]
1684
+ commit_time: NotRequired[str | None]
1696
1685
  """
1697
1686
  Time of the most recent commit
1698
1687
  """
1699
- git_diff: NotRequired[Optional[str]]
1688
+ git_diff: NotRequired[str | None]
1700
1689
  """
1701
1690
  If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit.
1702
1691
  """
@@ -1712,9 +1701,9 @@ class ResponseFormatResponseFormat2(TypedDict):
1712
1701
 
1713
1702
  class ResponseFormatJsonSchema(TypedDict):
1714
1703
  name: str
1715
- description: NotRequired[Optional[str]]
1716
- schema: NotRequired[Optional[Union[Mapping[str, Any], str]]]
1717
- strict: NotRequired[Optional[bool]]
1704
+ description: NotRequired[str | None]
1705
+ schema: NotRequired[Mapping[str, Any] | str | None]
1706
+ strict: NotRequired[bool | None]
1718
1707
 
1719
1708
 
1720
1709
  class ResponseFormatNullishResponseFormatNullish(TypedDict):
@@ -1730,13 +1719,12 @@ class ResponseFormatNullishResponseFormatNullish2(TypedDict):
1730
1719
  type: Literal['text']
1731
1720
 
1732
1721
 
1733
- ResponseFormatNullish: TypeAlias = Optional[
1734
- Union[
1735
- ResponseFormatNullishResponseFormatNullish,
1736
- ResponseFormatNullishResponseFormatNullish1,
1737
- ResponseFormatNullishResponseFormatNullish2,
1738
- ]
1739
- ]
1722
+ ResponseFormatNullish: TypeAlias = (
1723
+ ResponseFormatNullishResponseFormatNullish
1724
+ | ResponseFormatNullishResponseFormatNullish1
1725
+ | ResponseFormatNullishResponseFormatNullish2
1726
+ | None
1727
+ )
1740
1728
 
1741
1729
 
1742
1730
  RetentionObjectType: TypeAlias = Literal['project_logs', 'experiment', 'dataset']
@@ -1747,7 +1735,7 @@ The object type that the retention policy applies to
1747
1735
 
1748
1736
  class RoleMemberPermission(TypedDict):
1749
1737
  permission: Permission
1750
- restrict_object_type: NotRequired[Optional[AclObjectType]]
1738
+ restrict_object_type: NotRequired[AclObjectType | None]
1751
1739
 
1752
1740
 
1753
1741
  class Role(TypedDict):
@@ -1755,7 +1743,7 @@ class Role(TypedDict):
1755
1743
  """
1756
1744
  Unique identifier for the role
1757
1745
  """
1758
- org_id: NotRequired[Optional[str]]
1746
+ org_id: NotRequired[str | None]
1759
1747
  """
1760
1748
  Unique id for the organization that the role belongs under
1761
1749
 
@@ -1763,11 +1751,11 @@ class Role(TypedDict):
1763
1751
 
1764
1752
  It is forbidden to change the org after creating a role
1765
1753
  """
1766
- user_id: NotRequired[Optional[str]]
1754
+ user_id: NotRequired[str | None]
1767
1755
  """
1768
1756
  Identifies the user who created the role
1769
1757
  """
1770
- created: NotRequired[Optional[str]]
1758
+ created: NotRequired[str | None]
1771
1759
  """
1772
1760
  Date of role creation
1773
1761
  """
@@ -1775,19 +1763,19 @@ class Role(TypedDict):
1775
1763
  """
1776
1764
  Name of the role
1777
1765
  """
1778
- description: NotRequired[Optional[str]]
1766
+ description: NotRequired[str | None]
1779
1767
  """
1780
1768
  Textual description of the role
1781
1769
  """
1782
- deleted_at: NotRequired[Optional[str]]
1770
+ deleted_at: NotRequired[str | None]
1783
1771
  """
1784
1772
  Date of role deletion, or null if the role is still active
1785
1773
  """
1786
- member_permissions: NotRequired[Optional[Sequence[RoleMemberPermission]]]
1774
+ member_permissions: NotRequired[Sequence[RoleMemberPermission] | None]
1787
1775
  """
1788
1776
  (permission, restrict_object_type) tuples which belong to this role
1789
1777
  """
1790
- member_roles: NotRequired[Optional[Sequence[str]]]
1778
+ member_roles: NotRequired[Sequence[str] | None]
1791
1779
  """
1792
1780
  Ids of the roles this role inherits from
1793
1781
 
@@ -1797,13 +1785,13 @@ class Role(TypedDict):
1797
1785
 
1798
1786
  class RunEvalData(TypedDict):
1799
1787
  dataset_id: str
1800
- _internal_btql: NotRequired[Optional[Mapping[str, Any]]]
1788
+ _internal_btql: NotRequired[Mapping[str, Any] | None]
1801
1789
 
1802
1790
 
1803
1791
  class RunEvalData1(TypedDict):
1804
1792
  project_name: str
1805
1793
  dataset_name: str
1806
- _internal_btql: NotRequired[Optional[Mapping[str, Any]]]
1794
+ _internal_btql: NotRequired[Mapping[str, Any] | None]
1807
1795
 
1808
1796
 
1809
1797
  class RunEvalData2(TypedDict):
@@ -1815,7 +1803,7 @@ class TaskTask(TypedDict):
1815
1803
  """
1816
1804
  The ID of the function
1817
1805
  """
1818
- version: NotRequired[Optional[str]]
1806
+ version: NotRequired[str | None]
1819
1807
  """
1820
1808
  The version of the function
1821
1809
  """
@@ -1830,7 +1818,7 @@ class TaskTask1(TypedDict):
1830
1818
  """
1831
1819
  The slug of the function
1832
1820
  """
1833
- version: NotRequired[Optional[str]]
1821
+ version: NotRequired[str | None]
1834
1822
  """
1835
1823
  The version of the function
1836
1824
  """
@@ -1841,6 +1829,7 @@ class TaskTask2(TypedDict):
1841
1829
  """
1842
1830
  The name of the global function. Currently, the global namespace includes the functions in autoevals
1843
1831
  """
1832
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
1844
1833
 
1845
1834
 
1846
1835
  class TaskTask3(TypedDict):
@@ -1852,7 +1841,7 @@ class TaskTask3(TypedDict):
1852
1841
  """
1853
1842
  The ID of the function in the prompt session
1854
1843
  """
1855
- version: NotRequired[Optional[str]]
1844
+ version: NotRequired[str | None]
1856
1845
  """
1857
1846
  The version of the function
1858
1847
  """
@@ -1869,7 +1858,7 @@ class TaskTask4(TypedDict):
1869
1858
  """
1870
1859
  The inline code to execute
1871
1860
  """
1872
- name: NotRequired[Optional[str]]
1861
+ name: NotRequired[str | None]
1873
1862
  """
1874
1863
  The name of the inline code function
1875
1864
  """
@@ -1920,11 +1909,11 @@ class ParentParent(TypedDict):
1920
1909
  """
1921
1910
  The id of the container object you are logging to
1922
1911
  """
1923
- row_ids: NotRequired[Optional[ParentParentRowIds]]
1912
+ row_ids: NotRequired[ParentParentRowIds | None]
1924
1913
  """
1925
1914
  Identifiers for the row to to log a subspan under
1926
1915
  """
1927
- propagated_event: NotRequired[Optional[Mapping[str, Any]]]
1916
+ propagated_event: NotRequired[Mapping[str, Any] | None]
1928
1917
  """
1929
1918
  Include these properties in every span created under this parent
1930
1919
  """
@@ -1942,7 +1931,7 @@ Parent: TypeAlias = ParentParent2
1942
1931
 
1943
1932
 
1944
1933
  class RunEvalMcpAuth(TypedDict):
1945
- oauth_token: NotRequired[Optional[str]]
1934
+ oauth_token: NotRequired[str | None]
1946
1935
  """
1947
1936
  The OAuth token to use
1948
1937
  """
@@ -1956,9 +1945,10 @@ class SavedFunctionIdSavedFunctionId(TypedDict):
1956
1945
  class SavedFunctionIdSavedFunctionId1(TypedDict):
1957
1946
  type: Literal['global']
1958
1947
  name: str
1948
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
1959
1949
 
1960
1950
 
1961
- SavedFunctionId: TypeAlias = Union[SavedFunctionIdSavedFunctionId, SavedFunctionIdSavedFunctionId1]
1951
+ SavedFunctionId: TypeAlias = SavedFunctionIdSavedFunctionId | SavedFunctionIdSavedFunctionId1
1962
1952
 
1963
1953
 
1964
1954
  class ServiceToken(TypedDict):
@@ -1966,7 +1956,7 @@ class ServiceToken(TypedDict):
1966
1956
  """
1967
1957
  Unique identifier for the service token
1968
1958
  """
1969
- created: NotRequired[Optional[str]]
1959
+ created: NotRequired[str | None]
1970
1960
  """
1971
1961
  Date of service token creation
1972
1962
  """
@@ -1975,19 +1965,19 @@ class ServiceToken(TypedDict):
1975
1965
  Name of the service token
1976
1966
  """
1977
1967
  preview_name: str
1978
- service_account_id: NotRequired[Optional[str]]
1968
+ service_account_id: NotRequired[str | None]
1979
1969
  """
1980
1970
  Unique identifier for the service token
1981
1971
  """
1982
- service_account_email: NotRequired[Optional[str]]
1972
+ service_account_email: NotRequired[str | None]
1983
1973
  """
1984
1974
  The service account email (not routable)
1985
1975
  """
1986
- service_account_name: NotRequired[Optional[str]]
1976
+ service_account_name: NotRequired[str | None]
1987
1977
  """
1988
1978
  The service account name
1989
1979
  """
1990
- org_id: NotRequired[Optional[str]]
1980
+ org_id: NotRequired[str | None]
1991
1981
  """
1992
1982
  Unique identifier for the organization
1993
1983
  """
@@ -2002,15 +1992,15 @@ class SpanIFrame(TypedDict):
2002
1992
  """
2003
1993
  Unique identifier for the project that the span iframe belongs under
2004
1994
  """
2005
- user_id: NotRequired[Optional[str]]
1995
+ user_id: NotRequired[str | None]
2006
1996
  """
2007
1997
  Identifies the user who created the span iframe
2008
1998
  """
2009
- created: NotRequired[Optional[str]]
1999
+ created: NotRequired[str | None]
2010
2000
  """
2011
2001
  Date of span iframe creation
2012
2002
  """
2013
- deleted_at: NotRequired[Optional[str]]
2003
+ deleted_at: NotRequired[str | None]
2014
2004
  """
2015
2005
  Date of span iframe deletion, or null if the span iframe is still active
2016
2006
  """
@@ -2018,7 +2008,7 @@ class SpanIFrame(TypedDict):
2018
2008
  """
2019
2009
  Name of the span iframe
2020
2010
  """
2021
- description: NotRequired[Optional[str]]
2011
+ description: NotRequired[str | None]
2022
2012
  """
2023
2013
  Textual description of the span iframe
2024
2014
  """
@@ -2026,7 +2016,7 @@ class SpanIFrame(TypedDict):
2026
2016
  """
2027
2017
  URL to embed the project viewer in an iframe
2028
2018
  """
2029
- post_message: NotRequired[Optional[bool]]
2019
+ post_message: NotRequired[bool | None]
2030
2020
  """
2031
2021
  Whether to post messages to the iframe containing the span's data. This is useful when you want to render more data than fits in the URL.
2032
2022
  """
@@ -2061,7 +2051,7 @@ class SSEProgressEventData(TypedDict):
2061
2051
  The id of the span this event is for
2062
2052
  """
2063
2053
  object_type: FunctionObjectType
2064
- origin: NotRequired[Optional[ObjectReferenceNullish]]
2054
+ origin: NotRequired[ObjectReferenceNullish | None]
2065
2055
  format: FunctionFormat
2066
2056
  output_type: FunctionOutputType
2067
2057
  name: str
@@ -2069,7 +2059,7 @@ class SSEProgressEventData(TypedDict):
2069
2059
  data: str
2070
2060
 
2071
2061
 
2072
- StreamingMode: TypeAlias = Literal['auto', 'parallel']
2062
+ StreamingMode: TypeAlias = Literal['auto', 'parallel', 'json', 'text']
2073
2063
  """
2074
2064
  The mode format of the returned value (defaults to 'auto')
2075
2065
  """
@@ -2077,9 +2067,9 @@ The mode format of the returned value (defaults to 'auto')
2077
2067
 
2078
2068
  class ToolFunctionDefinitionFunction(TypedDict):
2079
2069
  name: str
2080
- description: NotRequired[Optional[str]]
2081
- parameters: NotRequired[Optional[Mapping[str, Any]]]
2082
- strict: NotRequired[Optional[bool]]
2070
+ description: NotRequired[str | None]
2071
+ parameters: NotRequired[Mapping[str, Any] | None]
2072
+ strict: NotRequired[bool | None]
2083
2073
 
2084
2074
 
2085
2075
  class ToolFunctionDefinition(TypedDict):
@@ -2103,51 +2093,51 @@ class User(TypedDict):
2103
2093
  """
2104
2094
  Unique identifier for the user
2105
2095
  """
2106
- given_name: NotRequired[Optional[str]]
2096
+ given_name: NotRequired[str | None]
2107
2097
  """
2108
2098
  Given name of the user
2109
2099
  """
2110
- family_name: NotRequired[Optional[str]]
2100
+ family_name: NotRequired[str | None]
2111
2101
  """
2112
2102
  Family name of the user
2113
2103
  """
2114
- email: NotRequired[Optional[str]]
2104
+ email: NotRequired[str | None]
2115
2105
  """
2116
2106
  The user's email
2117
2107
  """
2118
- avatar_url: NotRequired[Optional[str]]
2108
+ avatar_url: NotRequired[str | None]
2119
2109
  """
2120
2110
  URL of the user's Avatar image
2121
2111
  """
2122
- created: NotRequired[Optional[str]]
2112
+ created: NotRequired[str | None]
2123
2113
  """
2124
2114
  Date of user creation
2125
2115
  """
2126
2116
 
2127
2117
 
2128
2118
  class ViewDataSearch(TypedDict):
2129
- filter: NotRequired[Optional[Sequence[Any]]]
2130
- tag: NotRequired[Optional[Sequence[Any]]]
2131
- match: NotRequired[Optional[Sequence[Any]]]
2132
- sort: NotRequired[Optional[Sequence[Any]]]
2119
+ filter: NotRequired[Sequence[Any] | None]
2120
+ tag: NotRequired[Sequence[Any] | None]
2121
+ match: NotRequired[Sequence[Any] | None]
2122
+ sort: NotRequired[Sequence[Any] | None]
2133
2123
 
2134
2124
 
2135
2125
  class ViewOptionsViewOptionsOptions(TypedDict):
2136
- spanType: NotRequired[Optional[Literal['range', 'frame']]]
2137
- rangeValue: NotRequired[Optional[str]]
2138
- frameStart: NotRequired[Optional[str]]
2139
- frameEnd: NotRequired[Optional[str]]
2140
- tzUTC: NotRequired[Optional[bool]]
2141
- chartVisibility: NotRequired[Optional[Mapping[str, Any]]]
2142
- projectId: NotRequired[Optional[str]]
2143
- type: NotRequired[Optional[Literal['project', 'experiment']]]
2144
- groupBy: NotRequired[Optional[str]]
2126
+ spanType: NotRequired[Literal['range', 'frame'] | None]
2127
+ rangeValue: NotRequired[str | None]
2128
+ frameStart: NotRequired[str | None]
2129
+ frameEnd: NotRequired[str | None]
2130
+ tzUTC: NotRequired[bool | None]
2131
+ chartVisibility: NotRequired[Mapping[str, Any] | None]
2132
+ projectId: NotRequired[str | None]
2133
+ type: NotRequired[Literal['project', 'experiment'] | None]
2134
+ groupBy: NotRequired[str | None]
2145
2135
 
2146
2136
 
2147
2137
  class ViewOptionsViewOptions(TypedDict):
2148
2138
  viewType: Literal['monitor']
2149
2139
  options: ViewOptionsViewOptionsOptions
2150
- freezeColumns: NotRequired[Optional[bool]]
2140
+ freezeColumns: NotRequired[bool | None]
2151
2141
 
2152
2142
 
2153
2143
  class ViewOptionsViewOptions1ExcludedMeasure(TypedDict):
@@ -2185,29 +2175,29 @@ ViewOptionsViewOptions1TimeRangeFilter = TypedDict(
2185
2175
 
2186
2176
 
2187
2177
  class ViewOptionsViewOptions1(TypedDict):
2188
- columnVisibility: NotRequired[Optional[Mapping[str, Any]]]
2189
- columnOrder: NotRequired[Optional[Sequence[str]]]
2190
- columnSizing: NotRequired[Optional[Mapping[str, Any]]]
2191
- grouping: NotRequired[Optional[str]]
2192
- rowHeight: NotRequired[Optional[str]]
2193
- tallGroupRows: NotRequired[Optional[bool]]
2194
- layout: NotRequired[Optional[str]]
2195
- chartHeight: NotRequired[Optional[float]]
2196
- excludedMeasures: NotRequired[Optional[Sequence[ViewOptionsViewOptions1ExcludedMeasure]]]
2197
- yMetric: NotRequired[Optional[ViewOptionsViewOptions1YMetric]]
2198
- xAxis: NotRequired[Optional[ViewOptionsViewOptions1XAxis]]
2199
- symbolGrouping: NotRequired[Optional[ViewOptionsViewOptions1SymbolGrouping]]
2200
- xAxisAggregation: NotRequired[Optional[str]]
2178
+ columnVisibility: NotRequired[Mapping[str, Any] | None]
2179
+ columnOrder: NotRequired[Sequence[str] | None]
2180
+ columnSizing: NotRequired[Mapping[str, Any] | None]
2181
+ grouping: NotRequired[str | None]
2182
+ rowHeight: NotRequired[str | None]
2183
+ tallGroupRows: NotRequired[bool | None]
2184
+ layout: NotRequired[str | None]
2185
+ chartHeight: NotRequired[float | None]
2186
+ excludedMeasures: NotRequired[Sequence[ViewOptionsViewOptions1ExcludedMeasure] | None]
2187
+ yMetric: NotRequired[ViewOptionsViewOptions1YMetric | None]
2188
+ xAxis: NotRequired[ViewOptionsViewOptions1XAxis | None]
2189
+ symbolGrouping: NotRequired[ViewOptionsViewOptions1SymbolGrouping | None]
2190
+ xAxisAggregation: NotRequired[str | None]
2201
2191
  """
2202
2192
  One of 'avg', 'sum', 'min', 'max', 'median', 'all'
2203
2193
  """
2204
- chartAnnotations: NotRequired[Optional[Sequence[ViewOptionsViewOptions1ChartAnnotation]]]
2205
- timeRangeFilter: NotRequired[Optional[Union[str, ViewOptionsViewOptions1TimeRangeFilter]]]
2206
- queryShape: NotRequired[Optional[Literal['traces', 'spans']]]
2207
- freezeColumns: NotRequired[Optional[bool]]
2194
+ chartAnnotations: NotRequired[Sequence[ViewOptionsViewOptions1ChartAnnotation] | None]
2195
+ timeRangeFilter: NotRequired[str | ViewOptionsViewOptions1TimeRangeFilter | None]
2196
+ queryShape: NotRequired[Literal['traces', 'spans'] | None]
2197
+ freezeColumns: NotRequired[bool | None]
2208
2198
 
2209
2199
 
2210
- ViewOptions: TypeAlias = Optional[Union[ViewOptionsViewOptions, ViewOptionsViewOptions1]]
2200
+ ViewOptions: TypeAlias = ViewOptionsViewOptions | ViewOptionsViewOptions1 | None
2211
2201
  """
2212
2202
  Options for the view in the app
2213
2203
  """
@@ -2218,22 +2208,22 @@ class Acl(TypedDict):
2218
2208
  """
2219
2209
  Unique identifier for the acl
2220
2210
  """
2221
- object_type: Optional[AclObjectType]
2211
+ object_type: AclObjectType
2222
2212
  object_id: str
2223
2213
  """
2224
2214
  The id of the object the ACL applies to
2225
2215
  """
2226
- user_id: NotRequired[Optional[str]]
2216
+ user_id: NotRequired[str | None]
2227
2217
  """
2228
2218
  Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided
2229
2219
  """
2230
- group_id: NotRequired[Optional[str]]
2220
+ group_id: NotRequired[str | None]
2231
2221
  """
2232
2222
  Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided
2233
2223
  """
2234
- permission: NotRequired[Optional[Permission]]
2235
- restrict_object_type: NotRequired[Optional[AclObjectType]]
2236
- role_id: NotRequired[Optional[str]]
2224
+ permission: NotRequired[Permission | None]
2225
+ restrict_object_type: NotRequired[AclObjectType | None]
2226
+ role_id: NotRequired[str | None]
2237
2227
  """
2238
2228
  Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided
2239
2229
  """
@@ -2241,114 +2231,114 @@ class Acl(TypedDict):
2241
2231
  """
2242
2232
  The organization the ACL's referred object belongs to
2243
2233
  """
2244
- created: NotRequired[Optional[str]]
2234
+ created: NotRequired[str | None]
2245
2235
  """
2246
2236
  Date of acl creation
2247
2237
  """
2248
2238
 
2249
2239
 
2250
2240
  class AnyModelParams(TypedDict):
2251
- temperature: NotRequired[Optional[float]]
2252
- top_p: NotRequired[Optional[float]]
2241
+ temperature: NotRequired[float | None]
2242
+ top_p: NotRequired[float | None]
2253
2243
  max_tokens: float
2254
- max_completion_tokens: NotRequired[Optional[float]]
2244
+ max_completion_tokens: NotRequired[float | None]
2255
2245
  """
2256
2246
  The successor to max_tokens
2257
2247
  """
2258
- frequency_penalty: NotRequired[Optional[float]]
2259
- presence_penalty: NotRequired[Optional[float]]
2260
- response_format: NotRequired[Optional[ResponseFormatNullish]]
2261
- tool_choice: NotRequired[Optional[Union[Literal['auto'], Literal['none'], Literal['required'], AnyModelParamsToolChoice]]]
2262
- function_call: NotRequired[Optional[Union[Literal['auto'], Literal['none'], AnyModelParamsFunctionCall]]]
2263
- n: NotRequired[Optional[float]]
2264
- stop: NotRequired[Optional[Sequence[str]]]
2265
- reasoning_effort: NotRequired[Optional[Literal['none', 'minimal', 'low', 'medium', 'high']]]
2266
- verbosity: NotRequired[Optional[Literal['low', 'medium', 'high']]]
2267
- top_k: NotRequired[Optional[float]]
2268
- stop_sequences: NotRequired[Optional[Sequence[str]]]
2269
- reasoning_enabled: NotRequired[Optional[bool]]
2270
- reasoning_budget: NotRequired[Optional[float]]
2271
- max_tokens_to_sample: NotRequired[Optional[float]]
2248
+ frequency_penalty: NotRequired[float | None]
2249
+ presence_penalty: NotRequired[float | None]
2250
+ response_format: NotRequired[ResponseFormatNullish | None]
2251
+ tool_choice: NotRequired[Literal['auto'] | Literal['none'] | Literal['required'] | AnyModelParamsToolChoice | None]
2252
+ function_call: NotRequired[Literal['auto'] | Literal['none'] | AnyModelParamsFunctionCall | None]
2253
+ n: NotRequired[float | None]
2254
+ stop: NotRequired[Sequence[str] | None]
2255
+ reasoning_effort: NotRequired[Literal['none', 'minimal', 'low', 'medium', 'high'] | None]
2256
+ verbosity: NotRequired[Literal['low', 'medium', 'high'] | None]
2257
+ top_k: NotRequired[float | None]
2258
+ stop_sequences: NotRequired[Sequence[str] | None]
2259
+ reasoning_enabled: NotRequired[bool | None]
2260
+ reasoning_budget: NotRequired[float | None]
2261
+ max_tokens_to_sample: NotRequired[float | None]
2272
2262
  """
2273
2263
  This is a legacy parameter that should not be used.
2274
2264
  """
2275
- maxOutputTokens: NotRequired[Optional[float]]
2276
- topP: NotRequired[Optional[float]]
2277
- topK: NotRequired[Optional[float]]
2278
- use_cache: NotRequired[Optional[bool]]
2265
+ maxOutputTokens: NotRequired[float | None]
2266
+ topP: NotRequired[float | None]
2267
+ topK: NotRequired[float | None]
2268
+ use_cache: NotRequired[bool | None]
2279
2269
 
2280
2270
 
2281
2271
  class AsyncScoringControlAsyncScoringControl1(TypedDict):
2282
2272
  kind: Literal['state_override']
2283
- state: Optional[AsyncScoringState]
2273
+ state: AsyncScoringState
2284
2274
 
2285
2275
 
2286
- AsyncScoringControl: TypeAlias = Union[
2287
- AsyncScoringControlAsyncScoringControl,
2288
- AsyncScoringControlAsyncScoringControl1,
2289
- AsyncScoringControlAsyncScoringControl2,
2290
- AsyncScoringControlAsyncScoringControl3,
2291
- ]
2276
+ AsyncScoringControl: TypeAlias = (
2277
+ AsyncScoringControlAsyncScoringControl
2278
+ | AsyncScoringControlAsyncScoringControl1
2279
+ | AsyncScoringControlAsyncScoringControl2
2280
+ | AsyncScoringControlAsyncScoringControl3
2281
+ )
2292
2282
 
2293
2283
 
2294
- AttachmentReference: TypeAlias = Union[BraintrustAttachmentReference, ExternalAttachmentReference]
2284
+ AttachmentReference: TypeAlias = BraintrustAttachmentReference | ExternalAttachmentReference
2295
2285
 
2296
2286
 
2297
2287
  class AttachmentStatus(TypedDict):
2298
2288
  upload_status: UploadStatus
2299
- error_message: NotRequired[Optional[str]]
2289
+ error_message: NotRequired[str | None]
2300
2290
  """
2301
2291
  Describes the error encountered while uploading.
2302
2292
  """
2303
2293
 
2304
2294
 
2305
- ChatCompletionContentPart: TypeAlias = Union[
2306
- ChatCompletionContentPartTextWithTitle,
2307
- ChatCompletionContentPartImageWithTitle,
2308
- ChatCompletionContentPartFileWithTitle,
2309
- ]
2295
+ ChatCompletionContentPart: TypeAlias = (
2296
+ ChatCompletionContentPartTextWithTitle
2297
+ | ChatCompletionContentPartImageWithTitle
2298
+ | ChatCompletionContentPartFileWithTitle
2299
+ )
2310
2300
 
2311
2301
 
2312
2302
  class ChatCompletionMessageParamChatCompletionMessageParam1(TypedDict):
2313
- content: Union[str, Sequence[ChatCompletionContentPart]]
2303
+ content: str | Sequence[ChatCompletionContentPart]
2314
2304
  role: Literal['user']
2315
- name: NotRequired[Optional[str]]
2305
+ name: NotRequired[str | None]
2316
2306
 
2317
2307
 
2318
2308
  class ChatCompletionMessageParamChatCompletionMessageParam2(TypedDict):
2319
2309
  role: Literal['assistant']
2320
- content: NotRequired[Optional[Union[str, Sequence[ChatCompletionContentPartText]]]]
2321
- function_call: NotRequired[Optional[ChatCompletionMessageParamChatCompletionMessageParam2FunctionCall]]
2322
- name: NotRequired[Optional[str]]
2323
- tool_calls: NotRequired[Optional[Sequence[ChatCompletionMessageToolCall]]]
2324
- reasoning: NotRequired[Optional[Sequence[ChatCompletionMessageReasoning]]]
2325
-
2326
-
2327
- ChatCompletionMessageParam: TypeAlias = Union[
2328
- ChatCompletionMessageParamChatCompletionMessageParam,
2329
- ChatCompletionMessageParamChatCompletionMessageParam1,
2330
- ChatCompletionMessageParamChatCompletionMessageParam2,
2331
- ChatCompletionMessageParamChatCompletionMessageParam3,
2332
- ChatCompletionMessageParamChatCompletionMessageParam4,
2333
- ChatCompletionMessageParamChatCompletionMessageParam5,
2334
- ChatCompletionMessageParamChatCompletionMessageParam6,
2335
- ]
2310
+ content: NotRequired[str | Sequence[ChatCompletionContentPartText] | None]
2311
+ function_call: NotRequired[ChatCompletionMessageParamChatCompletionMessageParam2FunctionCall | None]
2312
+ name: NotRequired[str | None]
2313
+ tool_calls: NotRequired[Sequence[ChatCompletionMessageToolCall] | None]
2314
+ reasoning: NotRequired[Sequence[ChatCompletionMessageReasoning] | None]
2315
+
2316
+
2317
+ ChatCompletionMessageParam: TypeAlias = (
2318
+ ChatCompletionMessageParamChatCompletionMessageParam
2319
+ | ChatCompletionMessageParamChatCompletionMessageParam1
2320
+ | ChatCompletionMessageParamChatCompletionMessageParam2
2321
+ | ChatCompletionMessageParamChatCompletionMessageParam3
2322
+ | ChatCompletionMessageParamChatCompletionMessageParam4
2323
+ | ChatCompletionMessageParamChatCompletionMessageParam5
2324
+ | ChatCompletionMessageParamChatCompletionMessageParam6
2325
+ )
2336
2326
 
2337
2327
 
2338
2328
  class ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam1(TypedDict):
2339
- content: Union[str, Sequence[ChatCompletionContentPart]]
2329
+ content: str | Sequence[ChatCompletionContentPart]
2340
2330
  role: Literal['user']
2341
- name: NotRequired[Optional[str]]
2331
+ name: NotRequired[str | None]
2342
2332
 
2343
2333
 
2344
- ChatCompletionOpenAIMessageParam: TypeAlias = Union[
2345
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam,
2346
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam1,
2347
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2,
2348
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam3,
2349
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam4,
2350
- ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam5,
2351
- ]
2334
+ ChatCompletionOpenAIMessageParam: TypeAlias = (
2335
+ ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam
2336
+ | ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam1
2337
+ | ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam2
2338
+ | ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam3
2339
+ | ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam4
2340
+ | ChatCompletionOpenAIMessageParamChatCompletionOpenAIMessageParam5
2341
+ )
2352
2342
 
2353
2343
 
2354
2344
  class DatasetEvent(TypedDict):
@@ -2364,7 +2354,7 @@ class DatasetEvent(TypedDict):
2364
2354
  """
2365
2355
  The timestamp the dataset event was created
2366
2356
  """
2367
- _pagination_key: NotRequired[Optional[str]]
2357
+ _pagination_key: NotRequired[str | None]
2368
2358
  """
2369
2359
  A stable, time-ordered key that can be used to paginate over dataset events. This field is auto-generated by Braintrust and only exists in Brainstore.
2370
2360
  """
@@ -2376,19 +2366,19 @@ class DatasetEvent(TypedDict):
2376
2366
  """
2377
2367
  Unique identifier for the dataset
2378
2368
  """
2379
- input: NotRequired[Optional[Any]]
2369
+ input: NotRequired[Any | None]
2380
2370
  """
2381
2371
  The argument that uniquely define an input case (an arbitrary, JSON serializable object)
2382
2372
  """
2383
- expected: NotRequired[Optional[Any]]
2373
+ expected: NotRequired[Any | None]
2384
2374
  """
2385
2375
  The output of your application, including post-processing (an arbitrary, JSON serializable object)
2386
2376
  """
2387
- metadata: NotRequired[Optional[DatasetEventMetadata]]
2377
+ metadata: NotRequired[DatasetEventMetadata | None]
2388
2378
  """
2389
2379
  A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings
2390
2380
  """
2391
- tags: NotRequired[Optional[Sequence[str]]]
2381
+ tags: NotRequired[Sequence[str] | None]
2392
2382
  """
2393
2383
  A list of tags to log
2394
2384
  """
@@ -2400,16 +2390,16 @@ class DatasetEvent(TypedDict):
2400
2390
  """
2401
2391
  A unique identifier for the trace this dataset event belongs to
2402
2392
  """
2403
- is_root: NotRequired[Optional[bool]]
2393
+ is_root: NotRequired[bool | None]
2404
2394
  """
2405
2395
  Whether this span is a root span
2406
2396
  """
2407
- origin: NotRequired[Optional[ObjectReferenceNullish]]
2408
- comments: NotRequired[Optional[Sequence[Any]]]
2397
+ origin: NotRequired[ObjectReferenceNullish | None]
2398
+ comments: NotRequired[Sequence[Any] | None]
2409
2399
  """
2410
2400
  Optional list of comments attached to this event
2411
2401
  """
2412
- audit_data: NotRequired[Optional[Sequence[Any]]]
2402
+ audit_data: NotRequired[Sequence[Any] | None]
2413
2403
  """
2414
2404
  Optional list of audit entries attached to this event
2415
2405
  """
@@ -2428,32 +2418,32 @@ class Experiment(TypedDict):
2428
2418
  """
2429
2419
  Name of the experiment. Within a project, experiment names are unique
2430
2420
  """
2431
- description: NotRequired[Optional[str]]
2421
+ description: NotRequired[str | None]
2432
2422
  """
2433
2423
  Textual description of the experiment
2434
2424
  """
2435
- created: NotRequired[Optional[str]]
2425
+ created: NotRequired[str | None]
2436
2426
  """
2437
2427
  Date of experiment creation
2438
2428
  """
2439
- repo_info: NotRequired[Optional[RepoInfo]]
2440
- commit: NotRequired[Optional[str]]
2429
+ repo_info: NotRequired[RepoInfo | None]
2430
+ commit: NotRequired[str | None]
2441
2431
  """
2442
2432
  Commit, taken directly from `repo_info.commit`
2443
2433
  """
2444
- base_exp_id: NotRequired[Optional[str]]
2434
+ base_exp_id: NotRequired[str | None]
2445
2435
  """
2446
2436
  Id of default base experiment to compare against when viewing this experiment
2447
2437
  """
2448
- deleted_at: NotRequired[Optional[str]]
2438
+ deleted_at: NotRequired[str | None]
2449
2439
  """
2450
2440
  Date of experiment deletion, or null if the experiment is still active
2451
2441
  """
2452
- dataset_id: NotRequired[Optional[str]]
2442
+ dataset_id: NotRequired[str | None]
2453
2443
  """
2454
2444
  Identifier of the linked dataset, or null if the experiment is not linked to a dataset
2455
2445
  """
2456
- dataset_version: NotRequired[Optional[str]]
2446
+ dataset_version: NotRequired[str | None]
2457
2447
  """
2458
2448
  Version number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
2459
2449
  """
@@ -2461,57 +2451,126 @@ class Experiment(TypedDict):
2461
2451
  """
2462
2452
  Whether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
2463
2453
  """
2464
- user_id: NotRequired[Optional[str]]
2454
+ user_id: NotRequired[str | None]
2465
2455
  """
2466
2456
  Identifies the user who created the experiment
2467
2457
  """
2468
- metadata: NotRequired[Optional[Mapping[str, Any]]]
2458
+ metadata: NotRequired[Mapping[str, Any] | None]
2469
2459
  """
2470
2460
  User-controlled metadata about the experiment
2471
2461
  """
2472
- tags: NotRequired[Optional[Sequence[str]]]
2462
+ tags: NotRequired[Sequence[str] | None]
2473
2463
  """
2474
2464
  A list of tags for the experiment
2475
2465
  """
2476
2466
 
2477
2467
 
2478
- InvokeScope: TypeAlias = Union[SpanScope, TraceScope]
2468
+ class ExtendedSavedFunctionIdExtendedSavedFunctionId1(TypedDict):
2469
+ type: Literal['global']
2470
+ name: str
2471
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
2472
+
2473
+
2474
+ ExtendedSavedFunctionId: TypeAlias = (
2475
+ ExtendedSavedFunctionIdExtendedSavedFunctionId
2476
+ | ExtendedSavedFunctionIdExtendedSavedFunctionId1
2477
+ | ExtendedSavedFunctionIdExtendedSavedFunctionId2
2478
+ )
2479
+
2480
+
2481
+ class PreprocessorPreprocessor1(TypedDict):
2482
+ type: Literal['global']
2483
+ name: str
2484
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
2485
+
2486
+
2487
+ class PreprocessorPreprocessor4(PreprocessorPreprocessor1, PreprocessorPreprocessor2):
2488
+ pass
2489
+
2490
+
2491
+ Preprocessor: TypeAlias = PreprocessorPreprocessor3 | PreprocessorPreprocessor4
2492
+
2493
+
2494
+ class FacetData(TypedDict):
2495
+ type: Literal['facet']
2496
+ preprocessor: NotRequired[Preprocessor | None]
2497
+ prompt: str
2498
+ """
2499
+ The prompt to use for LLM extraction. The preprocessed text will be provided as context.
2500
+ """
2501
+ model: NotRequired[str | None]
2502
+ """
2503
+ The model to use for facet extraction
2504
+ """
2505
+ no_match_pattern: NotRequired[str | None]
2506
+ """
2507
+ Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match'
2508
+ """
2509
+
2510
+
2511
+ class FunctionDataFunctionData3(TypedDict):
2512
+ type: Literal['global']
2513
+ name: str
2514
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
2515
+ config: NotRequired[Mapping[str, Any] | None]
2516
+ """
2517
+ Configuration options to pass to the global function (e.g., for preprocessor customization)
2518
+ """
2519
+
2520
+
2521
+ class FunctionIdFunctionId2(TypedDict):
2522
+ global_function: str
2523
+ """
2524
+ The name of the global function. Currently, the global namespace includes the functions in autoevals
2525
+ """
2526
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
2527
+
2528
+
2529
+ class InvokeFunctionInvokeFunction2(TypedDict):
2530
+ global_function: str
2531
+ """
2532
+ The name of the global function. Currently, the global namespace includes the functions in autoevals
2533
+ """
2534
+ function_type: NotRequired[NullableFunctionTypeEnum | None]
2535
+
2536
+
2537
+ InvokeScope: TypeAlias = SpanScope | TraceScope
2479
2538
  """
2480
2539
  The scope at which to operate (span or trace)
2481
2540
  """
2482
2541
 
2483
2542
 
2484
2543
  class ModelParamsModelParams(TypedDict):
2485
- use_cache: NotRequired[Optional[bool]]
2486
- reasoning_enabled: NotRequired[Optional[bool]]
2487
- reasoning_budget: NotRequired[Optional[float]]
2488
- temperature: NotRequired[Optional[float]]
2489
- top_p: NotRequired[Optional[float]]
2490
- max_tokens: NotRequired[Optional[float]]
2491
- max_completion_tokens: NotRequired[Optional[float]]
2544
+ use_cache: NotRequired[bool | None]
2545
+ reasoning_enabled: NotRequired[bool | None]
2546
+ reasoning_budget: NotRequired[float | None]
2547
+ temperature: NotRequired[float | None]
2548
+ top_p: NotRequired[float | None]
2549
+ max_tokens: NotRequired[float | None]
2550
+ max_completion_tokens: NotRequired[float | None]
2492
2551
  """
2493
2552
  The successor to max_tokens
2494
2553
  """
2495
- frequency_penalty: NotRequired[Optional[float]]
2496
- presence_penalty: NotRequired[Optional[float]]
2497
- response_format: NotRequired[Optional[ResponseFormatNullish]]
2554
+ frequency_penalty: NotRequired[float | None]
2555
+ presence_penalty: NotRequired[float | None]
2556
+ response_format: NotRequired[ResponseFormatNullish | None]
2498
2557
  tool_choice: NotRequired[
2499
- Union[Literal['auto'], Literal['none'], Literal['required'], ModelParamsModelParamsToolChoice]
2558
+ Literal['auto'] | Literal['none'] | Literal['required'] | ModelParamsModelParamsToolChoice
2500
2559
  ]
2501
- function_call: NotRequired[Optional[Union[Literal['auto'], Literal['none'], ModelParamsModelParamsFunctionCall]]]
2502
- n: NotRequired[Optional[float]]
2503
- stop: NotRequired[Optional[Sequence[str]]]
2504
- reasoning_effort: NotRequired[Optional[Literal['none', 'minimal', 'low', 'medium', 'high']]]
2505
- verbosity: NotRequired[Optional[Literal['low', 'medium', 'high']]]
2506
-
2507
-
2508
- ModelParams: TypeAlias = Union[
2509
- ModelParamsModelParams,
2510
- ModelParamsModelParams1,
2511
- ModelParamsModelParams2,
2512
- ModelParamsModelParams3,
2513
- ModelParamsModelParams4,
2514
- ]
2560
+ function_call: NotRequired[Literal['auto'] | Literal['none'] | ModelParamsModelParamsFunctionCall | None]
2561
+ n: NotRequired[float | None]
2562
+ stop: NotRequired[Sequence[str] | None]
2563
+ reasoning_effort: NotRequired[Literal['none', 'minimal', 'low', 'medium', 'high'] | None]
2564
+ verbosity: NotRequired[Literal['low', 'medium', 'high'] | None]
2565
+
2566
+
2567
+ ModelParams: TypeAlias = (
2568
+ ModelParamsModelParams
2569
+ | ModelParamsModelParams1
2570
+ | ModelParamsModelParams2
2571
+ | ModelParamsModelParams3
2572
+ | ModelParamsModelParams4
2573
+ )
2515
2574
 
2516
2575
 
2517
2576
  class OnlineScoreConfig(TypedDict):
@@ -2523,19 +2582,19 @@ class OnlineScoreConfig(TypedDict):
2523
2582
  """
2524
2583
  The list of scorers to use for online scoring
2525
2584
  """
2526
- btql_filter: NotRequired[Optional[str]]
2585
+ btql_filter: NotRequired[str | None]
2527
2586
  """
2528
2587
  Filter logs using BTQL
2529
2588
  """
2530
- apply_to_root_span: NotRequired[Optional[bool]]
2589
+ apply_to_root_span: NotRequired[bool | None]
2531
2590
  """
2532
2591
  Whether to trigger online scoring on the root span of each trace
2533
2592
  """
2534
- apply_to_span_names: NotRequired[Optional[Sequence[str]]]
2593
+ apply_to_span_names: NotRequired[Sequence[str] | None]
2535
2594
  """
2536
2595
  Trigger online scoring on any spans with a name in this list
2537
2596
  """
2538
- skip_logging: NotRequired[Optional[bool]]
2597
+ skip_logging: NotRequired[bool | None]
2539
2598
  """
2540
2599
  Whether to skip adding scorer spans when computing scores
2541
2600
  """
@@ -2554,19 +2613,23 @@ class Project(TypedDict):
2554
2613
  """
2555
2614
  Name of the project
2556
2615
  """
2557
- created: NotRequired[Optional[str]]
2616
+ description: NotRequired[str | None]
2617
+ """
2618
+ Textual description of the project
2619
+ """
2620
+ created: NotRequired[str | None]
2558
2621
  """
2559
2622
  Date of project creation
2560
2623
  """
2561
- deleted_at: NotRequired[Optional[str]]
2624
+ deleted_at: NotRequired[str | None]
2562
2625
  """
2563
2626
  Date of project deletion, or null if the project is still active
2564
2627
  """
2565
- user_id: NotRequired[Optional[str]]
2628
+ user_id: NotRequired[str | None]
2566
2629
  """
2567
2630
  Identifies the user who created the project
2568
2631
  """
2569
- settings: NotRequired[Optional[ProjectSettings]]
2632
+ settings: NotRequired[ProjectSettings | None]
2570
2633
 
2571
2634
 
2572
2635
  class ProjectAutomationConfig2(TypedDict):
@@ -2590,11 +2653,11 @@ class ProjectAutomation(TypedDict):
2590
2653
  """
2591
2654
  Unique identifier for the project that the project automation belongs under
2592
2655
  """
2593
- user_id: NotRequired[Optional[str]]
2656
+ user_id: NotRequired[str | None]
2594
2657
  """
2595
2658
  Identifies the user who created the project automation
2596
2659
  """
2597
- created: NotRequired[Optional[str]]
2660
+ created: NotRequired[str | None]
2598
2661
  """
2599
2662
  Date of project automation creation
2600
2663
  """
@@ -2602,55 +2665,55 @@ class ProjectAutomation(TypedDict):
2602
2665
  """
2603
2666
  Name of the project automation
2604
2667
  """
2605
- description: NotRequired[Optional[str]]
2668
+ description: NotRequired[str | None]
2606
2669
  """
2607
2670
  Textual description of the project automation
2608
2671
  """
2609
- config: Union[ProjectAutomationConfig, ProjectAutomationConfig1, ProjectAutomationConfig2]
2672
+ config: ProjectAutomationConfig | ProjectAutomationConfig1 | ProjectAutomationConfig2 | ProjectAutomationConfig3
2610
2673
  """
2611
2674
  The configuration for the automation rule
2612
2675
  """
2613
2676
 
2614
2677
 
2615
- ProjectScoreCategories: TypeAlias = Optional[Union[Sequence[ProjectScoreCategory], Mapping[str, float], Sequence[str]]]
2678
+ ProjectScoreCategories: TypeAlias = Sequence[ProjectScoreCategory] | Mapping[str, float] | Sequence[str] | None
2616
2679
 
2617
2680
 
2618
2681
  class ProjectScoreConfig(TypedDict):
2619
- multi_select: NotRequired[Optional[bool]]
2620
- destination: NotRequired[Optional[str]]
2621
- online: NotRequired[Optional[OnlineScoreConfig]]
2682
+ multi_select: NotRequired[bool | None]
2683
+ destination: NotRequired[str | None]
2684
+ online: NotRequired[OnlineScoreConfig | None]
2622
2685
 
2623
2686
 
2624
2687
  class PromptBlockDataPromptBlockData(TypedDict):
2625
2688
  type: Literal['chat']
2626
2689
  messages: Sequence[ChatCompletionMessageParam]
2627
- tools: NotRequired[Optional[str]]
2690
+ tools: NotRequired[str | None]
2628
2691
 
2629
2692
 
2630
- PromptBlockData: TypeAlias = Union[PromptBlockDataPromptBlockData, PromptBlockDataPromptBlockData1]
2693
+ PromptBlockData: TypeAlias = PromptBlockDataPromptBlockData | PromptBlockDataPromptBlockData1
2631
2694
 
2632
2695
 
2633
2696
  class PromptBlockDataNullishPromptBlockDataNullish(TypedDict):
2634
2697
  type: Literal['chat']
2635
2698
  messages: Sequence[ChatCompletionMessageParam]
2636
- tools: NotRequired[Optional[str]]
2699
+ tools: NotRequired[str | None]
2637
2700
 
2638
2701
 
2639
- PromptBlockDataNullish: TypeAlias = Optional[
2640
- Union[PromptBlockDataNullishPromptBlockDataNullish, PromptBlockDataNullishPromptBlockDataNullish1]
2641
- ]
2702
+ PromptBlockDataNullish: TypeAlias = (
2703
+ PromptBlockDataNullishPromptBlockDataNullish | PromptBlockDataNullishPromptBlockDataNullish1 | None
2704
+ )
2642
2705
 
2643
2706
 
2644
2707
  class PromptOptions(TypedDict):
2645
- model: NotRequired[Optional[str]]
2646
- params: NotRequired[Optional[ModelParams]]
2647
- position: NotRequired[Optional[str]]
2708
+ model: NotRequired[str | None]
2709
+ params: NotRequired[ModelParams | None]
2710
+ position: NotRequired[str | None]
2648
2711
 
2649
2712
 
2650
2713
  class PromptOptionsNullish(TypedDict):
2651
- model: NotRequired[Optional[str]]
2652
- params: NotRequired[Optional[ModelParams]]
2653
- position: NotRequired[Optional[str]]
2714
+ model: NotRequired[str | None]
2715
+ params: NotRequired[ModelParams | None]
2716
+ position: NotRequired[str | None]
2654
2717
 
2655
2718
 
2656
2719
  class ResponseFormatResponseFormat1(TypedDict):
@@ -2658,22 +2721,22 @@ class ResponseFormatResponseFormat1(TypedDict):
2658
2721
  json_schema: ResponseFormatJsonSchema
2659
2722
 
2660
2723
 
2661
- ResponseFormat: TypeAlias = Union[
2662
- ResponseFormatResponseFormat, ResponseFormatResponseFormat1, ResponseFormatResponseFormat2
2663
- ]
2724
+ ResponseFormat: TypeAlias = (
2725
+ ResponseFormatResponseFormat | ResponseFormatResponseFormat1 | ResponseFormatResponseFormat2
2726
+ )
2664
2727
 
2665
2728
 
2666
2729
  class SpanAttributes(TypedDict):
2667
- name: NotRequired[Optional[str]]
2730
+ name: NotRequired[str | None]
2668
2731
  """
2669
2732
  Name of the span, for display purposes only
2670
2733
  """
2671
- type: NotRequired[Optional[SpanType]]
2734
+ type: NotRequired[SpanType | None]
2672
2735
 
2673
2736
 
2674
2737
  class ViewData(TypedDict):
2675
- search: NotRequired[Optional[ViewDataSearch]]
2676
- custom_charts: NotRequired[Optional[Any]]
2738
+ search: NotRequired[ViewDataSearch | None]
2739
+ custom_charts: NotRequired[Any | None]
2677
2740
 
2678
2741
 
2679
2742
  class ExperimentEvent(TypedDict):
@@ -2689,7 +2752,7 @@ class ExperimentEvent(TypedDict):
2689
2752
  """
2690
2753
  The timestamp the experiment event was created
2691
2754
  """
2692
- _pagination_key: NotRequired[Optional[str]]
2755
+ _pagination_key: NotRequired[str | None]
2693
2756
  """
2694
2757
  A stable, time-ordered key that can be used to paginate over experiment events. This field is auto-generated by Braintrust and only exists in Brainstore.
2695
2758
  """
@@ -2701,39 +2764,39 @@ class ExperimentEvent(TypedDict):
2701
2764
  """
2702
2765
  Unique identifier for the experiment
2703
2766
  """
2704
- input: NotRequired[Optional[Any]]
2767
+ input: NotRequired[Any | None]
2705
2768
  """
2706
2769
  The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the `input` to know whether two test cases are the same between experiments, so they should not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the `input` should be identical
2707
2770
  """
2708
- output: NotRequired[Optional[Any]]
2771
+ output: NotRequired[Any | None]
2709
2772
  """
2710
2773
  The output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the `output` should be the _result_ of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question
2711
2774
  """
2712
- expected: NotRequired[Optional[Any]]
2775
+ expected: NotRequired[Any | None]
2713
2776
  """
2714
2777
  The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to determine if your `output` value is correct or not. Braintrust currently does not compare `output` to `expected` for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models
2715
2778
  """
2716
- error: NotRequired[Optional[Any]]
2779
+ error: NotRequired[Any | None]
2717
2780
  """
2718
2781
  The error that occurred, if any.
2719
2782
  """
2720
- scores: NotRequired[Optional[Mapping[str, Any]]]
2783
+ scores: NotRequired[Mapping[str, Any] | None]
2721
2784
  """
2722
2785
  A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was covering similar concepts or not. You can use these scores to help you sort, filter, and compare experiments
2723
2786
  """
2724
- metadata: NotRequired[Optional[ExperimentEventMetadata]]
2787
+ metadata: NotRequired[ExperimentEventMetadata | None]
2725
2788
  """
2726
2789
  A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings
2727
2790
  """
2728
- tags: NotRequired[Optional[Sequence[str]]]
2791
+ tags: NotRequired[Sequence[str] | None]
2729
2792
  """
2730
2793
  A list of tags to log
2731
2794
  """
2732
- metrics: NotRequired[Optional[ExperimentEventMetrics]]
2795
+ metrics: NotRequired[ExperimentEventMetrics | None]
2733
2796
  """
2734
2797
  Metrics are numerical measurements tracking the execution of the code that produced the experiment event. Use "start" and "end" to track the time span over which the experiment event was produced
2735
2798
  """
2736
- context: NotRequired[Optional[ExperimentEventContext]]
2799
+ context: NotRequired[ExperimentEventContext | None]
2737
2800
  """
2738
2801
  Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event
2739
2802
  """
@@ -2741,7 +2804,7 @@ class ExperimentEvent(TypedDict):
2741
2804
  """
2742
2805
  A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full details on tracing
2743
2806
  """
2744
- span_parents: NotRequired[Optional[Sequence[str]]]
2807
+ span_parents: NotRequired[Sequence[str] | None]
2745
2808
  """
2746
2809
  An array of the parent `span_ids` of this experiment event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans
2747
2810
  """
@@ -2749,28 +2812,28 @@ class ExperimentEvent(TypedDict):
2749
2812
  """
2750
2813
  A unique identifier for the trace this experiment event belongs to
2751
2814
  """
2752
- span_attributes: NotRequired[Optional[SpanAttributes]]
2753
- is_root: NotRequired[Optional[bool]]
2815
+ span_attributes: NotRequired[SpanAttributes | None]
2816
+ is_root: NotRequired[bool | None]
2754
2817
  """
2755
2818
  Whether this span is a root span
2756
2819
  """
2757
- origin: NotRequired[Optional[ObjectReferenceNullish]]
2758
- comments: NotRequired[Optional[Sequence[Any]]]
2820
+ origin: NotRequired[ObjectReferenceNullish | None]
2821
+ comments: NotRequired[Sequence[Any] | None]
2759
2822
  """
2760
2823
  Optional list of comments attached to this event
2761
2824
  """
2762
- audit_data: NotRequired[Optional[Sequence[Any]]]
2825
+ audit_data: NotRequired[Sequence[Any] | None]
2763
2826
  """
2764
2827
  Optional list of audit entries attached to this event
2765
2828
  """
2766
2829
 
2767
2830
 
2768
2831
  class GraphNodeGraphNode7(TypedDict):
2769
- description: NotRequired[Optional[str]]
2832
+ description: NotRequired[str | None]
2770
2833
  """
2771
2834
  The description of the node
2772
2835
  """
2773
- position: NotRequired[Optional[GraphNodeGraphNode7Position]]
2836
+ position: NotRequired[GraphNodeGraphNode7Position | None]
2774
2837
  """
2775
2838
  The position of the node
2776
2839
  """
@@ -2778,16 +2841,16 @@ class GraphNodeGraphNode7(TypedDict):
2778
2841
  prompt: PromptBlockData
2779
2842
 
2780
2843
 
2781
- GraphNode: TypeAlias = Union[
2782
- GraphNodeGraphNode,
2783
- GraphNodeGraphNode1,
2784
- GraphNodeGraphNode2,
2785
- GraphNodeGraphNode3,
2786
- GraphNodeGraphNode4,
2787
- GraphNodeGraphNode5,
2788
- GraphNodeGraphNode6,
2789
- GraphNodeGraphNode7,
2790
- ]
2844
+ GraphNode: TypeAlias = (
2845
+ GraphNodeGraphNode
2846
+ | GraphNodeGraphNode1
2847
+ | GraphNodeGraphNode2
2848
+ | GraphNodeGraphNode3
2849
+ | GraphNodeGraphNode4
2850
+ | GraphNodeGraphNode5
2851
+ | GraphNodeGraphNode6
2852
+ | GraphNodeGraphNode7
2853
+ )
2791
2854
 
2792
2855
 
2793
2856
  class InvokeContext(TypedDict):
@@ -2803,42 +2866,42 @@ class InvokeContext(TypedDict):
2803
2866
 
2804
2867
 
2805
2868
  class InvokeFunctionInvokeFunction7(TypedDict):
2806
- input: NotRequired[Optional[Any]]
2869
+ input: NotRequired[Any | None]
2807
2870
  """
2808
2871
  Argument to the function, which can be any JSON serializable value
2809
2872
  """
2810
- expected: NotRequired[Optional[Any]]
2873
+ expected: NotRequired[Any | None]
2811
2874
  """
2812
2875
  The expected output of the function
2813
2876
  """
2814
- metadata: NotRequired[Optional[Mapping[str, Any]]]
2877
+ metadata: NotRequired[Mapping[str, Any] | None]
2815
2878
  """
2816
2879
  Any relevant metadata. This will be logged and available as the `metadata` argument.
2817
2880
  """
2818
- tags: NotRequired[Optional[Sequence[str]]]
2881
+ tags: NotRequired[Sequence[str] | None]
2819
2882
  """
2820
2883
  Any relevant tags to log on the span.
2821
2884
  """
2822
- messages: NotRequired[Optional[Sequence[ChatCompletionMessageParam]]]
2885
+ messages: NotRequired[Sequence[ChatCompletionMessageParam] | None]
2823
2886
  """
2824
2887
  If the function is an LLM, additional messages to pass along to it
2825
2888
  """
2826
- context: NotRequired[Optional[InvokeContext]]
2827
- parent: NotRequired[Optional[InvokeParent]]
2828
- stream: NotRequired[Optional[bool]]
2889
+ context: NotRequired[InvokeContext | None]
2890
+ parent: NotRequired[InvokeParent | None]
2891
+ stream: NotRequired[bool | None]
2829
2892
  """
2830
2893
  Whether to stream the response. If true, results will be returned in the Braintrust SSE format.
2831
2894
  """
2832
- mode: NotRequired[Optional[StreamingMode]]
2833
- strict: NotRequired[Optional[bool]]
2895
+ mode: NotRequired[StreamingMode | None]
2896
+ strict: NotRequired[bool | None]
2834
2897
  """
2835
2898
  If true, throw an error if one of the variables in the prompt is not present in the input
2836
2899
  """
2837
- mcp_auth: NotRequired[Optional[Mapping[str, InvokeFunctionMcpAuth]]]
2900
+ mcp_auth: NotRequired[Mapping[str, InvokeFunctionMcpAuth] | None]
2838
2901
  """
2839
2902
  Map of MCP server URL to auth credentials
2840
2903
  """
2841
- overrides: NotRequired[Optional[Mapping[str, Any]]]
2904
+ overrides: NotRequired[Mapping[str, Any] | None]
2842
2905
  """
2843
2906
  Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }.
2844
2907
  """
@@ -2873,7 +2936,7 @@ class ProjectLogsEvent(TypedDict):
2873
2936
  """
2874
2937
  The transaction id of an event is unique to the network operation that processed the event insertion. Transaction ids are monotonically increasing over time and can be used to retrieve a versioned snapshot of the project logs (see the `version` parameter)
2875
2938
  """
2876
- _pagination_key: NotRequired[Optional[str]]
2939
+ _pagination_key: NotRequired[str | None]
2877
2940
  """
2878
2941
  A stable, time-ordered key that can be used to paginate over project logs events. This field is auto-generated by Braintrust and only exists in Brainstore.
2879
2942
  """
@@ -2893,39 +2956,39 @@ class ProjectLogsEvent(TypedDict):
2893
2956
  """
2894
2957
  A literal 'g' which identifies the log as a project log
2895
2958
  """
2896
- input: NotRequired[Optional[Any]]
2959
+ input: NotRequired[Any | None]
2897
2960
  """
2898
2961
  The arguments that uniquely define a user input (an arbitrary, JSON serializable object).
2899
2962
  """
2900
- output: NotRequired[Optional[Any]]
2963
+ output: NotRequired[Any | None]
2901
2964
  """
2902
2965
  The output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the `output` should be the _result_ of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question.
2903
2966
  """
2904
- expected: NotRequired[Optional[Any]]
2967
+ expected: NotRequired[Any | None]
2905
2968
  """
2906
2969
  The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to determine if your `output` value is correct or not. Braintrust currently does not compare `output` to `expected` for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models.
2907
2970
  """
2908
- error: NotRequired[Optional[Any]]
2971
+ error: NotRequired[Any | None]
2909
2972
  """
2910
2973
  The error that occurred, if any.
2911
2974
  """
2912
- scores: NotRequired[Optional[Mapping[str, Any]]]
2975
+ scores: NotRequired[Mapping[str, Any] | None]
2913
2976
  """
2914
2977
  A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was covering similar concepts or not. You can use these scores to help you sort, filter, and compare logs.
2915
2978
  """
2916
- metadata: NotRequired[Optional[ProjectLogsEventMetadata]]
2979
+ metadata: NotRequired[ProjectLogsEventMetadata | None]
2917
2980
  """
2918
2981
  A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings
2919
2982
  """
2920
- tags: NotRequired[Optional[Sequence[str]]]
2983
+ tags: NotRequired[Sequence[str] | None]
2921
2984
  """
2922
2985
  A list of tags to log
2923
2986
  """
2924
- metrics: NotRequired[Optional[ProjectLogsEventMetrics]]
2987
+ metrics: NotRequired[ProjectLogsEventMetrics | None]
2925
2988
  """
2926
2989
  Metrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced
2927
2990
  """
2928
- context: NotRequired[Optional[ProjectLogsEventContext]]
2991
+ context: NotRequired[ProjectLogsEventContext | None]
2929
2992
  """
2930
2993
  Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event
2931
2994
  """
@@ -2933,7 +2996,7 @@ class ProjectLogsEvent(TypedDict):
2933
2996
  """
2934
2997
  A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full details on tracing
2935
2998
  """
2936
- span_parents: NotRequired[Optional[Sequence[str]]]
2999
+ span_parents: NotRequired[Sequence[str] | None]
2937
3000
  """
2938
3001
  An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans
2939
3002
  """
@@ -2941,21 +3004,21 @@ class ProjectLogsEvent(TypedDict):
2941
3004
  """
2942
3005
  A unique identifier for the trace this project logs event belongs to
2943
3006
  """
2944
- is_root: NotRequired[Optional[bool]]
3007
+ is_root: NotRequired[bool | None]
2945
3008
  """
2946
3009
  Whether this span is a root span
2947
3010
  """
2948
- span_attributes: NotRequired[Optional[SpanAttributes]]
2949
- origin: NotRequired[Optional[ObjectReferenceNullish]]
2950
- comments: NotRequired[Optional[Sequence[Any]]]
3011
+ span_attributes: NotRequired[SpanAttributes | None]
3012
+ origin: NotRequired[ObjectReferenceNullish | None]
3013
+ comments: NotRequired[Sequence[Any] | None]
2951
3014
  """
2952
3015
  Optional list of comments attached to this event
2953
3016
  """
2954
- audit_data: NotRequired[Optional[Sequence[Any]]]
3017
+ audit_data: NotRequired[Sequence[Any] | None]
2955
3018
  """
2956
3019
  Optional list of audit entries attached to this event
2957
3020
  """
2958
- _async_scoring_state: NotRequired[Optional[Any]]
3021
+ _async_scoring_state: NotRequired[Any | None]
2959
3022
  """
2960
3023
  The async scoring state for this event
2961
3024
  """
@@ -2971,7 +3034,7 @@ class ProjectScore(TypedDict):
2971
3034
  Unique identifier for the project that the project score belongs under
2972
3035
  """
2973
3036
  user_id: str
2974
- created: NotRequired[Optional[str]]
3037
+ created: NotRequired[str | None]
2975
3038
  """
2976
3039
  Date of project score creation
2977
3040
  """
@@ -2979,42 +3042,44 @@ class ProjectScore(TypedDict):
2979
3042
  """
2980
3043
  Name of the project score
2981
3044
  """
2982
- description: NotRequired[Optional[str]]
3045
+ description: NotRequired[str | None]
2983
3046
  """
2984
3047
  Textual description of the project score
2985
3048
  """
2986
3049
  score_type: ProjectScoreType
2987
- categories: NotRequired[Optional[ProjectScoreCategories]]
2988
- config: NotRequired[Optional[ProjectScoreConfig]]
2989
- position: NotRequired[Optional[str]]
3050
+ categories: NotRequired[ProjectScoreCategories | None]
3051
+ config: NotRequired[ProjectScoreConfig | None]
3052
+ position: NotRequired[str | None]
2990
3053
  """
2991
3054
  An optional LexoRank-based string that sets the sort position for the score in the UI
2992
3055
  """
2993
3056
 
2994
3057
 
2995
3058
  class PromptData(TypedDict):
2996
- prompt: NotRequired[Optional[PromptBlockDataNullish]]
2997
- options: NotRequired[Optional[PromptOptionsNullish]]
2998
- parser: NotRequired[Optional[PromptParserNullish]]
2999
- tool_functions: NotRequired[Optional[Sequence[SavedFunctionId]]]
3000
- mcp: NotRequired[Optional[Mapping[str, Any]]]
3001
- origin: NotRequired[Optional[PromptDataOrigin]]
3059
+ prompt: NotRequired[PromptBlockDataNullish | None]
3060
+ options: NotRequired[PromptOptionsNullish | None]
3061
+ parser: NotRequired[PromptParserNullish | None]
3062
+ tool_functions: NotRequired[Sequence[SavedFunctionId] | None]
3063
+ template_format: NotRequired[Literal['mustache', 'nunjucks', 'none'] | None]
3064
+ mcp: NotRequired[Mapping[str, Any] | None]
3065
+ origin: NotRequired[PromptDataOrigin | None]
3002
3066
 
3003
3067
 
3004
3068
  class PromptDataNullish(TypedDict):
3005
- prompt: NotRequired[Optional[PromptBlockDataNullish]]
3006
- options: NotRequired[Optional[PromptOptionsNullish]]
3007
- parser: NotRequired[Optional[PromptParserNullish]]
3008
- tool_functions: NotRequired[Optional[Sequence[SavedFunctionId]]]
3009
- mcp: NotRequired[Optional[Mapping[str, Any]]]
3010
- origin: NotRequired[Optional[PromptDataNullishOrigin]]
3069
+ prompt: NotRequired[PromptBlockDataNullish | None]
3070
+ options: NotRequired[PromptOptionsNullish | None]
3071
+ parser: NotRequired[PromptParserNullish | None]
3072
+ tool_functions: NotRequired[Sequence[SavedFunctionId] | None]
3073
+ template_format: NotRequired[Literal['mustache', 'nunjucks', 'none'] | None]
3074
+ mcp: NotRequired[Mapping[str, Any] | None]
3075
+ origin: NotRequired[PromptDataNullishOrigin | None]
3011
3076
 
3012
3077
 
3013
3078
  class TaskTask5(TypedDict):
3014
- inline_prompt: NotRequired[Optional[PromptData]]
3079
+ inline_prompt: NotRequired[PromptData | None]
3015
3080
  inline_function: Mapping[str, Any]
3016
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3017
- name: NotRequired[Optional[str]]
3081
+ function_type: NotRequired[FunctionTypeEnum | None]
3082
+ name: NotRequired[str | None]
3018
3083
  """
3019
3084
  The name of the inline function
3020
3085
  """
@@ -3022,8 +3087,8 @@ class TaskTask5(TypedDict):
3022
3087
 
3023
3088
  class TaskTask6(TypedDict):
3024
3089
  inline_prompt: PromptData
3025
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3026
- name: NotRequired[Optional[str]]
3090
+ function_type: NotRequired[FunctionTypeEnum | None]
3091
+ name: NotRequired[str | None]
3027
3092
  """
3028
3093
  The name of the inline prompt
3029
3094
  """
@@ -3037,7 +3102,7 @@ class TaskTask14(TaskTask6, TaskTask7):
3037
3102
  pass
3038
3103
 
3039
3104
 
3040
- Task: TypeAlias = Union[TaskTask8, TaskTask9, TaskTask10, TaskTask11, TaskTask12, TaskTask13, TaskTask14]
3105
+ Task: TypeAlias = TaskTask8 | TaskTask9 | TaskTask10 | TaskTask11 | TaskTask12 | TaskTask13 | TaskTask14
3041
3106
 
3042
3107
 
3043
3108
  class View(TypedDict):
@@ -3045,7 +3110,7 @@ class View(TypedDict):
3045
3110
  """
3046
3111
  Unique identifier for the view
3047
3112
  """
3048
- object_type: Optional[AclObjectType]
3113
+ object_type: AclObjectType
3049
3114
  object_id: str
3050
3115
  """
3051
3116
  The id of the object the view applies to
@@ -3073,27 +3138,27 @@ class View(TypedDict):
3073
3138
  """
3074
3139
  Name of the view
3075
3140
  """
3076
- created: NotRequired[Optional[str]]
3141
+ created: NotRequired[str | None]
3077
3142
  """
3078
3143
  Date of view creation
3079
3144
  """
3080
- view_data: NotRequired[Optional[ViewData]]
3081
- options: NotRequired[Optional[ViewOptions]]
3082
- user_id: NotRequired[Optional[str]]
3145
+ view_data: NotRequired[ViewData | None]
3146
+ options: NotRequired[ViewOptions | None]
3147
+ user_id: NotRequired[str | None]
3083
3148
  """
3084
3149
  Identifies the user who created the view
3085
3150
  """
3086
- deleted_at: NotRequired[Optional[str]]
3151
+ deleted_at: NotRequired[str | None]
3087
3152
  """
3088
3153
  Date of role deletion, or null if the role is still active
3089
3154
  """
3090
3155
 
3091
3156
 
3092
3157
  class FunctionIdFunctionId5(TypedDict):
3093
- inline_prompt: NotRequired[Optional[PromptData]]
3158
+ inline_prompt: NotRequired[PromptData | None]
3094
3159
  inline_function: Mapping[str, Any]
3095
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3096
- name: NotRequired[Optional[str]]
3160
+ function_type: NotRequired[FunctionTypeEnum | None]
3161
+ name: NotRequired[str | None]
3097
3162
  """
3098
3163
  The name of the inline function
3099
3164
  """
@@ -3101,22 +3166,22 @@ class FunctionIdFunctionId5(TypedDict):
3101
3166
 
3102
3167
  class FunctionIdFunctionId6(TypedDict):
3103
3168
  inline_prompt: PromptData
3104
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3105
- name: NotRequired[Optional[str]]
3169
+ function_type: NotRequired[FunctionTypeEnum | None]
3170
+ name: NotRequired[str | None]
3106
3171
  """
3107
3172
  The name of the inline prompt
3108
3173
  """
3109
3174
 
3110
3175
 
3111
- FunctionId: TypeAlias = Union[
3112
- FunctionIdFunctionId,
3113
- FunctionIdFunctionId1,
3114
- FunctionIdFunctionId2,
3115
- FunctionIdFunctionId3,
3116
- FunctionIdFunctionId4,
3117
- FunctionIdFunctionId5,
3118
- FunctionIdFunctionId6,
3119
- ]
3176
+ FunctionId: TypeAlias = (
3177
+ FunctionIdFunctionId
3178
+ | FunctionIdFunctionId1
3179
+ | FunctionIdFunctionId2
3180
+ | FunctionIdFunctionId3
3181
+ | FunctionIdFunctionId4
3182
+ | FunctionIdFunctionId5
3183
+ | FunctionIdFunctionId6
3184
+ )
3120
3185
  """
3121
3186
  Options for identifying a function
3122
3187
  """
@@ -3129,10 +3194,10 @@ class GraphData(TypedDict):
3129
3194
 
3130
3195
 
3131
3196
  class InvokeFunctionInvokeFunction5(TypedDict):
3132
- inline_prompt: NotRequired[Optional[PromptData]]
3197
+ inline_prompt: NotRequired[PromptData | None]
3133
3198
  inline_function: Mapping[str, Any]
3134
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3135
- name: NotRequired[Optional[str]]
3199
+ function_type: NotRequired[FunctionTypeEnum | None]
3200
+ name: NotRequired[str | None]
3136
3201
  """
3137
3202
  The name of the inline function
3138
3203
  """
@@ -3140,8 +3205,8 @@ class InvokeFunctionInvokeFunction5(TypedDict):
3140
3205
 
3141
3206
  class InvokeFunctionInvokeFunction6(TypedDict):
3142
3207
  inline_prompt: PromptData
3143
- function_type: NotRequired[Optional[FunctionTypeEnum]]
3144
- name: NotRequired[Optional[str]]
3208
+ function_type: NotRequired[FunctionTypeEnum | None]
3209
+ name: NotRequired[str | None]
3145
3210
  """
3146
3211
  The name of the inline prompt
3147
3212
  """
@@ -3155,15 +3220,15 @@ class InvokeFunctionInvokeFunction14(InvokeFunctionInvokeFunction6, InvokeFuncti
3155
3220
  pass
3156
3221
 
3157
3222
 
3158
- InvokeFunction: TypeAlias = Union[
3159
- InvokeFunctionInvokeFunction8,
3160
- InvokeFunctionInvokeFunction9,
3161
- InvokeFunctionInvokeFunction10,
3162
- InvokeFunctionInvokeFunction11,
3163
- InvokeFunctionInvokeFunction12,
3164
- InvokeFunctionInvokeFunction13,
3165
- InvokeFunctionInvokeFunction14,
3166
- ]
3223
+ InvokeFunction: TypeAlias = (
3224
+ InvokeFunctionInvokeFunction8
3225
+ | InvokeFunctionInvokeFunction9
3226
+ | InvokeFunctionInvokeFunction10
3227
+ | InvokeFunctionInvokeFunction11
3228
+ | InvokeFunctionInvokeFunction12
3229
+ | InvokeFunctionInvokeFunction13
3230
+ | InvokeFunctionInvokeFunction14
3231
+ )
3167
3232
  """
3168
3233
  Options for identifying a function
3169
3234
  """
@@ -3198,24 +3263,24 @@ class Prompt(TypedDict):
3198
3263
  """
3199
3264
  Unique identifier for the prompt
3200
3265
  """
3201
- description: NotRequired[Optional[str]]
3266
+ description: NotRequired[str | None]
3202
3267
  """
3203
3268
  Textual description of the prompt
3204
3269
  """
3205
- created: NotRequired[Optional[str]]
3270
+ created: NotRequired[str | None]
3206
3271
  """
3207
3272
  Date of prompt creation
3208
3273
  """
3209
- prompt_data: NotRequired[Optional[PromptDataNullish]]
3210
- tags: NotRequired[Optional[Sequence[str]]]
3274
+ prompt_data: NotRequired[PromptDataNullish | None]
3275
+ tags: NotRequired[Sequence[str] | None]
3211
3276
  """
3212
3277
  A list of tags for the prompt
3213
3278
  """
3214
- metadata: NotRequired[Optional[Mapping[str, Any]]]
3279
+ metadata: NotRequired[Mapping[str, Any] | None]
3215
3280
  """
3216
3281
  User-controlled metadata about the prompt
3217
3282
  """
3218
- function_type: NotRequired[Optional[FunctionTypeEnumNullish]]
3283
+ function_type: NotRequired[FunctionTypeEnumNullish | None]
3219
3284
 
3220
3285
 
3221
3286
  class RunEval(TypedDict):
@@ -3223,7 +3288,7 @@ class RunEval(TypedDict):
3223
3288
  """
3224
3289
  Unique identifier for the project to run the eval in
3225
3290
  """
3226
- data: Union[RunEvalData, RunEvalData1, RunEvalData2]
3291
+ data: RunEvalData | RunEvalData1 | RunEvalData2
3227
3292
  """
3228
3293
  The dataset to use
3229
3294
  """
@@ -3232,72 +3297,72 @@ class RunEval(TypedDict):
3232
3297
  """
3233
3298
  The functions to score the eval on
3234
3299
  """
3235
- experiment_name: NotRequired[Optional[str]]
3300
+ experiment_name: NotRequired[str | None]
3236
3301
  """
3237
3302
  An optional name for the experiment created by this eval. If it conflicts with an existing experiment, it will be suffixed with a unique identifier.
3238
3303
  """
3239
- metadata: NotRequired[Optional[Mapping[str, Any]]]
3304
+ metadata: NotRequired[Mapping[str, Any] | None]
3240
3305
  """
3241
3306
  Optional experiment-level metadata to store about the evaluation. You can later use this to slice & dice across experiments.
3242
3307
  """
3243
- parent: NotRequired[Optional[Parent]]
3244
- stream: NotRequired[Optional[bool]]
3308
+ parent: NotRequired[Parent | None]
3309
+ stream: NotRequired[bool | None]
3245
3310
  """
3246
3311
  Whether to stream the results of the eval. If true, the request will return two events: one to indicate the experiment has started, and another upon completion. If false, the request will return the evaluation's summary upon completion.
3247
3312
  """
3248
- trial_count: NotRequired[Optional[float]]
3313
+ trial_count: NotRequired[float | None]
3249
3314
  """
3250
3315
  The number of times to run the evaluator per input. This is useful for evaluating applications that have non-deterministic behavior and gives you both a stronger aggregate measure and a sense of the variance in the results.
3251
3316
  """
3252
- is_public: NotRequired[Optional[bool]]
3317
+ is_public: NotRequired[bool | None]
3253
3318
  """
3254
3319
  Whether the experiment should be public. Defaults to false.
3255
3320
  """
3256
- timeout: NotRequired[Optional[float]]
3321
+ timeout: NotRequired[float | None]
3257
3322
  """
3258
3323
  The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout.
3259
3324
  """
3260
- max_concurrency: NotRequired[Optional[float]]
3325
+ max_concurrency: NotRequired[float | None]
3261
3326
  """
3262
3327
  The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used.
3263
3328
  """
3264
- base_experiment_name: NotRequired[Optional[str]]
3329
+ base_experiment_name: NotRequired[str | None]
3265
3330
  """
3266
3331
  An optional experiment name to use as a base. If specified, the new experiment will be summarized and compared to this experiment.
3267
3332
  """
3268
- base_experiment_id: NotRequired[Optional[str]]
3333
+ base_experiment_id: NotRequired[str | None]
3269
3334
  """
3270
3335
  An optional experiment id to use as a base. If specified, the new experiment will be summarized and compared to this experiment.
3271
3336
  """
3272
- git_metadata_settings: NotRequired[Optional[GitMetadataSettings]]
3273
- repo_info: NotRequired[Optional[RepoInfo]]
3274
- strict: NotRequired[Optional[bool]]
3337
+ git_metadata_settings: NotRequired[GitMetadataSettings | None]
3338
+ repo_info: NotRequired[RepoInfo | None]
3339
+ strict: NotRequired[bool | None]
3275
3340
  """
3276
3341
  If true, throw an error if one of the variables in the prompt is not present in the input
3277
3342
  """
3278
- stop_token: NotRequired[Optional[str]]
3343
+ stop_token: NotRequired[str | None]
3279
3344
  """
3280
3345
  The token to stop the run
3281
3346
  """
3282
- extra_messages: NotRequired[Optional[str]]
3347
+ extra_messages: NotRequired[str | None]
3283
3348
  """
3284
3349
  A template path of extra messages to append to the conversion. These messages will be appended to the end of the conversation, after the last message.
3285
3350
  """
3286
- tags: NotRequired[Optional[Sequence[str]]]
3351
+ tags: NotRequired[Sequence[str] | None]
3287
3352
  """
3288
3353
  Optional tags that will be added to the experiment.
3289
3354
  """
3290
- mcp_auth: NotRequired[Optional[Mapping[str, RunEvalMcpAuth]]]
3355
+ mcp_auth: NotRequired[Mapping[str, RunEvalMcpAuth] | None]
3291
3356
 
3292
3357
 
3293
- FunctionData: TypeAlias = Union[
3294
- FunctionDataFunctionData,
3295
- FunctionDataFunctionData1,
3296
- GraphData,
3297
- FunctionDataFunctionData2,
3298
- FunctionDataFunctionData3,
3299
- FacetData,
3300
- ]
3358
+ FunctionData: TypeAlias = (
3359
+ FunctionDataFunctionData
3360
+ | FunctionDataFunctionData1
3361
+ | GraphData
3362
+ | FunctionDataFunctionData2
3363
+ | FunctionDataFunctionData3
3364
+ | FacetData
3365
+ )
3301
3366
 
3302
3367
 
3303
3368
  class Function(TypedDict):
@@ -3329,27 +3394,27 @@ class Function(TypedDict):
3329
3394
  """
3330
3395
  Unique identifier for the prompt
3331
3396
  """
3332
- description: NotRequired[Optional[str]]
3397
+ description: NotRequired[str | None]
3333
3398
  """
3334
3399
  Textual description of the prompt
3335
3400
  """
3336
- created: NotRequired[Optional[str]]
3401
+ created: NotRequired[str | None]
3337
3402
  """
3338
3403
  Date of prompt creation
3339
3404
  """
3340
- prompt_data: NotRequired[Optional[PromptDataNullish]]
3341
- tags: NotRequired[Optional[Sequence[str]]]
3405
+ prompt_data: NotRequired[PromptDataNullish | None]
3406
+ tags: NotRequired[Sequence[str] | None]
3342
3407
  """
3343
3408
  A list of tags for the prompt
3344
3409
  """
3345
- metadata: NotRequired[Optional[Mapping[str, Any]]]
3410
+ metadata: NotRequired[Mapping[str, Any] | None]
3346
3411
  """
3347
3412
  User-controlled metadata about the prompt
3348
3413
  """
3349
- function_type: NotRequired[Optional[FunctionTypeEnumNullish]]
3414
+ function_type: NotRequired[FunctionTypeEnumNullish | None]
3350
3415
  function_data: FunctionData
3351
- origin: NotRequired[Optional[FunctionOrigin]]
3352
- function_schema: NotRequired[Optional[FunctionFunctionSchema]]
3416
+ origin: NotRequired[FunctionOrigin | None]
3417
+ function_schema: NotRequired[FunctionFunctionSchema | None]
3353
3418
  """
3354
3419
  JSON schema for the function's parameters and return type
3355
3420
  """