Skip to content

Commit

Permalink
Do not send blank content to anthropic (#17278)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Dec 15, 2024
1 parent b1bc1a7 commit 5390250
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ def messages_to_anthropic_messages(
if "cache_control" in message.additional_kwargs
else TextBlockParam(text=block.text, type="text")
)
content.append(content_)

# avoid empty text blocks
if content_["text"]:
content.append(content_)
elif isinstance(block, ImageBlock):
# FUTURE: Claude does not support URLs, so we need to always convert to base64
img_bytes = block.resolve_image(as_base64=True).read()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-llms-anthropic"
readme = "README.md"
version = "0.6.0"
version = "0.6.1"

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
Expand Down

0 comments on commit 5390250

Please sign in to comment.