Closed bhasampa closed 8 months ago
Where do you get this error?
I'm having exactly the same issue - it's happening on the upload call:
def upload_file(client: AzureOpenAI, path: str) -> FileObject:
with Path(path).open("rb") as f:
return client.files.create(file=f, purpose="assistants")
I tried using the OpenAI client instead, and the same issue happens.
I also checked, when changing the purpose to fine-tune
, it returns 'fileName contains an invalid filename: wrong suffix.'
, which is expected since I'm using a PDF
, and the fine-tune expects only jsonl
.
I'm using the 2024-02-15-preview
version, and the latest version of the openai library.
Update: tested directly with API via REST, and I'm getting the same error. Observations:
assistants
results in purpose contains an invalid purpose.
assistant
results in Invalid value for purpose.
Tested against Azure OpenAI in region US East.
Dear All,
I had updated the file name in path as variable
def upload_file(client: AzureOpenAI, path: str) -> FileObject: with Path('data_0212.csv').open("rb") as f: print(f) return client.files.create(file=f, purpose="assistants")
Code started working..
Thanks, Bhaskar
@bhasampa I'm facing this issue now. Are you able to reproduce a working REST method?
Figured it out, for anyone that finds this. For me it was a region issue. I manage several different regions in my application so the region must be Assistants compatible: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#assistants-preview
Hey @danny-avila, I'm facing the same issue today with Rest API and my current region (eastUs) supports Assistants. Can you share which region you tried with?
Getting following error when I try to run in my machine.
File ~/anaconda3/envs/py310/lib/python3.10/site-packages/openai/_base_client.py:898, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 895 if not err.response.is_closed: 896 err.response.read() --> 898 raise self._make_status_error_from_response(err.response) from None 899 except httpx.TimeoutException as err: 900 if response is not None:
BadRequestError: Error code: 400 - {'error': {'code': 'invalidPayload', 'message': 'Invalid value for purpose.'}}