Fix Responses API request handling (#25881)
Co-authored-by: Kai-Hsun Chen <kaihsun@apache.org> Co-authored-by: Kristin Cowalcijk <kristincowalcijk@gmail.com> Co-authored-by: aerosta <63026763+aerosta@users.noreply.github.com> Co-authored-by: glaziermag <glaziermag@users.noreply.github.com> Co-authored-by: Blake Ledden <blake.ledden@gmail.com> Co-authored-by: PanJason <pyyjason@gmail.com> Co-authored-by: Leoyzen <leoyzen@gmail.com> Co-authored-by: kennyu <966806+kennyu@users.noreply.github.com>
This commit is contained in:
co-authored by
Kai-Hsun Chen
Kristin Cowalcijk
aerosta
glaziermag
Blake Ledden
PanJason
Leoyzen
kennyu
parent
b3270264e4
commit
85712fa5b0
@@ -383,6 +383,37 @@ class TestTemplateContentFormatDetection(CustomTestCase):
|
||||
# Image data is still extracted
|
||||
self.assertEqual(len(image_data), 1)
|
||||
|
||||
def test_process_content_v32_encoding_accepts_responses_input_text(self):
|
||||
msg_dict = {
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "input_text", "text": "Hello"},
|
||||
{
|
||||
"type": "input_image",
|
||||
"image_url": "http://example.com/img.jpg",
|
||||
"detail": "auto",
|
||||
},
|
||||
{"type": "input_text", "text": "World"},
|
||||
],
|
||||
}
|
||||
image_data = []
|
||||
video_data = []
|
||||
audio_data = []
|
||||
modalities = []
|
||||
result = process_content_for_template_format(
|
||||
msg_dict,
|
||||
"openai",
|
||||
image_data,
|
||||
video_data,
|
||||
audio_data,
|
||||
modalities,
|
||||
use_dpsk_v32_encoding=True,
|
||||
)
|
||||
|
||||
self.assertEqual(result["content"], "Hello World")
|
||||
self.assertEqual(len(image_data), 1)
|
||||
self.assertEqual(image_data[0].url, "http://example.com/img.jpg")
|
||||
|
||||
def test_process_content_invalid_format_raises(self):
|
||||
"""Test that invalid content_format raises ValueError."""
|
||||
msg_dict = {
|
||||
|
||||
Reference in New Issue
Block a user