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
2 changes: 1 addition & 1 deletion py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ latest = "ai[openai]==0.5.2"
"0.4.0" = "ai[openai]==0.4.0"

[tool.braintrust.matrix.openai]
latest = "openai==3.8.0"
latest = "openai==3.13.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the goal here is to just keep bumping up latest and if/when we hit some kind of major compat issue only then do we add a new entry to the matrix

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup exactly. Every week we have a weekly job to update it. We still prefer fixed version numbers over just saying whatever is latest to prevent supply chain attacks.

"1.92.0" = "openai==1.92.0"
"1.77.0" = "openai==1.77.0"
"1.71.0" = "openai==1.71.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@
from wrapt import FunctionWrapper


def _is_braintrust_wrapped() -> bool:
attr = inspect.getattr_static(openai.resources.chat.completions.Completions, "create", None)
def _is_braintrust_wrapped(resource) -> bool:
attr = inspect.getattr_static(resource, "create", None)
return isinstance(attr, FunctionWrapper)


resources = [openai.resources.chat.completions.Completions]
try:
from openai.resources.beta.agents.sessions.sessions import Sessions

resources.append(Sessions)
except ImportError:
pass


# 1. Verify not patched initially
assert not _is_braintrust_wrapped()
assert all(not _is_braintrust_wrapped(resource) for resource in resources)

# 2. Instrument
results = auto_instrument()
assert results.get("openai") == True
assert _is_braintrust_wrapped()
assert all(_is_braintrust_wrapped(resource) for resource in resources)

# 3. Idempotent
results2 = auto_instrument()
Expand Down

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

Loading