Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Azure open AI Assistant throws TypeError: create() got an unexpected keyword argument 'file_ids' #1416

Closed
1 task done
Karishma73 opened this issue May 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Karishma73
Copy link

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

I am working on Azure notebook and while creating Azure Open AI Assistant source1, source2 I am getting TypeError: create() got an unexpected keyword argument 'file_ids', I tried the solution mentioned here even though it is not from AZURE but it gives me different error TypeError: Assistants.create() got an unexpected keyword argument 'attachments', The same code works fine locally without any TypeError: create() got an unexpected keyword argument 'file_ids' is there an update for creating assistants api on AZURE notebook(or any other cloud based notebook it is not working on Databricks notebook too , it was working on Databrick notebook few weeks ago) or it is a new bug related to this bug ? I am using gpt-35-turbo-16k-0613 model, openai 1.28.1 version. I am not using autogen library.

To Reproduce

[details](https://learn.microsoft.com/en-us/answers/questions/1665693/using-azure-open-ai-assistant-throws-typeerror-cre
Run below code in Azure or Databricks notebook to reproduce error
`from openai import AzureOpenAI

client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2024-02-15-preview",
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
)

Upload a file with an "assistants" purpose

file = client.files.create(
file=open("speech.py", "rb"),
purpose='assistants'
)

Create an assistant using the file ID

assistant = client.beta.assistants.create(
instructions="You are an AI assistant that can write code to help answer math questions.",
model="gpt-4-1106-preview",
tools=[{"type": "code_interpreter"}],
file_ids=[file.id]
)`)

image image image

Code snippets

No response

OS

Linux 22.05.09,

Python version

3.8.5

Library version

openai- 1.28.1

@Karishma73 Karishma73 added the bug Something isn't working label May 13, 2024
@kristapratico
Copy link
Contributor

@Karishma73 the version of the openai library you are using by default supports Assistants v2. Azure OpenAI does not support v2 yet. In the meantime, I recommend downgrading your openai library version to 1.20.0 which still uses the v1.

@Karishma73
Copy link
Author

thank you @kristapratico, downgrading worked for me.

@kristapratico
Copy link
Contributor

@Karishma73 FYI Azure now supports Assistants v2 with api_version="2024-05-01-preview"

@Karishma73
Copy link
Author

Karishma73 commented May 24, 2024

@kristapratico I am still getting error: BadRequestError: Error code: 400 - {'error': {'message': "Unknown parameter: 'tool_resources'.", 'type': 'invalid_request_error', 'param': 'tool_resources', 'code': 'unknown_parameter'}} while working on openai==1.28.1
Below is my code:

assistant = client.beta.assistants.create(
      instructions='''My Instruction''',
      model="My model deployment name",
      tools=[{"type": "code_interpreter"}],
      tool_resources={"code_interpreter": {"file_ids": [file.id]}}
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants