Fix: to_gemini_tool to return types.Tool object. Fixes #223#229
Open
Areen-09 wants to merge 1 commit into
Open
Fix: to_gemini_tool to return types.Tool object. Fixes #223#229Areen-09 wants to merge 1 commit into
Areen-09 wants to merge 1 commit into
Conversation
Contributor
|
Thanks @Areen-09, this is a solid fix. LGTM on the loader + examples + tests. Before merge:
Happy to merge once those doc bits are in, core work looks good. <3 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR resolves an issue (#223) where
SkillLoader.to_gemini_tool()was returning a plain dictionary instead of a propertypes.Toolobject. Thegoogle-genaiSDK expects atypes.Toolinstance insideGenerateContentConfig(tools=...), which caused runtime failures when developers passed the output ofto_gemini_tool()directly into their Gemini generation config, as shown in our documentation and some examples.Changes introduced:
skillware/core/loader.py):SkillLoader.to_gemini_tool()now correctly importsgoogle.genaiand constructs/returns atypes.Toolobject instead of a raw dictionary.types.Toolwrapping from all Gemini examples (gemini_uk_companies_house_handler.py,gemini_issue_resolver.py, etc.). Additionally, all Gemini examples now consistently useSkillLoader._sanitize_function_tool_name(bundle["manifest"]["name"])for deriving tool names safely.tests/test_loader.py): Updated the test assertions fortest_to_gemini_toolto inspect the nested Protobuf structures of thetypes.Toolobject (tool.function_declarations[0]).docs/usage/gemini.mdto clarify thatto_gemini_tool()automatically handles this object instantiation for the developer.Fixedentry under[Unreleased]detailing the framework breaking fix.Type of Change (Matches Issue Templates)
manifest.yaml,skill.py, andinstructions.md)base_skill.py,loader.py, etc.)Checklist (all PRs)
python -m flake8 .,pytest skills/(orskillware test), andpytest tests/locally (or the subset relevant to this change).CHANGELOG.mdupdated under[Unreleased]if this PR changes user-visible behavior.examples/README.mdis updated if this PR adds, renames, or removes a runnable script underexamples/.Related Issues
Fixes #223