Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added py/src/braintrust/fixtures/decision-video.mp4
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,22 @@
instrumentation="litellm-auto",
)

with autoinstrument_test_context("test_litellm_systemone_metrics[async]", integration="litellm") as memory_logger:
response = asyncio.run(
litellm.asystemone(
f"openai/{DECISIONS_MODEL}",
DECISIONS_INPUT,
{"positive": {"type": "noul", "instructions": "Is the sentiment positive?"}},
)
)
spans = memory_logger.pop()
assert len(spans) == 1
span = spans[0]
assert span["span_attributes"]["type"] == "decision"
assert span["input"]["state"] == DECISIONS_INPUT
assert span["output"]["answers"] == [
{"id": "positive", "type": "noul", "noul": response.answers["positive"].noul}
]
assert span["context"]["span_origin"]["instrumentation"]["name"] == "litellm-auto"

print("SUCCESS")

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions py/src/braintrust/integrations/litellm/patchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ class LiteLLMAdecisionsPatcher(FunctionWrapperPatcher):
wrapper = _adecisions_wrapper_async


class LiteLLMSystemOnePatcher(FunctionWrapperPatcher):
name = "litellm.systemone"
target_path = "systemone"
wrapper = _decisions_wrapper


class LiteLLMASystemOnePatcher(FunctionWrapperPatcher):
name = "litellm.asystemone"
target_path = "asystemone"
wrapper = _adecisions_wrapper_async


class LiteLLMImageGenerationPatcher(FunctionWrapperPatcher):
name = "litellm.image_generation"
target_path = "image_generation"
Expand Down Expand Up @@ -166,6 +178,8 @@ class LiteLLMArerankPatcher(FunctionWrapperPatcher):
LiteLLMAresponsesPatcher,
LiteLLMDecisionsPatcher,
LiteLLMAdecisionsPatcher,
LiteLLMSystemOnePatcher,
LiteLLMASystemOnePatcher,
LiteLLMImageGenerationPatcher,
LiteLLMAimageGenerationPatcher,
LiteLLMEmbeddingPatcher,
Expand Down
Loading
Loading