Skip to content

Nova Sonic Inconsistent Tool Calling

0

Nova Sonic Configurations:
top_p: 1
temp: 1
number of tools: 3
toolChoice: auto

Issue Description: Nova Sonic for about 25% of the time (based on multiple testings) gathers tool parameters (i.e. asking the USER for tool parameter values) but then does not proceed to call the tool. The LLM would tell the customer that it will perform a task but does not actually do it (i.e. send the toolUse event). Please see an example conversation dialog below:

1. Expected Behavior (which happens about 85% of the time for me)
1: [USER ] Can you check my reward eligibility status?
2: [ASSISTANT] Sure. Can you provide me with your account ID?
3: [USER ] My account ID is 12345
4: [TOOLUSE] {get_reward_eligibility Tool results}
5: [ASSISTANT] Thank you. I have checked and you are indeed eligible for Elite Reward program.

2. Conversation with Tool Call Issue (which happens about 25% of the time for me)
1: [USER ] Can you check my reward eligibility status?
2: [ASSISTANT] Sure. Can you provide me with your account ID?
3: [USER ] My account ID is 12345
4: [ASSISTANT] Thank you. Let me check on your eligibility status...
no further response from the LLM
5: [USER ] hello?
6: [TOOLUSE] {get_reward_eligibility Tool results}
7: [ASSISTANT] Thank you. I have checked and you are indeed eligible for Elite Reward program.

Note that in the 2nd conversation, the LLM recognizes the tool needed to be used (get_reward_eligibility) as it asks the USER for the necessary information (dialog line #2). However, the LLM then tell the USER that it will perform the task (dialog line #4) but does not proceed to call the tool. That is no toolUse event was produced by the LLM after dialog line #4. Only when the USER nudges the LLM with some utterance (dialog line #5), then the LLM proceeds to call the tool (i.e. a toolUse event was produced) and moves the conversation forward.

Question: What is causing this behavior and how to address the issue to have consistent behavior as in Conversation Example 1? I have set the temp and top_p to "greedy" level as per AWS Nova documentation, but only got the expected behavior about 85% of the times. I need to have toolChoice=auto since tool use is not always needed. Another potential cause is the system prompt. If so, how to construct system prompt for consistent tool calling behavior. Again, the key problem I'm seeing here is the LLM appears to know the tool it need to call but just don't proceed to call it.

Thank you.

asked a year ago561 views

2 Answers
0

Hi there,

This behavior is actually the expected functionality of the tool implementation architecture. The standard tool execution workflow follows this sequence:

  1. The calling application submits tool definitions and an initiating message to the language model
  2. Upon matching a tool definition, the model generates a tool use request with appropriate parameters
  3. The calling application extracts these parameters and routes them to the corresponding local tool function
  4. The calling application can either:
    • Utilize the tool result directly
    • Return the result to the model for additional processing
  5. The model then either generates a final response or initiates another tool request

The observed pausing occurs because the model is generating the tool request but not automatically executing it. The subsequent user prompt triggers the complete workflow of tool execution and response generation.

To resolve this, you'll need to implement an additional Converse API call that handles the tool request and returns the tool output to the user.

For detailed implementation guidance, please reference:

Tool workflow documentation: https://builder.aws.com/content/2hW5367isgQOkkXLYjp4JB3Pe16/intro-to-tool-use-with-the-amazon-bedrock-converse-api Code examples for tool request handling: https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use-examples.html

AWS

answered a year ago

  • Hello,

    Thank you for providing your insights.
    I want to provide additional clarifications about the problem because the sequence of events do not point to a problem of tool request not being executed as you suggested. Rather the tool request was never generated by the LLM in the first place.
    I'm particularly working the Nova Sonic speech model. I have a function to process the toolUse events sent by the LLM when it decides to call a tool. That is how I got the expected behavior for about 85% of the time. However, the issue with tool calling I'm experiencing (for about 25% of the times) is the toolUse event was never generated by the LLM. Since no toolUse event was generated therefore my local code did not execute the tool function. The question I have then, why no toolUse event generated by the LLM for those 25% of the times despite the LLM asking the user for the parameter values needed to the tool, then receiving those parameter values and then tell user that it is performing the task.

0

This inconsistent tool calling behavior with Amazon Nova Sonic appears to be related to how the model decides when to use tools. The issue you're experiencing is that the model sometimes gathers the necessary parameters but doesn't immediately proceed to call the tool.

To address this issue, you can try the following approaches:

  1. Use the toolChoice parameter to more explicitly control tool usage:
  • Set toolChoice to "any" to force the model to select at least one available tool each time
  • Set toolChoice to "tool" with a specific tool name to force the model to use that particular tool
  • The default "auto" setting leaves tool selection entirely up to the model, which may be causing your inconsistency
  1. Optimize your tool configurations:
  • Ensure your tool descriptions are clear and specific
  • Use descriptive tool names that clearly indicate their function
  • Make sure your input schema is well-defined
  1. Consider your temperature and top_p settings:
  • While you've already set temperature and top_p to "greedy" levels (1.0), you might try reducing temperature further (closer to 0) to make the model's behavior more deterministic
  • This can help ensure more consistent tool calling patterns
  1. Improve your system prompt:
  • Include explicit instructions about when tools should be called
  • Specify the expected conversation flow
  • Provide clear guidance on gathering parameters and immediately using tools once parameters are collected

The key issue appears to be that the model sometimes enters a "thinking" state after collecting parameters rather than proceeding directly to tool use. By using the toolChoice parameter and optimizing your prompts, you should be able to achieve more consistent tool calling behavior.
Sources
Tool choice with Amazon Nova models | AWS Machine Learning Blog
Invoking a tool - Amazon Nova

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.