#Access Marketplace via API

1 messages · Page 1 of 1 (latest)

hexed current
#

Is it possible via API to access certain marketplace GPTs?

left belfryBOT
#

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

#

Based on the information provided in the extracts, it is currently not possible to access custom GPTs, including those in the marketplace, via an API. The GPTs are, at least currently, purely for use within the ChatGPT ecosystem and can only be accessed through the OpenAI chat interface chat.openai.com (http://chat.openai.com) (source (https://community.openai.com/t/564767)).

There are no official plans mentioned to support access to GPTs from an API call (source (https://community.openai.com/t/506972)).

The GPT Store is a marketplace where users can search for and access various GPTs, but the method of access is not specified to be via an API (source (https://help.openai.com/en/articles/8554407-gpts-faq#h_5011b277b2)).

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

#

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

hexed current
left belfryBOT
#

Let me check the knowledge base for you. One moment! :books:

#

The link you provided refers to the OpenAI Assistants API. The Assistants API allows developers to build AI assistants within their own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools: Code Interpreter, Retrieval, and Function calling. Assistants are designed to be created by developers using the OpenAI API (source (https://help.openai.com/en/articles/8673914-gpts-vs-assistants#h_79e7d54e6a)).

However, it's important to note that this API is not specifically designed for accessing GPTs from the marketplace. The GPTs and Assistants, while both being AI models, serve different purposes and are accessed differently.

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

#

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

hexed current
#

@left belfry So it's bascially like developing your own assistant rather than accessing another one

left belfryBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Yes, that's correct. The Assistants API is designed to help you create and manage your own AI assistants. You can define the behavior of the assistant, choose a model (like GPT-3.5 or GPT-4), and enable various tools such as Code Interpreter, Retrieval, and Function calling (source (https://platform.openai.com/docs/assistants/overview)).

Here's an example of how you can create an assistant using the Python SDK:

from openai import OpenAI

client = OpenAI()

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",
)

(source (https://cookbook.openai.com/examples/assistants_api_overview_python#assistants))

Once you've created an assistant, you can use its ID to interact with it via the API. However, this doesn't provide access to other pre-existing assistants or GPTs from the marketplace.

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

#

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

hexed current
#

@left belfry Did this get removed? I run version 1.9.0 of openai and don't get the from openai import OpenAI import

left belfryBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Based on the information provided in the extracts, it seems that there might be some confusion regarding the import statement from openai import OpenAI. This import statement is not mentioned in the extracts, and it's possible that it's not supported in the version of the OpenAI Python library you're using.

In one of the extracts, a user was able to successfully import the openai module and access the VERSION attribute in version 1.7.2 of the library (source (https://github.com/openai/openai-python/issues/1069)). However, there's no mention of the OpenAI class being imported from the openai module.

In another extract, a user encountered an issue when trying to access openai.ChatCompletion in version 1.0.0 or later of the library (source (https://github.com/openai/openai-python/issues/923)). The user was advised to either migrate their codebase to use the new interface or pin their installation to an older version of the library.

If you're having trouble importing the OpenAI class from the openai module, it's possible that this class doesn't exist in the version of the library you're using. You might want to check the official documentation (https://github.com/openai/openai-python) or the release notes (https://github.com/openai/openai-python/releases) for your version of the library to see if this class is supported.

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

#

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

hexed current
#

@left belfry In version 1 9 0 it looks like, they got rid of await openai ChatCompletion acreate and now I have to use await openai chat completions create. Will this still be async?

left belfryBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Yes, the method for making asynchronous calls has changed in the latest version of the OpenAI Python library. The acreate method has been removed and replaced with the AsyncOpenAI class. You can use this class to make asynchronous calls to the API. Here's an example of how you can use it:

from openai import AsyncOpenAI

client = AsyncOpenAI()

response = await client.chat.completions.create(
            model="gpt-4",
            messages=messages,
            tools=functions,
            temperature=0.0,
            tool_choice=None
        )

This code was found in a forum post (https://community.openai.com/t/how-to-do-asynchronous-calls-with-the-latest-api-version/478439/2) here.

Please note that you might encounter some issues when using the AsyncOpenAI class at scale. For example, creating new clients per request might lead to a memory leak, and reusing a global AsyncOpenAI client across requests might lead to httpx.PoolTimeout s. This information was found in another Github issue (https://github.com/openai/openai-python/issues/874) on the OpenAI Python API library.

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

#

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

hexed current
#

@left belfry Do I now have to use prompt instead of messages = messages=[{"role": "user", "content": f"{message}"}] as well or does that not make a difference?

left belfryBOT
#

Let me check the knowledge base for you. One moment! :books: