Skip to content

Conversation

@gswangg
Copy link
Contributor

@gswangg gswangg commented May 25, 2025

Description

extended thinking was mostly fixed by #18834, though claude 4 will also occasionally issue tool calls with no accompanying text, and null 'thinking' in additional_kwargs, as seen below:

DEBUG:    Empty response full structure: {
  "role": "assistant",
  "additional_kwargs": {
    "tool_calls": [
      {
        #[redacted]
      }
    ],
    "thinking": null
  },
  "blocks": [
    {
      "block_type": "text",
      "text": ""
    }
  ]
}

this causes a downstream exception:
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}}

Fixes # (issue)

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I tested locally and checked that this resolved the bug I was encountering.

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran uv run make format; uv run make lint to appease the lint gods

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 25, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 25, 2025
@logan-markewich logan-markewich merged commit 4d5b073 into run-llama:main May 25, 2025
9 of 10 checks passed
@colca colca mentioned this pull request Jun 9, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants