Assistants API documentation does not mention where "client" comes from

Hi y’all, I’m going through the API documentation here and I’m trying to follow but there seems to be no mention whatsoever where “client” comes from in the API.

I’m extremely confused. The Live Stream just said this API was available, and I’m trying to use it but I can’t even invoke it without more information!

1 Like

Hey @ctavolazzi I also struggled with that, I hope they will refine the official documentation.
I found the answer in the python repo github page

Basically:

from openai import OpenAI

client = OpenAI(
    # defaults to os.environ.get("OPENAI_API_KEY")
    api_key="My API Key",
)

Example

from openai import OpenAI

client = OpenAI()
assistant = client.beta.assistants.create(
  name="Test",
  description="",
  model="gpt-4-1106-preview",
  tools=[{"type": "code_interpreter"}],
  file_ids=[]
)

Note that I had to update my openai version for it to work (pip install --upgrade openai)

If you’re working on another language I guess they have a similar repos on that language.
Hoping this helps!

1 Like