Skip to content

Fix AsyncConversation.prompt() ignoring conversation tools, closes #1790 - #1834

Open
swayaam03 wants to merge 1 commit into
simonw:mainfrom
swayaam03:fix-async-conversation-tools
Open

swayaam03 wants to merge 1 commit into
simonw:mainfrom
swayaam03:fix-async-conversation-tools

Conversation

@swayaam03

Copy link
Copy Markdown

Summary

Closes #1790

Fixes an issue where AsyncConversation.prompt() ignores the tools attached to the conversation instance when called without explicit tools passed into .prompt().

Cause

In llm/models.py:

  • Conversation.prompt() uses tools=tools or self.tools
  • Conversation.chain() uses tools=tools or self.tools
  • AsyncConversation.chain() uses tools=tools or self.tools

However, AsyncConversation.prompt() was mistakenly passing tools=tools directly to Prompt(...), dropping self.tools.

Changes

  1. llm/models.py: Changed tools=tools to tools=tools or self.tools in AsyncConversation.prompt().
  2. tests/test_tools.py: Added unit test test_async_conversation_prompt_inherits_tools verifying that tools set on an AsyncConversation are properly passed through to the generated Prompt.

@Muguett-DBY Muguett-DBY left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the base and this commit with an offline recording model. The model now receives the conversation's tool on both the first and second turns, and an explicit nonempty tools argument still takes precedence. An empty list inherits the conversation tools, matching the existing synchronous behavior. A model that doesn't support tools now rejects the inherited tool instead of silently losing it.

This exercised the exact models.py and message types with Codex assistance; the HTTP client and unused utility helpers were stubbed. I didn't run the full suite or a real provider.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsyncConversation.prompt() ignores the conversation's tools

2 participants