-
Notifications
You must be signed in to change notification settings - Fork 175
SGR doesn't work with images #86
Copy link
Copy link
Closed
Labels
Description
I'm trying to send image url
response = client.chat.completions.create(
model="custom_research_agent",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What's on picture?"},
{
"type": "image_url",
"image_url": {
"url": "https://www.nhm.ac.uk/content/dam/nhm-www/discover/urban-foxes/fox-on-shed-full-width.jpg.thumb.1920.1920.png"
}
}
]
}
],
stream=True,
temperature=0.4,
)
or image in base64 :
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What's on picture?"},
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{img_base64}"
}
}
]
}
],
And i get errors like that:
Traceback (most recent call last):
File "H:\PycharmProjects\sgr_client_test\main.py", line 11, in <module>
response = client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "H:\PycharmProjects\sgr_client_test\venv\Lib\site-packages\openai\_utils\_utils.py", line 286, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "H:\PycharmProjects\sgr_client_test\venv\Lib\site-packages\openai\resources\chat\completions\completions.py", line 1156, in create
return self._post(
^^^^^^^^^^^
File "H:\PycharmProjects\sgr_client_test\venv\Lib\site-packages\openai\_base_client.py", line 1259, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "H:\PycharmProjects\sgr_client_test\venv\Lib\site-packages\openai\_base_client.py", line 1047, in request
raise self._make_status_error_from_response(err.response) from None
openai.UnprocessableEntityError: Error code: 422 - {'detail': [{'type': 'string_type', 'loc': ['body', 'messages', 0, 'content'], 'msg': 'Input should be a valid string', 'input': [{'type':
'text', 'text': "What's on picture?"}, {'type': 'image_url', 'image_url': {'url': 'https://www.nhm.ac.uk/content/dam/nhm-www/discover/urban-foxes/fox-on-shed-full-width.jpg.thumb.1920.1920
.png'}}]}]}
And sgr-core-agent server shows:
INFO: 127.0.0.1:60947 - "POST /v1/chat/completions HTTP/1.1" 422 Unprocessable Entity
Reactions are currently unavailable