Close unclosed resources in the whole project (#267)

* Close resources

* Close all resources

* Update pyproject.toml

* Close all resources

* Close all resources

* try now...

* try to ignore this

* try again

* try adding one more..

* try now

* try now

* revert ci changes
This commit is contained in:
Marcelo Trylesinski
2025-03-13 11:59:45 +01:00
committed by GitHub
parent 1691b905e2
commit 94d326dbf1
8 changed files with 64 additions and 11 deletions

View File

@@ -18,10 +18,10 @@ if TYPE_CHECKING:
class Tool(BaseModel):
"""Internal tool registration info."""
fn: Callable = Field(exclude=True)
fn: Callable[..., Any] = Field(exclude=True)
name: str = Field(description="Name of the tool")
description: str = Field(description="Description of what the tool does")
parameters: dict = Field(description="JSON schema for tool parameters")
parameters: dict[str, Any] = Field(description="JSON schema for tool parameters")
fn_metadata: FuncMetadata = Field(
description="Metadata about the function including a pydantic model for tool"
" arguments"
@@ -34,7 +34,7 @@ class Tool(BaseModel):
@classmethod
def from_function(
cls,
fn: Callable,
fn: Callable[..., Any],
name: str | None = None,
description: str | None = None,
context_kwarg: str | None = None,

View File

@@ -102,7 +102,9 @@ class FuncMetadata(BaseModel):
)
def func_metadata(func: Callable, skip_names: Sequence[str] = ()) -> FuncMetadata:
def func_metadata(
func: Callable[..., Any], skip_names: Sequence[str] = ()
) -> FuncMetadata:
"""Given a function, return metadata including a pydantic model representing its
signature.