[FREE] ChatGPT with all text/voice models, Computer Vision and Dall-e 2 and 3 - Openai API

ChatGPT Extension for Kodular Creator: A Comprehensive Guide

The ChatGPT extension is a versatile tool designed for use with the OpenAI’s ChatGPT API. This guide provides a detailed overview of its public methods, parameters, and the expected outputs.

Public Methods

1. jsonDecode

  • Description: Extracts a value from a JSON text based on a specified key.
  • Parameters:
    • jsonText (Text): The JSON text to be parsed.
    • key (Text): The key for which the value is to be extracted.
  • Returns: A Text representing the value associated with the key, or an error message if the key is not found.

2. SendPrompt

  • Description: Sends a prompt to ChatGPT and triggers a response.
  • Parameters:
    • prompt (Text): The prompt to send to ChatGPT.
    • model (Text): The model of ChatGPT to use.
    • systemMsg (Text): System message to be included.
    • temperature (Number): Determines the randomness in the response.
    • apiKey (Text): Your OpenAI API key.
  • Returns: Triggers ResponseReceived event with the response text or ReportError if none.

3. GenerateImage

  • Description: Generates an image based on a given prompt.
  • Parameters:
    • prompt (Text): The prompt based on which the image is generated.
    • numberOfImages (Number): The number of images to generate.
    • apiKey (Text): Your OpenAI API key.
    • model (DallEModel): The DALL-E model to use.
    • size (ImageSize): The size of the generated image.
  • Returns: Triggers ImageGenerationCompleted event with image data or ReportError if none.

4. CreateThread

  • Description: Creates a new thread for message interactions.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
  • Returns: Triggers ThreadCreated event with thread data or ReportError if none.

5. RetrieveThread

  • Description: Retrieves an existing thread by its ID.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread to retrieve.
  • Returns: Triggers ThreadRetrieved event with thread data or ReportError if none.

6. ModifyThread

  • Description: Modifies metadata of an existing thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread to modify.
    • metadata (Text): New metadata for the thread.
  • Returns: Triggers ThreadModified event with updated thread data or ReportError if none.

7. DeleteThread

  • Description: Deletes an existing thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread to delete.
  • Returns: Triggers ThreadDeleted event with deletion status or ReportError if none.

8. CreateMessage

  • Description: Creates a message in a specified thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread where the message is to be created.
    • messageContent (Text): The content of the message.
  • Returns: Triggers MessageCreated event with message data or ReportError if none.

9. RetrieveMessage

  • Description: Retrieves a specific message from a thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread containing the message.
    • messageId (Text): The ID of the message to retrieve.
  • Returns: Triggers MessageRetrieved event with message data or ReportError if none.

10. ModifyMessage

  • Description: Modifies metadata of a message in a thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread containing the message.
    • messageId (Text): The ID of the message to modify.
    • metadata (Text): New metadata for the message.
  • Returns: Triggers MessageModified event with updated message data

or ReportError if none.

11. ListMessages

  • Description: Lists messages in a specified thread.
  • Parameters:
    • apiKey (Text): Your OpenAI API key.
    • threadId (Text): The ID of the thread whose messages are to be listed.
  • Returns: Triggers MessagesListed event with a list of messages or ReportError if none.

12. ShowNativeAudioPlayerDialog

  • Description: Shows a dialog with a native audio player.
  • Parameters:
    • title (Text): The title of the dialog.
    • audioFilePath (Text): The file path of the audio.
    • titleColor (Number): Color of the dialog title.
    • titleBackgroundColor (Number): Background color of the title.
    • dialogBackgroundColor (Number): Background color of the dialog.
  • Returns: A dialog with controls to play and pause the audio.

13. ShowTextInputDialog

  • Description: Shows a dialog with a text input.
  • Parameters: Various parameters to customize the dialog appearance and behavior.
  • Returns: Triggers TextEntered event with the entered text.

14. ShowListDialog

  • Description: Displays a dialog with a list of selectable items.
  • Parameters: Various parameters to customize the dialog and list items.
  • Returns: Triggers ListItemSelected event with the selected item.

