diff --git a/src/openai_schemas.py b/src/openai_schemas.py index 173eec2d..2eed76ab 100644 --- a/src/openai_schemas.py +++ b/src/openai_schemas.py @@ -96,8 +96,6 @@ class UsageStats: @classmethod def from_dict(cls, data: Metadata) -> "UsageStats": return cls(**_from_dict_filter(cls, data)) - - @dataclass(frozen=True) class NormalizedResponse: text: str @@ -130,4 +128,4 @@ class OpenAICompatibleRequest: tool_choice: str = "auto" stream: bool = False stream_callback: Optional[Callable[[str], None]] = None - extra_body: Optional[JsonValue] = None \ No newline at end of file + extra_body: Optional[JsonValue] = None diff --git a/tests/test_openai_schemas.py b/tests/test_openai_schemas.py index 9cf13a9d..d6be7fc1 100644 --- a/tests/test_openai_schemas.py +++ b/tests/test_openai_schemas.py @@ -148,30 +148,9 @@ def test_normalized_response_raw_can_be_any_type() -> None: assert resp.raw_response == {"vendor_specific": True} -def test_normalized_response_to_legacy_dict_preserves_shape() -> None: - tc = openai_schemas.ToolCall( - id="call_q", - function=openai_schemas.ToolCallFunction(name="x", arguments="{}"), - ) - usage = openai_schemas.UsageStats( - input_tokens=10, output_tokens=20, cache_read_tokens=5, cache_creation_tokens=3 - ) - resp = openai_schemas.NormalizedResponse( - text="hello", tool_calls=(tc,), usage=usage, raw_response="sdk_obj" - ) - d = resp.to_legacy_dict() - assert d["text"] == "hello" - assert d["tool_calls"][0]["id"] == "call_q" - assert d["usage"]["input_tokens"] == 10 - assert d["usage"]["cache_read_tokens"] == 5 - assert d["raw_response"] == "sdk_obj" - - def test_openai_compatible_request_defaults() -> None: msg = openai_schemas.ChatMessage(role="user", content="hi") req = openai_schemas.OpenAICompatibleRequest(messages=[msg], model="gpt-4") - assert req.messages == [msg] - assert req.model == "gpt-4" assert req.temperature == 0.0 assert req.top_p == 1.0 assert req.max_tokens == 8192