Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(smolagents): update internal smolagents import for compatibility with versions post 1.5.0 #1229

Merged
merged 3 commits into from
Jan 23, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test = [
"smolagents>=1.2.2",
"opentelemetry-sdk",
"pytest-recording",
"openai",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,17 @@ def _llm_invocation_parameters(


def _llm_tools(tools_to_call_from: list[Any]) -> Iterator[Tuple[str, Any]]:
from smolagents import Tool
from smolagents.models import get_json_schema # type:ignore[import-untyped]
from smolagents import Tool, __version__

major_version_string, minor_version_string, *_ = __version__.split(".")
major_version = int(major_version_string)
minor_version = int(minor_version_string)
if (major_version, minor_version) >= (1, 5):
from smolagents._function_type_hints_utils import ( # type: ignore[import-untyped]
get_json_schema,
)
else:
from smolagents.models import get_json_schema # type: ignore[import-untyped]

if not isinstance(tools_to_call_from, list):
return
Expand Down
Loading