15. GenerateSpeech

  • Description: Generates speech from text.
  • Parameters: Includes parameters for text, voice model, audio quality, and format.
  • Returns: Triggers SpeechGenerated event with the file path of the generated speech.

16. SendVisionRequest (NEW)

  • Description: Sends a vision request with an image URL or base64 data to a GPT model, allowing the AI to analyze the image and respond based on the provided text prompt.
  • Parameters:
    • maxTokens (Number): Maximum number of tokens in the response.
    • text (Text): The accompanying text prompt.
    • gptModel (VisionModel): The model to be used for processing.
    • imageData (Text): Image URL or base64-encoded image data.
    • detail (DetailParameter): Image detail level for the AI to process.
    • apiKey (Text): Your OpenAI API key.
  • Returns: Triggers VisionResponseReceived event with the response or ReportError if an error occurs.

17. UploadTrainingFile (NEW)

  • Description: Uploads a JSONL file for use in fine-tuning.

  • Parameters:

    • apiKey (Text): Your OpenAI API key.
    • filePath (Text): Path to the JSONL file to upload.
  • Returns: Triggers FileUploaded event with the file ID or ReportError if an error occurs.

  • How it works: This method sends a multipart/form-data HTTP POST request to OpenAI’s API to upload the specified JSONL file for fine-tuning purposes.

18. StartFineTuningJob (NEW)

  • Description: Starts a fine-tuning job using an uploaded JSONL file.

  • Parameters:

    • apiKey (Text): Your OpenAI API key.
    • trainingFileId (Text): The ID of the uploaded JSONL file.
    • model (Text): The base model to fine-tune (e.g., gpt-4o-mini or gpt-3.5-turbo).
    • suffix (Text): Optional suffix to append to the fine-tuned model’s name.
  • Returns: Triggers FineTuningJobStarted event with job details or ReportError if an error occurs.

  • How it works: The method sends an HTTP POST request to OpenAI’s API. The image and text prompt are sent together, and the AI responds by analyzing the image. The response is then passed to the VisionResponseReceived event or an error message is reported.

Events

The extension triggers various events corresponding to the successful execution of the methods, such as ResponseReceived, ImageGenerationCompleted, ThreadCreated, MessageCreated, VisionResponseReceived, FileUploaded, FineTuningJobStarted and more, providing necessary data or status updates.


This guide covers the key functionalities provided by the ChatGPT extension for Kodular, offering a wide range of capabilities from interacting with ChatGPT, image generation, thread and message management, to audio functionalities.

Blocks

AIX files:

GitHub: GitHub - iagolirapasssos/chatGPTAndDallE: The ChatGPT extension for MIT App Inventor now includes support for handling threads and messages within threads, providing a more dynamic and interactive experience with the OpenAI API.

AIA file (new)

ChatGPTAndDallE.aia (349.6 KB)

Click here and buy me a coffee.

:warning: If you’d like to help us in our mission, you can donate to us to keep this budget-friendly work going.

Donor support

8 Likes

thank you for your contribution!
please follow the naming conventions

also the name Extension in the package name of an extension does not really make sense…
therefore let me suggest to rename the extension from ChatGPTExtension to just ChatGPT

Taifun

1 Like

Modifications made successfully!

1 Like

Unfortunately still not following the naming conventions
Taifun

I fixed! The fixes are in the attached .aix.

Great
Please update the screenshots, too
Thank you

Taifun

1 Like

hey there i downloaded the aia file and loaded and put my own api key in. the following "The operation convert an alist to a dictionary cannot accept the argumentsconvert a list, i did not change anything else.

1 Like

See what is being returned in the event output. I tested it with my Premium and Free account.

It gives error and doing nothing.

1 Like

Vm Check your access permissions

Hello, how could I use DALLE 3 to generate images?

1 Like

I’m adding it here. It will be ready today.

The new version is available.

YOU have to add INTERNET permission

Can I build a Continuous Chat Conversation with this extension?

Conversations in Theads will be in the next version

ok that is cool and I really appreciate your effort ,
also, you can check this, I have developed an extension that has many features including Continuous Chat Conversation here :

1 Like

Very nice!!

1 Like

I updated the AIA and AIX file with a new super version.

2 Likes

the aia file opens like this;

1 Like