mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 05:50:13 +00:00
Add PDF support for openai_conversation.generate_content service (#141588)
Add PDF support for openai_conversation.generate_content service
This commit is contained in:
@@ -262,6 +262,27 @@ async def test_init_error(
|
||||
},
|
||||
0,
|
||||
),
|
||||
(
|
||||
{"prompt": "Picture of a dog", "filenames": ["/a/b/c.pdf"]},
|
||||
{
|
||||
"input": [
|
||||
{
|
||||
"content": [
|
||||
{
|
||||
"type": "input_text",
|
||||
"text": "Picture of a dog",
|
||||
},
|
||||
{
|
||||
"type": "input_file",
|
||||
"file_data": "data:application/pdf;base64,BASE64IMAGE1",
|
||||
"filename": "/a/b/c.pdf",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
1,
|
||||
),
|
||||
(
|
||||
{"prompt": "Picture of a dog", "filenames": ["/a/b/c.jpg"]},
|
||||
{
|
||||
@@ -415,8 +436,8 @@ async def test_generate_content_service(
|
||||
[True, False],
|
||||
),
|
||||
(
|
||||
{"prompt": "Not a picture of a dog", "filenames": ["/a/b/c.pdf"]},
|
||||
"Only images are supported by the OpenAI API,`/a/b/c.pdf` is not an image file",
|
||||
{"prompt": "Not a picture of a dog", "filenames": ["/a/b/c.mov"]},
|
||||
"Only images and PDF are supported by the OpenAI API,`/a/b/c.mov` is not an image file or PDF",
|
||||
1,
|
||||
[True],
|
||||
[True],
|
||||
|
||||
Reference in New Issue
Block a user