Merge pull request #53 from Brunwo/main

Fix ToolCollection by passing `trust_remote_code`argument.
This commit is contained in:
Aymeric Roucher 2025-01-06 14:04:12 +01:00 committed by GitHub
commit 6520ddeded
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -904,12 +904,12 @@ class ToolCollection:
```
"""
def __init__(self, collection_slug: str, token: Optional[str] = None):
def __init__(self, collection_slug: str, token: Optional[str] = None, trust_remote_code=False):
self._collection = get_collection(collection_slug, token=token)
self._hub_repo_ids = {
item.item_id for item in self._collection.items if item.item_type == "space"
}
self.tools = {Tool.from_hub(repo_id) for repo_id in self._hub_repo_ids}
self.tools = {Tool.from_hub(repo_id,token,trust_remote_code) for repo_id in self._hub_repo_ids}
def tool(tool_function: Callable) -> Tool: