`content_image_url` throws error in local vision model
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 content_image_url 和 ContentImageRemote 路径开始,然后跟踪请求经过 chatlas/_chat.py 和 chatlas/_openai.py 的流程。将远程图像请求与可正常工作的 content_image_file 示例进行比较,并复现 Ollama llama3.2-vision 调用;当 URL 图像能够被接受且不再出现无效图像输入错误时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hi- thanks for creating this package! I'm testing out some local vision workflows with ollama and llama3.2-vision. I seem to get an error when using the content_image_url function to fetch an image:
from chatlas import ChatOllama, content_image_url, content_image_file
# Initialize chat with ollama llama3.2-vision
chat = ChatOllama(model="llama3.2-vision")
# Using content_image_url
chat.chat(
"What do you see in this image?",
content_image_url("https://www.python.org/static/img/python-logo.png"),
echo="all"
)
Throws this error:
👤 User turn:
What do you see in this image?
<< 👤 other content >>
🌆 python-logo.png
🤖 Assistant turn:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "\.venv\lib\site-packages\chatlas\_chat.py", line 356, in chat
for _ in response:
File "\.venv\lib\site-packages\chatlas\_chat.py", line 1169, in __next__
chunk = next(self._generator)
File "\.venv\lib\site-packages\chatlas\_chat.py", line 833, in _chat_impl
for chunk in self._submit_turns(
File "\.venv\lib\site-packages\chatlas\_chat.py", line 884, in _submit_turns
response = self.provider.chat_perform(
File "\.venv\lib\site-packages\chatlas\_openai.py", line 247, in chat_perform
return self._client.chat.completions.create(**kwargs) # type: ignore
File "\.venv\lib\site-packages\openai\_utils\_utils.py", line 275, in wrapper
return func(*args, **kwargs)
File "\.venv\lib\site-packages\openai\resources\chat\completions.py", line 829, in create
return self._post(
File "\.venv\lib\site-packages\openai\_base_client.py", line 1280, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "\.venv\lib\site-packages\openai\_base_client.py", line 957, in request
return self._request(
File "\.venv\lib\site-packages\openai\_base_client.py", line 1061, in _request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'invalid image input', 'type': 'invalid_request_error', 'param': None, 'code': None}}
The content_image_url("https://www.python.org/static/img/python-logo.png") seems to fetch the image and store it as a ContentImageRemote object.
Also, this works fine with content_image_file function:
chat.chat(
"What do you see in this image?",
content_image_file("python-logo.png"),
echo="all"
)
👤 User turn:
What do you see in this image?
<< 👤 other content >>
🌆 Dw2mJn+YhmuMAAAAAElFTkSuQmCC
🤖 Assistant turn:
The image features the Python logo, which is a stylized representation of the
word "python" and serves as an emblem for the official implementation of the
Python programming language.
Key Features:
• Color scheme:
• Primary color: Blue
• Secondary color: Yellow
• Positioning: Left side of the screen
Purpose: The logo is used to represent the official Python programming
language, providing a clear visual identifier for users.
I've tested this with version 0.2.0 and version 0.2.1.dev1+g6e81eb3 of chatlas.
- 主要语言
- Python
- 星标
- 179
- 派生
- 32
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 10
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
posit-dev/chatlas 的其他 Issue
-
A streaming text delta that repeats everything streamed so far is missing from the recorded turn可能已有人在做 @cpsievert 于 81 天前认领。 未关闭ai-triage:done Priority: Medium
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
ai-triage:needs-review documentation
难度 2/5 1-2 天 新手友好度 76/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
维护者通常 1 天内回复
-
难度 4/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
ai-triage:done Priority: Low
难度 3/5 1-2 天 新手友好度 55/100
维护者通常 1 天内回复
查看 posit-dev/chatlas 的全部 Issue
相似的 Issue
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
country:US rating:6 request-theme type:TV SHOW
难度 1/5 1 小时以内 新手友好度 65/100
LizardByte/ThemerrDB#10501 · 1 条评论 ·
-
triage/confirmed
难度 2/5 1-3 小时 新手友好度 77/100
agentscope-ai/agentscope#4563 ·
维护者通常 2 天内回复
-
comp/desktop desktop/chat P3 type/bug
难度 2/5 1-3 小时 新手友好度 77/100
NousResearch/hermes-agent#164451 ·
维护者通常 1 天内回复
-
external integration integration-submission
难度 2/5 1-3 小时 新手友好度 68/100
langchain-ai/docs#8426 ·
维护者通常 1 天内回复