diff --git a/portkey_ai/api_resources/apis/audio.py b/portkey_ai/api_resources/apis/audio.py index c36b8381..8bd828cb 100644 --- a/portkey_ai/api_resources/apis/audio.py +++ b/portkey_ai/api_resources/apis/audio.py @@ -43,7 +43,7 @@ def create( response_format=response_format, temperature=temperature, timestamp_granularities=timestamp_granularities, - **kwargs + extra_body=kwargs, ) data = Transcription(**json.loads(response.text)) data._headers = response.headers @@ -72,7 +72,7 @@ def create( prompt=prompt, response_format=response_format, temperature=temperature, - **kwargs + extra_body=kwargs, ) data = Translation(**json.loads(response.text)) data._headers = response.headers @@ -102,7 +102,7 @@ def create( voice=voice, response_format=response_format, speed=speed, - **kwargs + extra_body=kwargs, ) return response @@ -144,7 +144,7 @@ async def create( response_format=response_format, temperature=temperature, timestamp_granularities=timestamp_granularities, - **kwargs + extra_body=kwargs, ) ) data = Transcription(**json.loads(response.text)) @@ -174,7 +174,7 @@ async def create( prompt=prompt, response_format=response_format, temperature=temperature, - **kwargs + extra_body=kwargs, ) data = Translation(**json.loads(response.text)) data._headers = response.headers @@ -204,7 +204,7 @@ async def create( voice=voice, response_format=response_format, speed=speed, - **kwargs + extra_body=kwargs, ) data = response diff --git a/portkey_ai/api_resources/apis/batches.py b/portkey_ai/api_resources/apis/batches.py index 8f3583ce..d0b51d50 100644 --- a/portkey_ai/api_resources/apis/batches.py +++ b/portkey_ai/api_resources/apis/batches.py @@ -28,7 +28,7 @@ def create( endpoint=endpoint, input_file_id=input_file_id, metadata=metadata, - **kwargs + extra_body=kwargs, ) data = Batch(**json.loads(response.text)) data._headers = response.headers @@ -37,7 +37,7 @@ def create( def retrieve(self, batch_id, **kwargs) -> Batch: response = self.openai_client.with_raw_response.batches.retrieve( - batch_id=batch_id, **kwargs + batch_id=batch_id, extra_body=kwargs ) data = Batch(**json.loads(response.text)) data._headers = response.headers @@ -52,7 +52,7 @@ def list( **kwargs ) -> BatchList: response = self.openai_client.with_raw_response.batches.list( - after=after, limit=limit, **kwargs + after=after, limit=limit, extra_body=kwargs ) data = BatchList(**json.loads(response.text)) data._headers = response.headers @@ -61,7 +61,7 @@ def list( def cancel(self, batch_id: str, **kwargs) -> Batch: response = self.openai_client.with_raw_response.batches.cancel( - batch_id=batch_id, **kwargs + batch_id=batch_id, extra_body=kwargs ) data = Batch(**json.loads(response.text)) data._headers = response.headers @@ -89,7 +89,7 @@ async def create( endpoint=endpoint, input_file_id=input_file_id, metadata=metadata, - **kwargs + extra_body=kwargs, ) data = Batch(**json.loads(response.text)) data._headers = response.headers @@ -98,7 +98,7 @@ async def create( async def retrieve(self, batch_id, **kwargs) -> Batch: response = await self.openai_client.with_raw_response.batches.retrieve( - batch_id=batch_id, **kwargs + batch_id=batch_id, extra_body=kwargs ) data = Batch(**json.loads(response.text)) data._headers = response.headers @@ -113,7 +113,7 @@ async def list( **kwargs ) -> BatchList: response = await self.openai_client.with_raw_response.batches.list( - after=after, limit=limit, **kwargs + after=after, limit=limit, extra_body=kwargs ) data = BatchList(**json.loads(response.text)) data._headers = response.headers @@ -122,7 +122,7 @@ async def list( async def cancel(self, batch_id: str, **kwargs) -> Batch: response = await self.openai_client.with_raw_response.batches.cancel( - batch_id=batch_id, **kwargs + batch_id=batch_id, extra_body=kwargs ) data = Batch(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/chat_complete.py b/portkey_ai/api_resources/apis/chat_complete.py index f3eec7ee..9579ea3f 100644 --- a/portkey_ai/api_resources/apis/chat_complete.py +++ b/portkey_ai/api_resources/apis/chat_complete.py @@ -53,7 +53,7 @@ def stream_create( # type: ignore[return] temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) as response: for line in response.iter_lines(): json_string = line.replace("data: ", "") @@ -79,7 +79,7 @@ def normal_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) data = ChatCompletions(**json.loads(response.text)) data._headers = response.headers @@ -133,7 +133,7 @@ async def stream_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) as response: async for line in response.iter_lines(): json_string = line.replace("data: ", "") @@ -159,7 +159,7 @@ async def normal_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) data = ChatCompletions(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/complete.py b/portkey_ai/api_resources/apis/complete.py index 1c8c0e3a..00d9e903 100644 --- a/portkey_ai/api_resources/apis/complete.py +++ b/portkey_ai/api_resources/apis/complete.py @@ -27,7 +27,7 @@ def stream_create( # type: ignore[return] temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) as response: for line in response.iter_lines(): json_string = line.replace("data: ", "") @@ -53,7 +53,7 @@ def normal_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) data = TextCompletion(**json.loads(response.text)) data._headers = response.headers @@ -107,7 +107,7 @@ async def stream_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) as response: async for line in response.iter_lines(): json_string = line.replace("data: ", "") @@ -133,7 +133,7 @@ async def normal_create( temperature=temperature, max_tokens=max_tokens, top_p=top_p, - **kwargs, + extra_body=kwargs, ) data = TextCompletion(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/embeddings.py b/portkey_ai/api_resources/apis/embeddings.py index a53af750..13bb9c5f 100644 --- a/portkey_ai/api_resources/apis/embeddings.py +++ b/portkey_ai/api_resources/apis/embeddings.py @@ -29,7 +29,7 @@ def create( dimensions=dimensions, encoding_format=encoding_format, user=user, - **kwargs + extra_body=kwargs, ) data = CreateEmbeddingResponse(**json.loads(response.text)) @@ -60,7 +60,7 @@ async def create( dimensions=dimensions, encoding_format=encoding_format, user=user, - **kwargs + extra_body=kwargs, ) data = CreateEmbeddingResponse(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/fine_tuning.py b/portkey_ai/api_resources/apis/fine_tuning.py index 86d45903..45c37290 100644 --- a/portkey_ai/api_resources/apis/fine_tuning.py +++ b/portkey_ai/api_resources/apis/fine_tuning.py @@ -48,7 +48,7 @@ def create( seed=seed, suffix=suffix, validation_file=validation_file, - **kwargs, + extra_body=kwargs, ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -57,7 +57,7 @@ def create( def retrieve(self, fine_tuning_job_id: str, **kwargs) -> FineTuningJob: response = self.openai_client.with_raw_response.fine_tuning.jobs.retrieve( - fine_tuning_job_id=fine_tuning_job_id, **kwargs + fine_tuning_job_id=fine_tuning_job_id, extra_body=kwargs ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -72,7 +72,7 @@ def list( **kwargs, ) -> FineTuningJobList: response = self.openai_client.with_raw_response.fine_tuning.jobs.list( - after=after, limit=limit, **kwargs + after=after, limit=limit, extra_body=kwargs ) data = FineTuningJobList(**json.loads(response.text)) data._headers = response.headers @@ -81,7 +81,7 @@ def list( def cancel(self, fine_tuning_job_id: str, **kwargs) -> FineTuningJob: response = self.openai_client.with_raw_response.fine_tuning.jobs.cancel( - fine_tuning_job_id=fine_tuning_job_id, **kwargs + fine_tuning_job_id=fine_tuning_job_id, extra_body=kwargs ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -97,7 +97,10 @@ def list_events( **kwargs, ) -> FineTuningJobEventList: response = self.openai_client.with_raw_response.fine_tuning.jobs.list_events( - fine_tuning_job_id=fine_tuning_job_id, after=after, limit=limit, **kwargs + fine_tuning_job_id=fine_tuning_job_id, + after=after, + limit=limit, + extra_body=kwargs, ) data = FineTuningJobEventList(**json.loads(response.text)) data._headers = response.headers @@ -123,7 +126,7 @@ def list( fine_tuning_job_id=fine_tuning_job_id, after=after, limit=limit, - **kwargs, + extra_body=kwargs, ) ) @@ -168,7 +171,7 @@ async def create( seed=seed, suffix=suffix, validation_file=validation_file, - **kwargs, + extra_body=kwargs, ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -177,7 +180,7 @@ async def create( async def retrieve(self, fine_tuning_job_id: str, **kwargs) -> FineTuningJob: response = await self.openai_client.with_raw_response.fine_tuning.jobs.retrieve( - fine_tuning_job_id=fine_tuning_job_id, **kwargs + fine_tuning_job_id=fine_tuning_job_id, extra_body=kwargs ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -192,7 +195,7 @@ async def list( **kwargs, ) -> FineTuningJobList: response = await self.openai_client.with_raw_response.fine_tuning.jobs.list( - after=after, limit=limit, **kwargs + after=after, limit=limit, extra_body=kwargs ) data = FineTuningJobList(**json.loads(response.text)) data._headers = response.headers @@ -201,7 +204,7 @@ async def list( async def cancel(self, fine_tuning_job_id: str, **kwargs) -> FineTuningJob: response = await self.openai_client.with_raw_response.fine_tuning.jobs.cancel( - fine_tuning_job_id, **kwargs + fine_tuning_job_id, extra_body=kwargs ) data = FineTuningJob(**json.loads(response.text)) data._headers = response.headers @@ -221,7 +224,7 @@ async def list_events( fine_tuning_job_id=fine_tuning_job_id, after=after, limit=limit, - **kwargs, + extra_body=kwargs, ) ) data = FineTuningJobEventList(**json.loads(response.text)) @@ -247,7 +250,7 @@ async def list( fine_tuning_job_id=fine_tuning_job_id, after=after, limit=limit, - **kwargs, + extra_body=kwargs, ) data = FineTuningJobCheckpointList(**json.loads(response.text)) diff --git a/portkey_ai/api_resources/apis/images.py b/portkey_ai/api_resources/apis/images.py index 4212a35f..7e8092f0 100644 --- a/portkey_ai/api_resources/apis/images.py +++ b/portkey_ai/api_resources/apis/images.py @@ -33,9 +33,9 @@ def generate( quality=quality, response_format=response_format, size=size, - user=user, style=style, - **kwargs + user=user, + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers @@ -65,7 +65,7 @@ def edit( response_format=response_format, size=size, user=user, - **kwargs + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers @@ -89,7 +89,7 @@ def create_variation( response_format=response_format, size=size, user=user, - **kwargs + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers @@ -123,9 +123,9 @@ async def generate( quality=quality, response_format=response_format, size=size, - user=user, style=style, - **kwargs + user=user, + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers @@ -155,7 +155,7 @@ async def edit( response_format=response_format, size=size, user=user, - **kwargs + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers @@ -179,7 +179,7 @@ async def create_variation( response_format=response_format, size=size, user=user, - **kwargs + extra_body=kwargs, ) data = ImagesResponse(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/main_files.py b/portkey_ai/api_resources/apis/main_files.py index d3eba110..0ab0dc0b 100644 --- a/portkey_ai/api_resources/apis/main_files.py +++ b/portkey_ai/api_resources/apis/main_files.py @@ -16,15 +16,17 @@ def __init__(self, client: Portkey) -> None: def create(self, file, purpose, **kwargs) -> FileObject: response = self.openai_client.with_raw_response.files.create( - file=file, purpose=purpose, **kwargs + file=file, purpose=purpose, extra_body=kwargs ) data = FileObject(**json.loads(response.text)) data._headers = response.headers return data - def list(self, **kwargs) -> FileList: - response = self.openai_client.with_raw_response.files.list(**kwargs) + def list(self, purpose, **kwargs) -> FileList: + response = self.openai_client.with_raw_response.files.list( + purpose=purpose, extra_body=kwargs + ) data = FileList(**json.loads(response.text)) data._headers = response.headers @@ -32,7 +34,7 @@ def list(self, **kwargs) -> FileList: def retrieve(self, file_id, **kwargs) -> FileObject: response = self.openai_client.with_raw_response.files.retrieve( - file_id=file_id, **kwargs + file_id=file_id, extra_body=kwargs ) data = FileObject(**json.loads(response.text)) data._headers = response.headers @@ -41,7 +43,7 @@ def retrieve(self, file_id, **kwargs) -> FileObject: def delete(self, file_id, **kwargs) -> FileDeleted: response = self.openai_client.with_raw_response.files.delete( - file_id=file_id, **kwargs + file_id=file_id, extra_body=kwargs ) data = FileDeleted(**json.loads(response.text)) data._headers = response.headers @@ -49,11 +51,11 @@ def delete(self, file_id, **kwargs) -> FileDeleted: return data def content(self, file_id, **kwargs) -> Any: - response = self.openai_client.files.content(file_id=file_id, **kwargs) + response = self.openai_client.files.content(file_id=file_id, extra_body=kwargs) return response def retrieve_content(self, file_id, **kwargs) -> Any: - response = self.openai_client.files.content(file_id=file_id, **kwargs) + response = self.openai_client.files.content(file_id=file_id, extra_body=kwargs) return response def wait_for_processing( @@ -62,13 +64,11 @@ def wait_for_processing( *, poll_interval: float = 5.0, max_wait_seconds: float = 30 * 60, - **kwargs ) -> Any: response = self.openai_client.files.wait_for_processing( id=id, poll_interval=poll_interval, max_wait_seconds=max_wait_seconds, - **kwargs ) return response @@ -80,15 +80,17 @@ def __init__(self, client: AsyncPortkey) -> None: async def create(self, file, purpose, **kwargs) -> FileObject: response = await self.openai_client.with_raw_response.files.create( - file=file, purpose=purpose, **kwargs + file=file, purpose=purpose, extra_body=kwargs ) data = FileObject(**json.loads(response.text)) data._headers = response.headers return data - async def list(self, **kwargs) -> FileList: - response = await self.openai_client.with_raw_response.files.list(**kwargs) + async def list(self, purpose, **kwargs) -> FileList: + response = await self.openai_client.with_raw_response.files.list( + purpose=purpose, extra_body=kwargs + ) data = FileList(**json.loads(response.text)) data._headers = response.headers @@ -96,7 +98,7 @@ async def list(self, **kwargs) -> FileList: async def retrieve(self, file_id, **kwargs) -> FileObject: response = await self.openai_client.with_raw_response.files.retrieve( - file_id=file_id, **kwargs + file_id=file_id, extra_body=kwargs ) data = FileObject(**json.loads(response.text)) data._headers = response.headers @@ -105,7 +107,7 @@ async def retrieve(self, file_id, **kwargs) -> FileObject: async def delete(self, file_id, **kwargs) -> FileDeleted: response = await self.openai_client.with_raw_response.files.delete( - file_id=file_id, **kwargs + file_id=file_id, extra_body=kwargs ) data = FileDeleted(**json.loads(response.text)) data._headers = response.headers @@ -113,11 +115,15 @@ async def delete(self, file_id, **kwargs) -> FileDeleted: return data async def content(self, file_id, **kwargs) -> Any: - response = await self.openai_client.files.content(file_id=file_id, **kwargs) + response = await self.openai_client.files.content( + file_id=file_id, extra_body=kwargs + ) return response async def retrieve_content(self, file_id, **kwargs) -> Any: - response = await self.openai_client.files.content(file_id=file_id, **kwargs) + response = await self.openai_client.files.content( + file_id=file_id, extra_body=kwargs + ) return response async def wait_for_processing( @@ -126,12 +132,10 @@ async def wait_for_processing( *, poll_interval: float = 5.0, max_wait_seconds: float = 30 * 60, - **kwargs ) -> Any: response = await self.openai_client.files.wait_for_processing( id=id, poll_interval=poll_interval, max_wait_seconds=max_wait_seconds, - **kwargs ) return response diff --git a/portkey_ai/api_resources/apis/models.py b/portkey_ai/api_resources/apis/models.py index a8d2a920..fda5983d 100644 --- a/portkey_ai/api_resources/apis/models.py +++ b/portkey_ai/api_resources/apis/models.py @@ -12,7 +12,7 @@ def __init__(self, client: Portkey) -> None: self.openai_client = client.openai_client def list(self, **kwargs) -> ModelList: - response = self.openai_client.with_raw_response.models.list(**kwargs) + response = self.openai_client.with_raw_response.models.list(extra_body=kwargs) data = ModelList(**json.loads(response.text)) data._headers = response.headers return data @@ -21,7 +21,7 @@ def retrieve( self, model: str, *, timeout: Union[float, NotGiven] = NOT_GIVEN, **kwargs ) -> Model: response = self.openai_client.with_raw_response.models.retrieve( - model=model, timeout=timeout, **kwargs + model=model, timeout=timeout, extra_body=kwargs ) data = Model(**json.loads(response.text)) data._headers = response.headers @@ -31,7 +31,7 @@ def delete( self, model: str, *, timeout: Union[float, NotGiven] = NOT_GIVEN, **kwargs ) -> ModelDeleted: response = self.openai_client.with_raw_response.models.delete( - model=model, timeout=timeout, **kwargs + model=model, timeout=timeout, extra_body=kwargs ) data = ModelDeleted(**json.loads(response.text)) data._headers = response.headers @@ -44,7 +44,9 @@ def __init__(self, client: AsyncPortkey) -> None: self.openai_client = client.openai_client async def list(self, **kwargs) -> ModelList: - response = await self.openai_client.with_raw_response.models.list(**kwargs) + response = await self.openai_client.with_raw_response.models.list( + extra_body=kwargs + ) data = ModelList(**json.loads(response.text)) data._headers = response.headers return data @@ -53,7 +55,7 @@ async def retrieve( self, model: str, *, timeout: Union[float, NotGiven] = NOT_GIVEN, **kwargs ) -> Model: response = await self.openai_client.with_raw_response.models.retrieve( - model=model, timeout=timeout, **kwargs + model=model, timeout=timeout, extra_body=kwargs ) data = Model(**json.loads(response.text)) data._headers = response.headers @@ -63,7 +65,7 @@ async def delete( self, model: str, *, timeout: Union[float, NotGiven] = NOT_GIVEN, **kwargs ) -> ModelDeleted: response = await self.openai_client.with_raw_response.models.delete( - model=model, timeout=timeout, **kwargs + model=model, timeout=timeout, extra_body=kwargs ) data = ModelDeleted(**json.loads(response.text)) data._headers = response.headers diff --git a/portkey_ai/api_resources/apis/moderations.py b/portkey_ai/api_resources/apis/moderations.py index ad7536e7..3abe5f9b 100644 --- a/portkey_ai/api_resources/apis/moderations.py +++ b/portkey_ai/api_resources/apis/moderations.py @@ -19,7 +19,7 @@ def create( **kwargs ) -> ModerationCreateResponse: response = self.openai_client.with_raw_response.moderations.create( - input=input, model=model, **kwargs + input=input, model=model, extra_body=kwargs ) data = ModerationCreateResponse(**json.loads(response.text)) data._headers = response.headers @@ -40,7 +40,7 @@ async def create( **kwargs ) -> ModerationCreateResponse: response = await self.openai_client.with_raw_response.moderations.create( - input=input, model=model, **kwargs + input=input, model=model, extra_body=kwargs ) data = ModerationCreateResponse(**json.loads(response.text)) data._headers = response.headers