Skip to content

Commit 07c12b7

Browse files
authored
Safer module check (#1857)
1 parent a244f19 commit 07c12b7

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

python/langsmith/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Avoid calling into importlib on every call to __version__
2323

24-
__version__ = "0.4.6"
24+
__version__ = "0.4.7"
2525
version = __version__ # for backwards compatibility
2626

2727

python/langsmith/wrappers/_openai_agents.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
try:
99
from agents import tracing # type: ignore[import]
1010

11+
required = (
12+
"TracingProcessor",
13+
"Trace",
14+
"Span",
15+
"ResponseSpanData",
16+
)
17+
if not all(hasattr(tracing, name) for name in required):
18+
raise ImportError("The `agents` package is not installed.")
19+
1120
import langsmith.wrappers._agent_utils as agent_utils
1221

1322
HAVE_AGENTS = True

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "langsmith"
3-
version = "0.4.6"
3+
version = "0.4.7"
44
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
55
authors = ["LangChain <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)