fix(loader): use consistent key for retrieval tools in collect_classes#11
Closed
MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
Closed
fix(loader): use consistent key for retrieval tools in collect_classes#11MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
MicaPerdomo wants to merge 1 commit intocogsol:mainfrom
Conversation
collect_classes stores retrieval tool entries using obj.__name__ (e.g. "ProductDocsSearch"), but collect_definitions uses the explicit name attribute (e.g. "product_docs_search"). When the migration runner looks up classes by definition key, the mismatch causes "retrieval is required for retrieval tool" errors. Use getattr(obj, "name", None) or obj.__name__ as the key, matching the logic already used in collect_definitions.
Author
|
Closing — these changes are already included in #10. |
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.
Summary
collect_classesstores retrieval tool entries usingobj.__name__(e.g."ProductDocsSearch"), butcollect_definitionsuses the explicitnameattribute (e.g."product_docs_search"). When the migration runner looks up classes by definition key, the mismatch causes"retrieval is required for retrieval tool"errors.This changes
collect_classesto usegetattr(obj, "name", None) or obj.__name__as the key, matching the logic already used incollect_definitions.Changes
cogsol/core/loader.py: Use consistent key logic incollect_classesfor retrieval tools (1 line → 2 lines)tests/test_agents.py: Add 2 tests for explicit name keying and fallback behaviorTest plan
pytest— all tests pass (94 total, 2 new)black --check .— no formatting changesruff check .— 0 errorsmypy cogsol— 0 issues