#How assistants are deployed ?

1 messages · Page 1 of 1 (latest)

lunar oriole
#

If i use assisstant apis of OPENAI , then do i have to deploy that assisstant some where ?

sage quarryBOT
#

Hi @lunar oriole. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

When you create an assistant using OpenAI's Assistants API, you don't need to deploy it in the traditional sense. The assistant is created and managed on OpenAI's servers. You interact with the assistant by making API calls to OpenAI's servers.

Here's an example of how you might create an assistant using OpenAI's Python SDK:

from openai import OpenAI
client = OpenAI()

assistant = client.beta.assistants.create(
 name="Math Tutor",
 instructions="You are a personal math tutor. Write and run code to answer math questions.",
 tools=[{"type": "code_interpreter"}],
 model="gpt-4-turbo-preview",
)

(Source: OpenAI Docs (https://platform.openai.com/docs/assistants/overview?context=with-streaming))

Once the assistant is created, you can interact with it by creating a new thread and adding messages to it. This is done through API calls, and the state of the conversation is maintained on OpenAI's servers.

from openai import OpenAI
import os

client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", "<your OpenAI API key if not set as env var>"))

assistant = client.beta.assistants.create(
 name="Math Tutor",
 instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
 model="gpt-4-1106-preview",
)
show_json(assistant)

(Source: OpenAI Cookbook (https://cookbook.openai.com/examples/assistants_api_overview_python#assistants))

Please note that while creating an assistant, you don't need to specify a deployment name in the URL. This is different from other deployment-based features of the OpenAI API. (Source: OpenAI Github (https://github.com/openai/openai-python/issues/1163))

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@lunar oriole kapa.ai is still learning and improving, please let us know how it did by reacting below