1212 Sequence ,
1313)
1414from copy import deepcopy
15- from typing import Any , ClassVar , Generic , Literal , TypedDict , cast , overload
15+ from typing import TYPE_CHECKING , Any , ClassVar , Generic , Literal , TypedDict , cast , overload
1616
1717from pydantic import BaseModel , ValidationError
1818
@@ -2810,7 +2810,7 @@ class ToolMode(TypedDict, total=False):
28102810# region TypedDict-based Chat Options
28112811
28122812
2813- class ChatOptions (TypedDict , Generic [ TResponseModel ] , total = False ):
2813+ class _ChatOptionsBase (TypedDict , total = False ):
28142814 """Common request settings for AI services as a TypedDict.
28152815
28162816 All fields are optional (total=False) to allow partial specification.
@@ -2863,7 +2863,7 @@ class ChatOptions(TypedDict, Generic[TResponseModel], total=False):
28632863 allow_multiple_tool_calls : bool
28642864
28652865 # Response configuration
2866- response_format : type [TResponseModel ] | Mapping [str , Any ] | None
2866+ response_format : type [BaseModel ] | Mapping [str , Any ] | None
28672867
28682868 # Metadata
28692869 metadata : dict [str , Any ]
@@ -2875,6 +2875,15 @@ class ChatOptions(TypedDict, Generic[TResponseModel], total=False):
28752875 instructions : str
28762876
28772877
2878+ if TYPE_CHECKING :
2879+
2880+ class ChatOptions (_ChatOptionsBase , Generic [TResponseModel ], total = False ):
2881+ response_format : type [TResponseModel ] | Mapping [str , Any ] | None
2882+
2883+ else :
2884+ ChatOptions = _ChatOptionsBase
2885+
2886+
28782887# region Chat Options Utility Functions
28792888
28802889
0 commit comments