smart_toy

GPTAssistant

v1.1.2 • Extension Documentation

smart_toy

GPTAssistant Extension

OpenAI Assistants API for Kodular & MIT App Inventor

Build powerful AI-powered apps with conversation memory, file search, code interpretation, and real-time streaming — all with visual blocks!

inventory_2 v1.1.2
storage 103 KB
android API 14+
GPTAssistant Extension Cover
psychology

AI Assistants

Create custom AI personalities with specific instructions and capabilities.

bolt

Real-time Streaming

Get instant responses with live streaming, just like ChatGPT.

search

RAG / File Search

Upload documents and let AI answer questions from your files.

download Installation

  1. 1

    Download the Extension

    Get the .aix file from your purchase.

  2. 2

    Import into Kodular/App Inventor

    Go to Extensions → Import extension → Select the .aix file.

  3. 3

    Add to Your Project

    Drag GPTAssistant from the palette to your screen.

rocket_launch Quick Start

Follow these 6 steps to create a basic chat with your AI assistant. Each step shows the corresponding block you'll use in Kodular/App Inventor.

1

Initialize with your API key

Call this first to set up authentication with OpenAI. Get your key from platform.openai.com.

Initialize block
2

Create an Assistant with name & instructions

Define your AI's personality, capabilities, and the model to use. Handle the AssistantCreated event to get the assistant ID.

CreateAssistant block
bolt Event:
AssistantCreated event
3

Create a Thread for conversation

A Thread holds the conversation history. Create one per chat session. Handle ThreadCreated to get the thread ID.

CreateThread block
bolt Event:
ThreadCreated event
4

Add user messages to the Thread

Send the user's question or message to the thread. Role must be "user".

AddMessageToThread block
bolt Event:
MessageAdded event
5

Run the Assistant (streaming or polling)

Execute the assistant on the thread. Use CreateRunAndManage with streaming enabled for real-time responses!

CreateRunAndManage block
6

Handle response events

For streaming: use StreamTextDelta to show text as it arrives (typing effect). For polling: use RunCompletedAndMessagesFetched to get the full response.

stream Streaming Mode - Real-time typing effect:
StreamTextDelta event
sync Polling Mode - Full response at once:
RunCompletedAndMessagesFetched event
tips_and_updates
Pro Tips:
  • Store assistantId and threadId in TinyDB to reuse them across app sessions
  • Use streaming mode for a ChatGPT-like typing experience
  • Always handle the ErrorOccurred event to show user-friendly error messages

psychology Assistants

Assistants are AI entities with specific personalities, instructions, and tool capabilities. They persist across sessions and can be reused.

lightbulb
Pro Tip: Store the Assistant ID in TinyDB after creation so you don't need to create a new one each time.

forum Threads & Messages

Threads represent conversations. Messages are added to threads and maintain context across the entire conversation history.

play_circle Runs & Streaming

A Run executes the Assistant on a Thread. You can choose between polling (wait for completion) or streaming (real-time token-by-token).

sync Polling Mode

Periodically check if the run is complete. Simpler but less interactive.

stream Streaming Mode

Receive tokens as they're generated. ChatGPT-like typing effect!

folder Files & Vector Stores

Upload files to OpenAI and create vector stores for RAG (Retrieval-Augmented Generation). This enables your Assistant to search and answer questions from your documents.

code Methods Reference

GPTAssistant provides 17 methods for interacting with the OpenAI Assistants API.

bolt Events Reference

GPTAssistant fires 33 events to notify you of results, status changes, and errors.