run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.26k stars 5.17k forks source link

[Bug]: OpenAIAssistantAgent now breaks because of OpenAI api changes #12968

Closed parnell closed 5 months ago

parnell commented 6 months ago

Bug Description

OpenAI changed their api and now llama-index has errors with OpenAIAssistantAgent.

Comment from OpenAI about the issue I believe. From [https://docs.llamaindex.ai/en/stable/examples/agent/openai_assistant_agent/](LLama Index example code)

from llama_index.agent.openai import OpenAIAssistantAgent

agent = OpenAIAssistantAgent.from_new(
    name="Math Tutor",
    instructions="You are a personal math tutor. Write and run code to answer math questions.",
    openai_tools=[{"type": "code_interpreter"}],
    instructions_prefix="Please address the user as Jane Doe. The user has a premium account.",
)

How should I resolve this until it gets resolved in a better manner?

Version

0.10.30

Steps to Reproduce

from llama_index.agent.openai import OpenAIAssistantAgent

agent = OpenAIAssistantAgent.from_new(
    name="Math Tutor",
    instructions="You are a personal math tutor. Write and run code to answer math questions.",
    openai_tools=[{"type": "code_interpreter"}],
    instructions_prefix="Please address the user as Jane Doe. The user has a premium account.",
)

Relevant Logs/Tracbacks

Traceback (most recent call last):
  File ".../projects/server/error.py", line 7, in <module>
    agent = OpenAIAssistantAgent.from_new(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.11/site-packages/llama_index/agent/openai/openai_assistant_agent.py", line 230, in from_new
    assistant = client.beta.assistants.create(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Assistants.create() got an unexpected keyword argument 'file_ids'
dosubot[bot] commented 6 months ago

Hello @parnell! 👋 I'm Dosu, a bot here to help you squash bugs, answer your questions, and guide you towards becoming a contributor while we wait for a human maintainer to chime in. I'm looking into your issue with the OpenAIAssistantAgent and will get back to you with a solution shortly!

logan-markewich commented 6 months ago

Nothing to be done except a PR that fixes it 👍🏻 Will try to take a look this weekend, but feel free to make a PR now if you are motivated