2323
2424from hyperspell import Hyperspell , AsyncHyperspell , APIResponseValidationError
2525from hyperspell ._types import Omit
26+ from hyperspell ._utils import maybe_transform
2627from hyperspell ._models import BaseModel , FinalRequestOptions
2728from hyperspell ._constants import RAW_RESPONSE_HEADER
2829from hyperspell ._exceptions import APIStatusError , APITimeoutError , APIResponseValidationError
3233 BaseClient ,
3334 make_request_options ,
3435)
36+ from hyperspell .types .document_add_params import DocumentAddParams
3537
3638from .utils import update_env
3739
@@ -734,7 +736,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
734736 with pytest .raises (APITimeoutError ):
735737 self .client .post (
736738 "/documents/add" ,
737- body = cast (object , dict (collection = "collection" , text = "text" )),
739+ body = cast (object , maybe_transform ( dict (collection = "collection" , text = "text" ), DocumentAddParams )),
738740 cast_to = httpx .Response ,
739741 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
740742 )
@@ -749,7 +751,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
749751 with pytest .raises (APIStatusError ):
750752 self .client .post (
751753 "/documents/add" ,
752- body = cast (object , dict (collection = "collection" , text = "text" )),
754+ body = cast (object , maybe_transform ( dict (collection = "collection" , text = "text" ), DocumentAddParams )),
753755 cast_to = httpx .Response ,
754756 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
755757 )
@@ -1523,7 +1525,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15231525 with pytest .raises (APITimeoutError ):
15241526 await self .client .post (
15251527 "/documents/add" ,
1526- body = cast (object , dict (collection = "collection" , text = "text" )),
1528+ body = cast (object , maybe_transform ( dict (collection = "collection" , text = "text" ), DocumentAddParams )),
15271529 cast_to = httpx .Response ,
15281530 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15291531 )
@@ -1538,7 +1540,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
15381540 with pytest .raises (APIStatusError ):
15391541 await self .client .post (
15401542 "/documents/add" ,
1541- body = cast (object , dict (collection = "collection" , text = "text" )),
1543+ body = cast (object , maybe_transform ( dict (collection = "collection" , text = "text" ), DocumentAddParams )),
15421544 cast_to = httpx .Response ,
15431545 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15441546 )
0 commit comments