Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for Python 3.13 by introducing a custom
classproperty
decorator in theBaseTool
class. The change addresses the incompatibility of using@classmethod
in conjunction with@property
in Python 3.13 and ensures that class-level properties function correctly in newer Python versions.Changes Made
Introduced
classproperty
Decorator:classproperty
decorator to allow class methods to be accessed as properties at the class level.@classmethod
and@property
.Updated
BaseTool.openai_schema
Method:@classmethod
decorator with the new@classproperty
decorator on theopenai_schema
method.openai_schema
to be accessed as a property directly from the class without instantiation.How It Works
The
classproperty
DecoratorThe custom
classproperty
decorator enables defining properties that are accessible at the class level. Here's the implementation:fget
) as its argument.__get__
method is part of Python's descriptor protocol.instance
(which will beNone
since it's accessed at the class level) andowner
(the class itself).owner
) as the argument.Applying
classproperty
toopenai_schema
In
BaseTool.py
, theopenai_schema
method is updated to use the new decorator:Access Without Instantiation: With the
@classproperty
decorator, we can accessopenai_schema
directly from the class:Compatibility with Python 3.13: This approach avoids the use of
@classmethod
and@property
together, which is not supported in Python 3.13 and later.Testing and Validation
BaseTool.openai_schema
returns the correct dictionary and that other functionalities of theBaseTool
class remain unaffected.Fix #198