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
ResponseReceivedevent with the response text orReportErrorif 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
ImageGenerationCompletedevent with image data orReportErrorif none.
4. CreateThread
- Description: Creates a new thread for message interactions.
- Parameters:
apiKey(Text): Your OpenAI API key.
- Returns: Triggers
ThreadCreatedevent with thread data orReportErrorif 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
ThreadRetrievedevent with thread data orReportErrorif 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
ThreadModifiedevent with updated thread data orReportErrorif 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
ThreadDeletedevent with deletion status orReportErrorif 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
MessageCreatedevent with message data orReportErrorif 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
MessageRetrievedevent with message data orReportErrorif 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
MessageModifiedevent 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
MessagesListedevent with a list of messages orReportErrorif 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
TextEnteredevent 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
ListItemSelectedevent with the selected item.
15. GenerateSpeech
- Description: Generates speech from text.
- Parameters: Includes parameters for text, voice model, audio quality, and format.
- Returns: Triggers
SpeechGeneratedevent 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
VisionResponseReceivedevent with the response orReportErrorif 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
FileUploadedevent with the file ID orReportErrorif an error occurs. -
How it works: This method sends a
multipart/form-dataHTTP 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-miniorgpt-3.5-turbo).suffix(Text): Optional suffix to append to the fine-tuned model’s name.
-
Returns: Triggers
FineTuningJobStartedevent with job details orReportErrorif 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
VisionResponseReceivedevent 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:
-
Version 6: com.bosonshiggs.chatgpt.aix (55.4 KB)
-
Version 7 (GPT Vision): com.bosonshiggs.chatgpt.aix (62.3 KB)
-
Version 8 (GPT Fine-Tuning): com.bosonshiggs.chatgpt.aix (68.1 KB)
-
Version 9 (GPT Embedding): com.bosonshiggs.chatgpt.aix (72.8 KB)
-
Fast Cli Version + ProGuard: com.bosonshiggs.chatgpt.aix (50.2 KB)
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.
If you’d like to help us in our mission, you can donate to us to keep this budget-friendly work going.
Donor support
: Telegram- GitHub - click here

