Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/openai/resources/responses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from copy import copy
from typing import Any, List, Type, Union, Iterable, Optional, cast
from functools import partial
from typing_extensions import Literal, overload
Expand Down Expand Up @@ -1011,6 +1012,7 @@ def stream(
if "format" in text:
raise TypeError("Cannot mix and match text.format with text_format")

text = copy(text)
text["format"] = _type_to_text_format_param(text_format)

api_request: partial[Stream[ResponseStreamEvent]] = partial(
Expand Down Expand Up @@ -1114,7 +1116,7 @@ def parse(

if "format" in text:
raise TypeError("Cannot mix and match text.format with text_format")

text = copy(text)
text["format"] = _type_to_text_format_param(text_format)

tools = _make_tools(tools)
Expand Down Expand Up @@ -2442,7 +2444,7 @@ def stream(

if "format" in text:
raise TypeError("Cannot mix and match text.format with text_format")

text = copy(text)
text["format"] = _type_to_text_format_param(text_format)

api_request = self.create(
Expand Down Expand Up @@ -2550,7 +2552,7 @@ async def parse(

if "format" in text:
raise TypeError("Cannot mix and match text.format with text_format")

text = copy(text)
text["format"] = _type_to_text_format_param(text_format)

tools = _make_tools(tools)
Expand Down