Azure OpenAI Assistants Code Interpreter (Preview) - is it already fully enabled?

KarloKaluggi 20 Reputation points
2024-08-29T07:14:55.47+00:00

Hello everyone,

currently I am trying out the Azure OpenAI Assistants Code Interpreter (Preview) and somehow I can`t seem to make it work...

I am trying to upload a file to the client, to then let the assistant use this file, but python keeps telling me, that there is no file_ids as keyword argument.

Also if I check the class and method, there is no file_ids set up in the code.

Am I doing something wrong or is this not yet ready for use?

The file is uploaded without a problem and I get back a file ID, but setting up the assistant fails every time.

Here is my code:

file_path = "test.csv"

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

print(f"File '{file_path}' uploaded with ID: {file.id}")


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

print(f"Assistant created with ID: {assistant.id}")

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,913 questions
{count} votes

Accepted answer
  1. romungi-MSFT 44,771 Reputation points Microsoft Employee
    2024-08-29T15:55:15.7366667+00:00

    @KarloKaluggi I think this is a known issue, here is a case from openai repo along with correct openai sdk version.

    As per the referenced issue:

    tool_resources parameter should be used while creating assistant

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

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.