mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-15 15:40:34 +00:00
fix(ollama): enhance image data handling in content blocks for v1 support
This commit is contained in:
@@ -269,8 +269,12 @@ def _lc_tool_call_to_openai_tool_call(tool_call_: ToolCall) -> dict:
|
||||
def _get_image_from_data_content_block(block: dict) -> str:
|
||||
"""Format standard data content block to format expected by Ollama."""
|
||||
if block["type"] == "image":
|
||||
if block["source_type"] == "base64":
|
||||
if block.get("source_type") == "base64":
|
||||
# v0
|
||||
return block["data"]
|
||||
if block.get("base64") is not None:
|
||||
# v1
|
||||
return block["base64"]
|
||||
error_message = "Image data only supported through in-line base64 format."
|
||||
raise ValueError(error_message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user