mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 07:36:08 +00:00
add reasoning guard; make mime type not required alongside base64
This commit is contained in:
parent
7bc4512ab7
commit
5b7df921df
@ -949,6 +949,11 @@ def is_text_block(block: ContentBlock) -> TypeGuard[TextContentBlock]:
|
|||||||
return block.get("type") == "text"
|
return block.get("type") == "text"
|
||||||
|
|
||||||
|
|
||||||
|
def is_reasoning_block(block: ContentBlock) -> TypeGuard[ReasoningContentBlock]:
|
||||||
|
"""Type guard to check if a content block is a reasoning block."""
|
||||||
|
return block.get("type") == "reasoning"
|
||||||
|
|
||||||
|
|
||||||
def is_invalid_tool_call_block(
|
def is_invalid_tool_call_block(
|
||||||
block: ContentBlock,
|
block: ContentBlock,
|
||||||
) -> TypeGuard[InvalidToolCall]:
|
) -> TypeGuard[InvalidToolCall]:
|
||||||
@ -1097,10 +1102,6 @@ def create_image_block(
|
|||||||
msg = "Must provide one of: url, base64, or file_id"
|
msg = "Must provide one of: url, base64, or file_id"
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
if base64 and not mime_type:
|
|
||||||
msg = "mime_type is required when using base64 data"
|
|
||||||
raise ValueError(msg)
|
|
||||||
|
|
||||||
block = ImageContentBlock(type="image", id=_ensure_id(id))
|
block = ImageContentBlock(type="image", id=_ensure_id(id))
|
||||||
|
|
||||||
if url is not None:
|
if url is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user