PenguinAI Extension Documentation

The PenguinAI extension brings the power of artificial intelligence to your PenguinMod projects. This extension provides blocks for AI text generation, image creation, streaming conversations, and advanced chatbot management. Perfect for creating interactive AI-powered games, educational tools, and creative projects.

Getting Started

Simple Blocks (For Beginners)

Ask AI

(ask AI: [Hello! How are you?] :: #009CCC)

The simplest way to interact with AI. Ask any question and get an instant response.

Examples:

Set Model

set Model to [GPT-4o v] :: #009CCC

Choose which AI model to use for your requests. Different models have different capabilities and response styles.

Available models include:

Get Current Model

(get current model :: #009CCC)

Returns the name of the currently selected AI model.

Check Model Status

<is model [gpt-4o] working? :: #009CCC>

Checks if a specific AI model is currently available and functioning properly.

Message Management

Get Prompt Templates

(get prompt [PenguinBot (Character) v] :: #009CCC)

Access pre-made prompt templates for different AI personalities and use cases.

Available templates include:

Generate Text (No Context)

(generate from text (no context): [How are you?] :: #009CCC)

Send a single message to AI without maintaining conversation history. Each request is independent.

Use cases:

Send to Chat

(send text [What is "Foo, Bar"?] to [Foo] :: #009CCC)

Send a message to a named chatbot that remembers conversation history. This allows for ongoing conversations with context.

Attach Image to Next Message

attach image [datauri or url] to next message :: #009CCC

Add an image to your next AI request. The AI can analyze, describe, or answer questions about the image.

Supported formats:

Inform Chat

inform [Foo] that [You can only speak in meows and other cat noises.] :: #009CCC

Give special instructions or personality traits to a chatbot. This affects all future responses from that chatbot.

Examples:

Chatbot Management

Create Chatbot

create chatbot named [Foo] :: #009CCC

Create a new chatbot with its own conversation history and personality.

Delete Chatbot

delete chatbot [Foo] :: #009CCC

Permanently remove a chatbot and all its conversation history.

Reset Chat History

reset chat history of [Foo] :: #009CCC

Clear all conversation history for a chatbot while keeping the chatbot itself.

Export Chat History

(chat history of [Foo] as Array :: #009CCC)

Get the complete conversation history of a chatbot as JSON data for saving or analysis.

Import Chat History

import chat history from [Array goes here] as [Foo] :: #009CCC

Load previously saved conversation history into a chatbot.

Import All Chats

Import chats from [Array goes here] and [Merge/Update existing chats v] :: #009CCC

Load multiple chatbots at once. Choose whether to merge with existing chats or replace them entirely.

Export All Chats

(all chats as Arrays :: #009CCC)

Export all your chatbots and their histories as JSON data for backup or sharing.

List Active Chats

(currently active chats :: #009CCC)

Get a list of all currently created chatbot names.

Streaming (Advanced) (CURRENTLY IN DEVELOPMENT | NOT IN EXTENSION)

Start Streaming Request

start streaming request [Tell me a story] to [StreamChat] :: #009CCC

Begin a streaming AI conversation where responses arrive in real-time chunks instead of waiting for the complete response.

Benefits:

When New Stream Chunk Received

when new stream chunk received :: #009CCC hat

This hat block triggers every time a new piece of text arrives from a streaming request. Use this to update your interface in real-time.

Current Stream Chunk

(current stream chunk :: #009CCC)

Get the latest piece of text that just arrived from the streaming request. This updates with each new chunk.

Is Stream Active?

<is stream active? :: #009CCC>

Check if a streaming request is currently in progress.

Stop Current Stream

stop current stream :: #009CCC

Manually stop an active streaming request before it completes naturally.

Image Generation

Generate Image URL

(generate [Penguin in Space] from [Dall-e 3 v] and get URL :: #009CCC)

Create an AI-generated image from a text description and get the URL to the image.

Examples:

Generate and Import Image

generate [Penguin in Space] from [Dall-e 3 v] and import as costume with name [Penguin] :: #009CCC

Generate an AI image and automatically add it as a costume to your current sprite.

This is perfect for:

Advanced Image Generation

(generate [1] images of [Penguin in Space] from [Dall-e 3 v] with size [1024]x[1024] and get URLs :: #009CCC)

Generate multiple AI images with custom dimensions and get all URLs as a JSON array.

Parameters:

Returns: JSON array of image URLs, for example:

["https://image1.url", "https://image2.url", "https://image3.url"]

Use cases:

Advanced API Settings

Set API URL

set Reverse Proxy API URL to [https://api.example.com/v1] :: #009CCC

Configure a custom API endpoint for AI requests. This allows you to use different AI service providers.

Set Temperature

set Temperature to [1] :: #009CCC

Control the randomness and creativity of AI responses:

Check API Status

<is the Reverse Proxy working? :: #009CCC>

Test if your configured API endpoint is responding properly.

Practical Examples

Simple Chatbot

when flag clicked create chatbot named [Helper] inform [Helper] that [You are a helpful assistant] when space key pressed ask [What would you like to know?] and wait set [response v] to (send text (answer) to [Helper]) say (response) for (2) seconds

Streaming Story Generator (CURRENTLY USES FEATURES IN DEVELOPMENT | NOT IN EXTENSION)

when flag clicked start streaming request [Tell me a fantasy adventure story] to [Storyteller] when new stream chunk received set [story v] to (join (story) (current stream chunk)) say (current stream chunk) for (1) seconds

Image Generator

when flag clicked ask [Describe an image to generate:] and wait set [image url v] to (generate (answer) from [Dall-e 3 v] and get URL) generate (answer) from [Dall-e 3 v] and import as costume with name [Generated] switch costume to [Generated v]

Advanced Image Generation

when flag clicked ask [Describe images to generate:] and wait set [image urls v] to (generate [3] images of (answer) from [flux v] with size [512]x[512] and get URLs) set [url list v] to (image urls) repeat (3) set [current url v] to (item (counter) of (url list)) // Use the URL to display or save the image say (current url) for (2) seconds end

Multi-Character Conversation

when flag clicked create chatbot named [Alice] create chatbot named [Bob] inform [Alice] that [You are optimistic and cheerful] inform [Bob] that [You are logical and analytical] when [1 v] key pressed set [alice response v] to (send text [What do you think about space exploration?] to [Alice]) set [bob response v] to (send text (alice response) to [Bob]) say (join [Alice: ] (alice response)) wait (2) seconds say (join [Bob: ] (bob response))

Error Handling

The extension includes built-in error handling:

Common error messages:

Tips and Best Practices

  1. Model Selection: Use GPT-4o for complex tasks, GPT-3.5 for simple questions, you can also do research on the other models available on the Reverse Proxy.
  2. Temperature Settings: Lower values (0.3-0.7) for factual content, higher (1.0+) for creative writing
  3. Chat Management: Create separate chatbots for different purposes or characters
  4. Image Generation: Be specific in your descriptions for better results
  5. Error Handling: Always check for error messages in responses

Privacy and Safety