Skip to content

Commit da4c09e

Browse files
committed
feat: handle extra_body
1 parent 17c5905 commit da4c09e

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

portkey_ai/api_resources/apis/responses.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def __init__(self, client: Portkey) -> None:
4747
def create(
4848
self,
4949
*,
50-
input: Union[str, ResponseInputParam],
51-
model: ResponsesModel,
50+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
51+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
5252
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
5353
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
5454
max_output_tokens: Union[Optional[int], NotGiven] = NOT_GIVEN,
@@ -73,8 +73,8 @@ def create(
7373
def create(
7474
self,
7575
*,
76-
input: Union[str, ResponseInputParam],
77-
model: ResponsesModel,
76+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
77+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
7878
stream: Literal[True],
7979
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
8080
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
@@ -99,8 +99,8 @@ def create(
9999
def create(
100100
self,
101101
*,
102-
input: Union[str, ResponseInputParam],
103-
model: ResponsesModel,
102+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
103+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
104104
stream: bool,
105105
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
106106
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
@@ -124,8 +124,8 @@ def create(
124124
def create(
125125
self,
126126
*,
127-
input: Union[str, ResponseInputParam],
128-
model: ResponsesModel,
127+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
128+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
129129
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
130130
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
131131
max_output_tokens: Union[Optional[int], NotGiven] = NOT_GIVEN,
@@ -170,7 +170,7 @@ def create(
170170
user=user,
171171
extra_headers=extra_headers,
172172
extra_query=extra_query,
173-
extra_body=extra_body,
173+
extra_body={**(extra_body or {}), **kwargs},
174174
timeout=timeout,
175175
)
176176

@@ -191,7 +191,7 @@ def retrieve(
191191
include=include,
192192
extra_headers=extra_headers,
193193
extra_query=extra_query,
194-
extra_body=extra_body,
194+
extra_body={**(extra_body or {}), **kwargs},
195195
timeout=timeout,
196196
)
197197

@@ -210,7 +210,7 @@ def delete(self, response_id: str, **kwargs) -> None:
210210
response_id=response_id,
211211
extra_headers=extra_headers,
212212
extra_query=extra_query,
213-
extra_body=extra_body,
213+
extra_body={**(extra_body or {}), **kwargs},
214214
timeout=timeout,
215215
)
216216

@@ -262,15 +262,15 @@ def stream(
262262
user=user,
263263
extra_headers=extra_headers,
264264
extra_query=extra_query,
265-
extra_body=extra_body,
265+
extra_body={**(extra_body or {}), **kwargs},
266266
timeout=timeout,
267267
)
268268

269269
def parse(
270270
self,
271271
*,
272-
input: Union[str, ResponseInputParam],
273-
model: Union[str, ChatModel],
272+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
273+
model: Union[str, ChatModel, NotGiven] = NOT_GIVEN,
274274
text_format: Union[type[TextFormatT], NotGiven] = NOT_GIVEN, # type: ignore[type-arg]
275275
tools: Union[Iterable[ParseableToolParam], NotGiven] = NOT_GIVEN,
276276
include: Union[List[ResponseIncludable], NotGiven] = NOT_GIVEN,
@@ -317,7 +317,7 @@ def parse(
317317
user=user,
318318
extra_headers=extra_headers,
319319
extra_query=extra_query,
320-
extra_body=extra_body,
320+
extra_body={**(extra_body or {}), **kwargs},
321321
timeout=timeout,
322322
)
323323

@@ -334,7 +334,7 @@ def cancel(
334334
response_id=response_id,
335335
extra_headers=extra_headers,
336336
extra_query=extra_query,
337-
extra_body=extra_body,
337+
extra_body={**(extra_body or {}), **kwargs},
338338
timeout=timeout,
339339
)
340340

@@ -368,7 +368,7 @@ def list(
368368
order=order,
369369
extra_headers=extra_headers,
370370
extra_query=extra_query,
371-
extra_body=extra_body,
371+
extra_body={**(extra_body or {}), **kwargs},
372372
timeout=timeout,
373373
)
374374

@@ -385,8 +385,8 @@ def __init__(self, client: AsyncPortkey) -> None:
385385
async def create(
386386
self,
387387
*,
388-
input: Union[str, ResponseInputParam],
389-
model: ResponsesModel,
388+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
389+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
390390
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
391391
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
392392
max_output_tokens: Union[Optional[int], NotGiven] = NOT_GIVEN,
@@ -411,8 +411,8 @@ async def create(
411411
async def create(
412412
self,
413413
*,
414-
input: Union[str, ResponseInputParam],
415-
model: ResponsesModel,
414+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
415+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
416416
stream: Literal[True],
417417
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
418418
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
@@ -437,8 +437,8 @@ async def create(
437437
async def create(
438438
self,
439439
*,
440-
input: Union[str, ResponseInputParam],
441-
model: ResponsesModel,
440+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
441+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
442442
stream: bool,
443443
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
444444
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
@@ -462,8 +462,8 @@ async def create(
462462
async def create(
463463
self,
464464
*,
465-
input: Union[str, ResponseInputParam],
466-
model: ResponsesModel,
465+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
466+
model: Union[ResponsesModel, NotGiven] = NOT_GIVEN,
467467
include: Union[Optional[List[ResponseIncludable]], NotGiven] = NOT_GIVEN,
468468
instructions: Union[Optional[str], NotGiven] = NOT_GIVEN,
469469
max_output_tokens: Union[Optional[int], NotGiven] = NOT_GIVEN,
@@ -508,7 +508,7 @@ async def create(
508508
user=user,
509509
extra_headers=extra_headers,
510510
extra_query=extra_query,
511-
extra_body=extra_body,
511+
extra_body={**(extra_body or {}), **kwargs},
512512
timeout=timeout,
513513
)
514514

@@ -529,7 +529,7 @@ async def retrieve(
529529
include=include,
530530
extra_headers=extra_headers,
531531
extra_query=extra_query,
532-
extra_body=extra_body,
532+
extra_body={**(extra_body or {}), **kwargs},
533533
timeout=timeout,
534534
)
535535

@@ -548,7 +548,7 @@ async def delete(self, response_id: str, **kwargs) -> None:
548548
response_id=response_id,
549549
extra_headers=extra_headers,
550550
extra_query=extra_query,
551-
extra_body=extra_body,
551+
extra_body={**(extra_body or {}), **kwargs},
552552
timeout=timeout,
553553
)
554554

@@ -600,15 +600,15 @@ def stream(
600600
user=user,
601601
extra_headers=extra_headers,
602602
extra_query=extra_query,
603-
extra_body=extra_body,
603+
extra_body={**(extra_body or {}), **kwargs},
604604
timeout=timeout,
605605
)
606606

607607
async def parse(
608608
self,
609609
*,
610-
input: Union[str, ResponseInputParam],
611-
model: Union[str, ChatModel],
610+
input: Union[str, ResponseInputParam, NotGiven] = NOT_GIVEN,
611+
model: Union[str, ChatModel, NotGiven] = NOT_GIVEN,
612612
text_format: Union[type[TextFormatT], NotGiven] = NOT_GIVEN, # type: ignore[type-arg]
613613
tools: Union[Iterable[ParseableToolParam], NotGiven] = NOT_GIVEN,
614614
include: Union[List[ResponseIncludable], NotGiven] = NOT_GIVEN,
@@ -655,7 +655,7 @@ async def parse(
655655
user=user,
656656
extra_headers=extra_headers,
657657
extra_query=extra_query,
658-
extra_body=extra_body,
658+
extra_body={**(extra_body or {}), **kwargs},
659659
timeout=timeout,
660660
)
661661

@@ -672,7 +672,7 @@ async def cancel(
672672
response_id=response_id,
673673
extra_headers=extra_headers,
674674
extra_query=extra_query,
675-
extra_body=extra_body,
675+
extra_body={**(extra_body or {}), **kwargs},
676676
timeout=timeout,
677677
)
678678

@@ -706,7 +706,7 @@ async def list(
706706
order=order,
707707
extra_headers=extra_headers,
708708
extra_query=extra_query,
709-
extra_body=extra_body,
709+
extra_body={**(extra_body or {}), **kwargs},
710710
timeout=timeout,
711711
)
712712

0 commit comments

Comments
 (0)