Repository navigation
Conversation
|
@JennyMa11 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @JennyMa11, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the Please note that PRs without a signed CLA are automatically closed 48 hours after they were opened. |
|
Hi @JennyMa11, this PR is still waiting for the Contributor License Agreement (CLA) to be signed. Please note that if the CLA isn't signed within the next 24 hours, this PR will be automatically closed. Signing only takes a minute via the link in the |
|
Thanks for signing the CLA, @JennyMa11! 🎉 This PR is now ready for review again and the reviewer has been re-assigned. |
| @pytest.mark.asyncio | ||
| @pytest.mark.parametrize("use_async", [False, True]) | ||
| @pytest.mark.parametrize("configure_tools", [False, True]) | ||
| async def test_empty_tool_override_runs_without_tools( |
There was a problem hiding this comment.
Lets replace this with a single unit test on _select_tools, next to test_tool_selection_existing_tools. run and run_async both go through the same _select_tools call, and configure_tools=True already passed before this change, so only one of the four cases guards the fix. Something like:
def test_tool_selection_empty_list_without_configured_tools(self) -> None:
agent = Agent(chat_generator=MockChatGenerator("Hello"))
assert agent._select_tools([]) == []| if tools is None: | ||
| return _spawn_tools(tools=self.tools) | ||
|
|
||
| if isinstance(tools, list) and not tools: |
There was a problem hiding this comment.
Could we add a short comment here? Without it, it is not clear that an empty list would otherwise be treated as an empty name selection, since all() of an empty list is True.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
Related Issues
No linked issue. This was reproduced through the public Agent API.
Proposed Changes
An application can build its runtime tool list per request. Passing an empty list to an Agent without configured tools currently raises
ValueError. Handletools=[]as an empty tool selection in the sharedrunandrun_asyncpath so the request can run without tools.Added regression coverage for both entry points, with and without tools configured at initialization, and updated the Agent documentation and release notes.
How did you test it?
hatch run test:unit test/components/agents test/tools/test_agent_tool.py --no-cov --tb=short(401 passed, 7 deselected).hatch run fmt-check, mypy for both changed Python files, and pre-commit for the four changed files passed.Notes for the reviewer
Codex generated and reviewed the patch and tests and ran the checks.