braintrust 0.3.8__tar.gz → 0.3.9__tar.gz
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.
- {braintrust-0.3.8 → braintrust-0.3.9}/PKG-INFO +1 -1
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/_generated_types.py +52 -9
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/framework2.py +0 -1
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/generated_types.py +5 -1
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/logger.py +12 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_logger.py +41 -1
- braintrust-0.3.9/src/braintrust/version.py +4 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/PKG-INFO +1 -1
- braintrust-0.3.8/src/braintrust/version.py +0 -4
- {braintrust-0.3.8 → braintrust-0.3.9}/README.md +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/setup.cfg +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/setup.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/audit.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/aws.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/bt_json.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/__main__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/eval.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/api.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/bump_versions.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/logs.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/redshift.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/install/run_migrations.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/cli/push.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/conftest.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/context.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/db_fields.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/auth.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/cors.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/dataset.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/eval_hooks.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/schemas.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/server.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/test_cached_login.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/test_lru_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/devserver/test_server_integration.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/framework.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/functions/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/functions/constants.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/functions/invoke.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/functions/stream.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/git_fields.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/gitutil.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/graph_util.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/http_headers.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/id_gen.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/merge_row_batch.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/oai.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/object.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/otel/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/otel/context.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/otel/test_distributed_tracing.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/otel/test_otel_bt_integration.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/parameters.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/disk_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/lru_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/prompt_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/test_disk_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/test_lru_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/prompt_cache/test_prompt_cache.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/py.typed +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/queue.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/resource_manager.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/score.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/serializable_data_class.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/span_identifier_v1.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/span_identifier_v2.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/span_identifier_v3.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/span_identifier_v4.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/span_types.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_framework.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_helpers.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_id_gen.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_otel.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_queue.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_serializable_data_class.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_span_components.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_util.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/test_version.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/util.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/_anthropic_utils.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/agent.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/function_call.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/model.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/team.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/agno/utils.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/anthropic.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/claude_agent_sdk/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/claude_agent_sdk/_wrapper.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/claude_agent_sdk/test_wrapper.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/dspy.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/google_genai/__init__.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/langchain.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/litellm.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/openai.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_agno.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_anthropic.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_dspy.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_google_genai.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_litellm.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_openai.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_pydantic_ai.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/test_utils.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/xact_ids.py +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/SOURCES.txt +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/dependency_links.txt +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/entry_points.txt +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/requires.txt +0 -0
- {braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust.egg-info/top_level.txt +0 -0
|
@@ -212,6 +212,17 @@ CallEvent = Union[
|
|
|
212
212
|
]
|
|
213
213
|
|
|
214
214
|
|
|
215
|
+
class ChatCompletionContentPartFileFile(TypedDict):
|
|
216
|
+
file_data: NotRequired[Optional[str]]
|
|
217
|
+
filename: NotRequired[Optional[str]]
|
|
218
|
+
file_id: NotRequired[Optional[str]]
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class ChatCompletionContentPartFileWithTitle(TypedDict):
|
|
222
|
+
file: ChatCompletionContentPartFileFile
|
|
223
|
+
type: Literal['file']
|
|
224
|
+
|
|
225
|
+
|
|
215
226
|
class ChatCompletionContentPartImageWithTitleImageUrl(TypedDict):
|
|
216
227
|
url: str
|
|
217
228
|
detail: NotRequired[Optional[Union[Literal['auto'], Literal['low'], Literal['high']]]]
|
|
@@ -342,7 +353,7 @@ class ChatCompletionTool(TypedDict):
|
|
|
342
353
|
|
|
343
354
|
|
|
344
355
|
class CodeBundleRuntimeContext(TypedDict):
|
|
345
|
-
runtime: Literal['node', 'python']
|
|
356
|
+
runtime: Literal['node', 'python', 'browser']
|
|
346
357
|
version: str
|
|
347
358
|
|
|
348
359
|
|
|
@@ -570,7 +581,7 @@ class Data(CodeBundle):
|
|
|
570
581
|
|
|
571
582
|
|
|
572
583
|
class FunctionDataFunctionData1DataRuntimeContext(TypedDict):
|
|
573
|
-
runtime: Literal['node', 'python']
|
|
584
|
+
runtime: Literal['node', 'python', 'browser']
|
|
574
585
|
version: str
|
|
575
586
|
|
|
576
587
|
|
|
@@ -649,7 +660,7 @@ class FunctionIdFunctionId3(TypedDict):
|
|
|
649
660
|
|
|
650
661
|
|
|
651
662
|
class FunctionIdFunctionId4InlineContext(TypedDict):
|
|
652
|
-
runtime: Literal['node', 'python']
|
|
663
|
+
runtime: Literal['node', 'python', 'browser']
|
|
653
664
|
version: str
|
|
654
665
|
|
|
655
666
|
|
|
@@ -668,16 +679,16 @@ class FunctionIdFunctionId4(TypedDict):
|
|
|
668
679
|
FunctionIdRef = Mapping[str, Any]
|
|
669
680
|
|
|
670
681
|
|
|
671
|
-
FunctionObjectType = Literal['prompt', 'tool', 'scorer', 'task', 'agent']
|
|
682
|
+
FunctionObjectType = Literal['prompt', 'tool', 'scorer', 'task', 'agent', 'custom_view']
|
|
672
683
|
|
|
673
684
|
|
|
674
685
|
FunctionOutputType = Literal['completion', 'score', 'any']
|
|
675
686
|
|
|
676
687
|
|
|
677
|
-
FunctionTypeEnum = Literal['llm', 'scorer', 'task', 'tool']
|
|
688
|
+
FunctionTypeEnum = Literal['llm', 'scorer', 'task', 'tool', 'custom_view']
|
|
678
689
|
|
|
679
690
|
|
|
680
|
-
FunctionTypeEnumNullish = Literal['llm', 'scorer', 'task', 'tool']
|
|
691
|
+
FunctionTypeEnumNullish = Literal['llm', 'scorer', 'task', 'tool', 'custom_view']
|
|
681
692
|
|
|
682
693
|
|
|
683
694
|
class GitMetadataSettings(TypedDict):
|
|
@@ -1854,7 +1865,7 @@ class AnyModelParams(TypedDict):
|
|
|
1854
1865
|
function_call: NotRequired[Optional[Union[Literal['auto'], Literal['none'], AnyModelParamsFunctionCall]]]
|
|
1855
1866
|
n: NotRequired[Optional[float]]
|
|
1856
1867
|
stop: NotRequired[Optional[Sequence[str]]]
|
|
1857
|
-
reasoning_effort: NotRequired[Optional[Literal['minimal', 'low', 'medium', 'high']]]
|
|
1868
|
+
reasoning_effort: NotRequired[Optional[Literal['none', 'minimal', 'low', 'medium', 'high']]]
|
|
1858
1869
|
verbosity: NotRequired[Optional[Literal['low', 'medium', 'high']]]
|
|
1859
1870
|
top_k: NotRequired[Optional[float]]
|
|
1860
1871
|
stop_sequences: NotRequired[Optional[Sequence[str]]]
|
|
@@ -1894,7 +1905,11 @@ class AttachmentStatus(TypedDict):
|
|
|
1894
1905
|
"""
|
|
1895
1906
|
|
|
1896
1907
|
|
|
1897
|
-
ChatCompletionContentPart = Union[
|
|
1908
|
+
ChatCompletionContentPart = Union[
|
|
1909
|
+
ChatCompletionContentPartTextWithTitle,
|
|
1910
|
+
ChatCompletionContentPartImageWithTitle,
|
|
1911
|
+
ChatCompletionContentPartFileWithTitle,
|
|
1912
|
+
]
|
|
1898
1913
|
|
|
1899
1914
|
|
|
1900
1915
|
class ChatCompletionMessageParamChatCompletionMessageParam1(TypedDict):
|
|
@@ -1993,6 +2008,14 @@ class DatasetEvent(TypedDict):
|
|
|
1993
2008
|
Whether this span is a root span
|
|
1994
2009
|
"""
|
|
1995
2010
|
origin: NotRequired[Optional[ObjectReferenceNullish]]
|
|
2011
|
+
comments: NotRequired[Optional[Sequence[Any]]]
|
|
2012
|
+
"""
|
|
2013
|
+
Optional list of comments attached to this event
|
|
2014
|
+
"""
|
|
2015
|
+
audit_data: NotRequired[Optional[Sequence[Any]]]
|
|
2016
|
+
"""
|
|
2017
|
+
Optional list of audit entries attached to this event
|
|
2018
|
+
"""
|
|
1996
2019
|
|
|
1997
2020
|
|
|
1998
2021
|
class Experiment(TypedDict):
|
|
@@ -2075,7 +2098,7 @@ class ModelParamsModelParams(TypedDict):
|
|
|
2075
2098
|
function_call: NotRequired[Optional[Union[Literal['auto'], Literal['none'], ModelParamsModelParamsFunctionCall]]]
|
|
2076
2099
|
n: NotRequired[Optional[float]]
|
|
2077
2100
|
stop: NotRequired[Optional[Sequence[str]]]
|
|
2078
|
-
reasoning_effort: NotRequired[Optional[Literal['minimal', 'low', 'medium', 'high']]]
|
|
2101
|
+
reasoning_effort: NotRequired[Optional[Literal['none', 'minimal', 'low', 'medium', 'high']]]
|
|
2079
2102
|
verbosity: NotRequired[Optional[Literal['low', 'medium', 'high']]]
|
|
2080
2103
|
|
|
2081
2104
|
|
|
@@ -2327,6 +2350,14 @@ class ExperimentEvent(TypedDict):
|
|
|
2327
2350
|
Whether this span is a root span
|
|
2328
2351
|
"""
|
|
2329
2352
|
origin: NotRequired[Optional[ObjectReferenceNullish]]
|
|
2353
|
+
comments: NotRequired[Optional[Sequence[Any]]]
|
|
2354
|
+
"""
|
|
2355
|
+
Optional list of comments attached to this event
|
|
2356
|
+
"""
|
|
2357
|
+
audit_data: NotRequired[Optional[Sequence[Any]]]
|
|
2358
|
+
"""
|
|
2359
|
+
Optional list of audit entries attached to this event
|
|
2360
|
+
"""
|
|
2330
2361
|
|
|
2331
2362
|
|
|
2332
2363
|
class GraphNodeGraphNode7(TypedDict):
|
|
@@ -2437,6 +2468,18 @@ class ProjectLogsEvent(TypedDict):
|
|
|
2437
2468
|
"""
|
|
2438
2469
|
span_attributes: NotRequired[Optional[SpanAttributes]]
|
|
2439
2470
|
origin: NotRequired[Optional[ObjectReferenceNullish]]
|
|
2471
|
+
comments: NotRequired[Optional[Sequence[Any]]]
|
|
2472
|
+
"""
|
|
2473
|
+
Optional list of comments attached to this event
|
|
2474
|
+
"""
|
|
2475
|
+
audit_data: NotRequired[Optional[Sequence[Any]]]
|
|
2476
|
+
"""
|
|
2477
|
+
Optional list of audit entries attached to this event
|
|
2478
|
+
"""
|
|
2479
|
+
_async_scoring_state: NotRequired[Optional[Any]]
|
|
2480
|
+
"""
|
|
2481
|
+
The async scoring state for this event
|
|
2482
|
+
"""
|
|
2440
2483
|
|
|
2441
2484
|
|
|
2442
2485
|
class ProjectScore(TypedDict):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Auto-generated file (internal git SHA
|
|
1
|
+
"""Auto-generated file (internal git SHA 8e9c0a96b3cf291360978c17580f72f6817bd6c8) -- do not modify"""
|
|
2
2
|
|
|
3
3
|
from ._generated_types import (
|
|
4
4
|
Acl,
|
|
@@ -14,6 +14,8 @@ from ._generated_types import (
|
|
|
14
14
|
BraintrustModelParams,
|
|
15
15
|
CallEvent,
|
|
16
16
|
ChatCompletionContentPart,
|
|
17
|
+
ChatCompletionContentPartFileFile,
|
|
18
|
+
ChatCompletionContentPartFileWithTitle,
|
|
17
19
|
ChatCompletionContentPartImageWithTitle,
|
|
18
20
|
ChatCompletionContentPartText,
|
|
19
21
|
ChatCompletionContentPartTextWithTitle,
|
|
@@ -111,6 +113,8 @@ __all__ = [
|
|
|
111
113
|
"BraintrustModelParams",
|
|
112
114
|
"CallEvent",
|
|
113
115
|
"ChatCompletionContentPart",
|
|
116
|
+
"ChatCompletionContentPartFileFile",
|
|
117
|
+
"ChatCompletionContentPartFileWithTitle",
|
|
114
118
|
"ChatCompletionContentPartImageWithTitle",
|
|
115
119
|
"ChatCompletionContentPartText",
|
|
116
120
|
"ChatCompletionContentPartTextWithTitle",
|
|
@@ -4488,6 +4488,18 @@ def render_message(render: Callable[[str], str], message: PromptMessage):
|
|
|
4488
4488
|
"image_url": {**c["image_url"], "url": render(c["image_url"]["url"])},
|
|
4489
4489
|
}
|
|
4490
4490
|
)
|
|
4491
|
+
elif c["type"] == "file":
|
|
4492
|
+
rendered_content.append(
|
|
4493
|
+
{
|
|
4494
|
+
**c,
|
|
4495
|
+
"file": {
|
|
4496
|
+
**c["file"],
|
|
4497
|
+
"file_data": render(c["file"]["file_data"]),
|
|
4498
|
+
**({} if "file_id" not in c["file"] else {"file_id": render(c["file"]["file_id"])}),
|
|
4499
|
+
**({} if "filename" not in c["file"] else {"filename": render(c["file"]["filename"])}),
|
|
4500
|
+
},
|
|
4501
|
+
}
|
|
4502
|
+
)
|
|
4491
4503
|
else:
|
|
4492
4504
|
raise ValueError(f"Unknown content type: {c['type']}")
|
|
4493
4505
|
|
|
@@ -20,7 +20,7 @@ from braintrust import (
|
|
|
20
20
|
logger,
|
|
21
21
|
)
|
|
22
22
|
from braintrust.id_gen import OTELIDGenerator, get_id_generator
|
|
23
|
-
from braintrust.logger import _deep_copy_event, _extract_attachments, parent_context, render_mustache
|
|
23
|
+
from braintrust.logger import _deep_copy_event, _extract_attachments, parent_context, render_message, render_mustache
|
|
24
24
|
from braintrust.prompt import PromptChatBlock, PromptData, PromptMessage, PromptSchema
|
|
25
25
|
from braintrust.test_helpers import (
|
|
26
26
|
assert_dict_matches,
|
|
@@ -485,6 +485,46 @@ class TestLogger(TestCase):
|
|
|
485
485
|
with self.assertRaises(ValueError):
|
|
486
486
|
prompt.build(items=["only_one"], strict=True)
|
|
487
487
|
|
|
488
|
+
def test_render_message_with_file_content_parts(self):
|
|
489
|
+
"""Test render_message with mixed text, image, and file content parts including all file fields."""
|
|
490
|
+
message = PromptMessage(
|
|
491
|
+
role="user",
|
|
492
|
+
content=[
|
|
493
|
+
{"type": "text", "text": "Here is a {{item}}:"},
|
|
494
|
+
{"type": "image_url", "image_url": {"url": "{{image_url}}"}},
|
|
495
|
+
{
|
|
496
|
+
"type": "file",
|
|
497
|
+
"file": {
|
|
498
|
+
"file_data": "{{file_data}}",
|
|
499
|
+
"file_id": "{{file_id}}",
|
|
500
|
+
"filename": "{{filename}}",
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
],
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
rendered = render_message(
|
|
507
|
+
lambda template: template.replace("{{item}}", "document")
|
|
508
|
+
.replace("{{image_url}}", "https://example.com/image.png")
|
|
509
|
+
.replace("{{file_data}}", "base64data")
|
|
510
|
+
.replace("{{file_id}}", "file-456")
|
|
511
|
+
.replace("{{filename}}", "report.pdf"),
|
|
512
|
+
message,
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
assert rendered["content"] == [
|
|
516
|
+
{"type": "text", "text": "Here is a document:"},
|
|
517
|
+
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
|
518
|
+
{
|
|
519
|
+
"type": "file",
|
|
520
|
+
"file": {
|
|
521
|
+
"file_data": "base64data",
|
|
522
|
+
"file_id": "file-456",
|
|
523
|
+
"filename": "report.pdf",
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
]
|
|
527
|
+
|
|
488
528
|
|
|
489
529
|
def test_noop_permalink_issue_1837():
|
|
490
530
|
# fixes issue #BRA-1837
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{braintrust-0.3.8 → braintrust-0.3.9}/src/braintrust/wrappers/claude_agent_sdk/test_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|