Skip to main content

OpenAI Advanced

The OpenAI Advanced Connector empowers you to seamlessly integrate OpenAI's advanced AI capabilities into your applications. With this connector, you can harness the power of language models like GPT-3 and image models like DALL-E to generate text, images, code, and more.

Prerequisite for OpenAI Connector

  1. OpenAI API Key: Obtain an API key from OpenAI by signing up for an account and creating a new API key. This key is required to authenticate your requests when using the OpenAI Connector.

  2. Environment Setup: Ensure you have a development environment capable of making HTTP requests to external APIs. This could involve using programming languages like Python, JavaScript, or any language that supports HTTP requests.

Configuring API Connector in DronaHQ

Add a Connector name. Then add the API key for the connector account. Once all details are added, click Finish. Your connector configuration is now done.

After successfully configuring and saving the connector settings, you can easily access your newly connected account by navigating to the connected accounts list. You can find this option from the Connector -> Manage Account section. This centralized location allows you to conveniently monitor and manage your connected accounts.

Supported API endpoints

GetModelsRetrieve a list of available models and their details for text and language tasks.
CreateCompletionGenerate text completions using the OpenAI API.
CreateChatCompletionEngage in interactive conversations with the ChatGPT model to generate dynamic chat responses.
CreateEditCreate an edit on a text prompt to improve or refine the generated content.
CreateImageGenerate images based on textual descriptions using the DALL-E model.
CreateImageEditEdit and refine the generated images to achieve the desired visual content.
CreateImageVariationGenerate multiple variations of an image by altering the input descriptions.
CreateEmbeddingsObtain text embeddings that capture the semantic meaning of text for various NLP applications.
CreateTranscriptionTranscribe spoken audio content into textual format using OpenAI's audio transcription.
CreateTranslationTranslate text content from one language to another using the OpenAI translation model.
ListFilesList all uploaded files in your OpenAI account.
UploadFileUpload a file to your OpenAI account for processing or storage.
DeleteFileDelete a specific file from your OpenAI account.
RetrieveFileRetrieve metadata for a specific file stored in your OpenAI account.
RetrieveFileContentRetrieve the content of a specific file stored in your OpenAI account.
CreateFineTuneCreate a fine-tuned model from a base model for specific tasks.
ListFineTunesList all fine-tuned models available in your OpenAI account.
RetrieveFineTuneRetrieve details of a specific fine-tuned model.
CancelFineTuneCancel a fine-tuning process that is in progress.
ListFineTuneEventsList events related to a fine-tuned model in your OpenAI account.
DeleteFineTunedModelDelete a specific fine-tuned model from your OpenAI account.
CreateModerationCreate a moderation request for text content to assess for inappropriate material.
ListEnginesRetrieve a list of available engines for various AI tasks.
RetrieveEngineRetrieve details about a specific engine available in your OpenAI account.

Using OpenAI Advanced Connector

Creating an Image file

The sub-API of CreateImage which generates images for us with the help of some user inputs on the desired image.

After selecting your account for using the OpenAI connector. We need to provide details regarding what type of image we want OpenAI to retrieve.

  • Prompt: A text description of the desired image is required as user input.

  • Size: Specify the dimension of the desired image. Choose from the following size options: 256x256, 512x512, or 1024x1024. This determines the dimensions of the generated images.

  • User: Provide a unique identifier that represents your end-user. This identifier helps OpenAI to monitor and detect any potential misuse or abuse.

  • Response Format: The image retrieved from the request can be obtained in one of two formats: URL or B64_JSON. Choose the format that best suits your application's needs.

  • N: Indicate the number of images you require as output. This parameter allows you to generate multiple images based on the provided input description.

Receiving response from OpenAI to generate image
Receiving response from OpenAI to generate image

You can see that we are getting two URLs as responses from our OpenAI connector CreateImage endpoint.

Creating Chat Completion

This subcategory of the OpenAI connector enables you to create a chat completion sentence for a given conversation.

Let’s see how to use CreateChatCompletion endpoint and fetch the results.

Details are required for the endpoint request body. There are several attributes, some of them are required to make a successful request with no error in the response and some of them are optional to make AI come up with a better and more effective response.

  • Model: ID of the model to use. Ensure model compatibility with Chat API.
  • Message: Messages for chat completions in array format (e.g., [{“role”: “user”, “content”: “Hello!”}]).
  • Max Tokens: Maximum tokens for chat completion respecting model context length.
  • Temperature: Sampling temperature (0 to 2). Higher: more randomness; Lower: more focus.
  • N: Number of chat choices per input message.
  • Stream: If set, send partial message deltas as server-sent events.
  • Top P: Nucleus sampling. Consider tokens with top_p probability mass.
  • Presence Penalty: Penalize new tokens based on appearance.
  • Frequency Penalty: Penalize tokens based on existing frequency.