#customGPT actions

1 messages · Page 1 of 1 (latest)

visual fable
#

is it possible to use the API in custom GPT actions to be able to do things that regular customGPT cant?

exotic parcelBOT
#

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

#

Yes, it is possible to use the API in custom GPT actions to extend its capabilities beyond what regular custom GPT can do. Custom actions in GPT allow you to connect the GPT to APIs, enabling it to integrate external data or interact with the real-world. This could involve connecting GPTs to databases, integrating them with your emails, or making them your shopping assistant, all through APIs.

The design of actions builds upon insights from OpenAI's plugins beta, granting developers greater control over the model and how their APIs are called. Actions are defined using the OpenAPI specification, which is a standard for describing APIs.

However, it's important to note that there is no direct API available for accessing a Custom GPT. You can create similar functionality using Assistants API and then use that via API.

For example, if you have an action schema, you can convert it to a function definition and use it to fetch your external API endpoint. When the function is invoked in the run, get the parameters from the tools and use it to fetch your external API endpoint. Submit the response back to the run.

Here are the relevant knowledge sources for your reference:


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

#

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

visual fable
#

@exotic parcel please give me a spec for an action that calls the chat completion

exotic parcelBOT
#

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

#

Sure, here's an example of a function specification that could be used to interface with a hypothetical API. This example is taken from the OpenAI Cookbook's guide on how to call functions with chat models. Please note that this is a hypothetical example and may not directly apply to the Chat Completion API.

{
 "type": "function",
 "function": {
 "name": "get_current_weather",
 "description": "Get the current weather",
 "parameters": {
 "type": "object",
 "properties": {
 "location": {
 "type": "string",
 "description": "The city and state, e.g. San Francisco, CA",
 },
 "format": {
 "type": "string",
 "enum": ["celsius", "fahrenheit"],
 "description": "The temperature unit to use. Infer this from the users location.",
 },
 },
 "required": ["location", "format"],
 },
 }
}

In this example, the function get_current_weather is defined, which takes two parameters: location and format. The location parameter is a string that represents the city and state (e.g., "San Francisco, CA"), and the format parameter is a string that specifies the temperature unit to use (either "celsius" or "fahrenheit").

You would need to replace this with the actual specification for the Chat Completion API, which would include the parameters required for a chat completion request (such as the model, the prompt, max tokens, etc.).

Please note that OpenAI's GPT-3 does not directly support calling the Chat Completion API as a function. This is a hypothetical example to illustrate how function specifications work in the context of the OpenAI API.

#

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

fathom lantern
#

does anyone know how to get the assistants api?

visual fable
exotic parcelBOT
#

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

#

The Assistants API by OpenAI allows you to build AI assistants within your own applications. These assistants can leverage models, tools, and knowledge to respond to user queries. Here's a step-by-step guide on how to use the Assistants API:

  1. Create an Assistant: You can create an assistant by defining its custom instructions and picking a model. If helpful, add files and enable tools like Code Interpreter, Retrieval, and Function calling. You can do this through the Assistants Dashboard (https://platform.openai.com/assistants) or directly through the Assistants API. Here's an example of creating an assistant using the Python SDK:
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",
)
  1. Create a Thread: When a user starts a conversation, create a Thread. Threads simplify AI application development by storing message history and truncating it when the conversation gets too long for the model’s context length.

  2. Add Messages to the Thread: As the user asks questions, add Messages to the Thread.

  3. Run the Assistant on the Thread: Generate a response by calling the model and the tools. Run the Assistant on the Thread.

Remember to keep track of the Assistant ID. This is how you'll refer to your Assistant throughout Threads and Runs.

#

You can explore the capabilities of the Assistants API using the Assistants playground (https://platform.openai.com/playground?mode=assistant) or by building a step-by-step integration outlined in the Assistants API Overview (https://platform.openai.com/docs/assistants/overview?context=with-streaming).

Please note that calls to the Assistants API require that you pass a beta HTTP header. This is handled automatically if you’re using OpenAI’s official Python or Node.js SDKs.

OpenAI-Beta: assistants=v1

For more detailed information, you can refer to the OpenAI API documentation (https://platform.openai.com/docs/api-reference) and the Assistants API Overview (https://platform.openai.com/docs/assistants/overview?context=with-streaming).

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

#

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