|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIK. - Claude from Anthropic > AIK. - Message Endpoint > AIK. - Message Endpoint |
MiniRobotLanguage (MRL)
AIK.Ask Chat
Simulate a dialogue with the AI model. Can use multiple pictures.
With this command you give the AI an array and in this array each element is part of a conversation between the user and the assistant.
This means that we always have a user element and an assistant response element.
ARR.Set Array|1|0|u:Hello, I'd like to discuss some vacation plans.
ARR.Set Array|1|1|a:Hello! I'd be happy to help you with your vacation plans. What kind of vacation are you thinking about?
Based on this dialog between the user and the assistant, the model generates the answer.
Each element, each user element, can alternatively be an image, but then does not contain any further prompt. For example, if you want to have two images and then a prompt, for example to get the difference between these images, then you must always add a possibly empty wizard array element between them. See the examples below. The usage is generally not difficult, whereas here you need to use the array command. And the possibilities of what you can do with this command are endless, so you can use the AI to its limits.
#AI #entertainment #command #array #user #assistant #model #response #image #prompt #use #possibilities #limits
Intention
1.Simulate Conversations: Create a back-and-forth dialog with the AI.
2.Image Analysis: Include up to 5 images for the AI to examine and compare.
3.Flexible Input: Combine text prompts and images in a single query.
4.Context Preservation: Maintain conversation history for more coherent responses.
•u: User input (text or image)
•a: Assistant response (always text)
•s: System Prompt (use only one as the first Array Element)
•Each 'u:' element must be followed by an 'a:' element to maintain proper dialog structure.
•Images must be in the format: u:"%Image=path\to\image.png"
•The AI has a token limit (typically around 4000 tokens), which affects the length of the conversation and the number of images that can be processed.
•Easy simulation of human-like conversations
•Ability to ask questions about multiple images in one go
•Maintain context throughout a conversation for more relevant responses
•Seamless integration of text and image inputs
Set up the AI model and parameters
AIK.Set Key|Your_API_Key_Here
$$MOD=claude-3-5-sonnet-20240620
AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA
' Initialize the conversation array
ARR.Set Array|1|0|u:Hello, I'd like to discuss some vacation plans.
ARR.Set Array|1|1|a:Hello! I'd be happy to help you with your vacation plans. What kind of vacation are you thinking about?
ARR.Set Array|1|2|u:I'm considering a beach vacation. Can you show me some popular destinations?
ARR.Set Array|1|3|a:Certainly! I'd be glad to suggest some popular beach destinations. However, as an AI language model, I can't actually show you images. But I can describe some popular beach vacation spots for you. Would you like me to list a few options?
ARR.Set Array|1|4|u:Yes, please list a few options.
' Send the conversation to the AI and store the response
AIK.Ask Chat|1|$$RES|1
' Display the AI's response
DBP.Result=$$RES
ENR.
Result=
Great! Here are some popular beach vacation destinations:
1. Maldives: Known for its crystal-clear waters, white sandy beaches, and luxurious overwater bungalows.
2. Bali, Indonesia: Offers a mix of beautiful beaches, rich culture, and lush landscapes.
3. Maui, Hawaii: Features stunning beaches, volcanic landscapes, and excellent water sports opportunities.
4. Amalfi Coast, Italy: Combines picturesque beaches with charming coastal towns and delicious cuisine.
5. Bora Bora, French Polynesia: Famous for its turquoise lagoon, overwater bungalows, and romantic atmosphere.
Would you like more information about any of these destinations?
This sample code demonstrates how to set up a conversation with the AI about vacation planning. It shows how to initialize the conversation array, add user and assistant messages, and retrieve the AI's response. The response is then stored in the $$RES variable and displayed using DBP.Result.
The Anthropic Messages Chat Command offers several advantages when working with plain text and pictures:
1.Simulating dialogues: You can easily create back-and-forth conversations between the AI and a user, or even simulate conversations between multiple parties. This is great for storytelling, role-playing scenarios, or creating interactive experiences.
2.Multiple pictures: The API allows you to include multiple images in a single message. This is useful for providing visual context, comparing images, or creating a visual narrative.
3.Flexibility: You can mix text and images in various ways, allowing for rich, multimedia interactions.
4.Context retention: The API maintains context throughout a conversation, so you can refer back to previously mentioned information or images.
Limitations and important points to note:
1.Token limit: There is a maximum limit of 4096 tokens per message. This applies to the combined length of the input (your message) and the output (the AI's response). A token is roughly equivalent to 4 characters or 3/4 of a word in English.
2.Image limit: While you can include multiple images, there is a limit of 5 images per message.
3.Image format: The API currently supports common image formats like JPEG, PNG, and GIF. They will automatically be resized or converted using this command.
4.No image generation: The API can analyze and discuss images, but it cannot generate, edit, or manipulate images.
5.Text-based responses: Even when discussing images, the AI's responses will always be in text form.
6.Privacy considerations: Be mindful of the content you send, especially with images, as they are processed by the API.
These features and limitations make the Anthropic Messages API a versatile tool for creating interactive, visually-enhanced experiences without requiring deep technical knowledge. It's particularly useful for educational content, storytelling, visual analysis, and creating engaging conversational interfaces.
Sample-Code:
Ask for difference between 2 Pictures:
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620
$$ASB= Compare the two pctures and report the differences.
AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA
$$PIC=u:"%Image=?path\SampleA.png"
'$$PRO=u:Hallo wie geht es dir?
ARR.Set Array|1|0|$$PIC
$$PRO=a:Let this be Picture 1.
ARR.Set Array|1|1|$$PRO
$$PIC=u:"%Image=?path\SampleC.png"
ARR.Set Array|1|2|$$PIC
$$PRO=a:Let this be Picture 2.
ARR.Set Array|1|3|$$PRO
$$PRO=u:Was ist unterschiedlich zwischen den Bildern?
ARR.Set Array|1|4|$$PRO
AIK.Ask Chat|1|$$RES|0
DBP.Result=$$RES
ENR.
'-----------------------------------
Result=
Der Hauptunterschied zwischen den beiden Bildern liegt in Zeile 7 des Skripts:
In Bild 1 ist die Zeile 7 vollständig sichtbar und zeigt:
'#EXE:F:\00_MR\Scripts\SPR-Productive Scripts\Twitterbar-Scripts\
In Bild 2 ist ein Teil dieser Zeile mit einem gelben Balken überdeckt, so dass nur noch '#EXE:' sichtbar ist und der Rest verborgen wird.
Dies scheint der einzige erkennbare Unterschied zwischen den beiden ansonsten identischen Bildern des SPR-Editor-Fensters zu sein.
Sample 2 using a System Prompt and Auto-Increment variables:
Using a System Prompt can give better results:
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620
AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA
$$PRO=s:You are a Picture Detective finding the smallest difference between pictures using all technical tricks to do so.
AIK.Set System Prompt|$$PRO
' Using Auto-Increment Variable (RIV. / #aiv#) we can easily add more Parts inbetween
RIV.0
$$PIC=u:"%Image=?path\SampleA.png"
ARR.Set Array|1|#aiv#|$$PIC
$$PRO=a:Let this be Picture 1.
ARR.Set Array|1|#aiv#|$$PRO
$$PIC=u:"%Image=?path\SampleC.png"
ARR.Set Array|1|#aiv#|$$PIC
$$PRO=a:Let this be Picture 2.
ARR.Set Array|1|#aiv#|$$PRO
$$PRO=u:Was ist unterschiedlich zwischen den Bildern?
ARR.Set Array|1|#aiv#|$$PRO
AIK.Ask Chat|1|$$RES|0
'AIC.Show Error|$$RES
DBP.Temp=$$LDA
DBP.Result=$$RES
ENR.
'-------------------------------------
[19:57:43] Result=
Nach sorgfältigem Vergleich der beiden Bilder habe ich drei kleine Unterschiede gefunden:
1. In Bild 2 gibt es einen gelben Punkt oder Fleck in der oberen rechten Ecke des Fensters, der in Bild 1 nicht vorhanden ist.
2. In Zeile 7 des Codes wurde in Bild 2 ein Teil des Textes nach '#EXE:' mit Gelb markiert. In Bild 1 ist dieser Teil nicht hervorgehoben.
3. In Zeile 19 des Codes wurde in Bild 2 das letzte 'S' von '$RES' gelb markiert. In Bild 1 ist dieses 'S' nicht hervorgehoben.
Diese subtilen Unterschiede beziehen sich hauptsächlich auf kleine Farbänderungen oder Hervorhebungen im zweiten Bild, die im ersten Bild nicht vorhanden sind.
Syntax
AIK.Ask Chat|P1[|P2][|P3]
AIK.Ach|P1[|P2][|P3]
Parameter Explanation
P1 - <Array-Number>: This Array contains the dialog / Images / Prompts.
P2 - opt. Variable to return the result / answer from the AI. If omitted result will be on TOS.
P3 - opt. 0/1 - Flag: This flag is optional and is used to specify f the result should be also placed into the Clipboard. This is recommended especially for Unicode results that should be pasted somewhere.
Example
'***********************************
' AIK.-Sample with Dialog
'***********************************
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620
AIK.Set Mes Model|$$MOD
AIK.Set Temperature|0.21
$$PRO=u:Hallo wie geht es dir?
ARR.Set Array|1|0|$$PRO
$$PRO=a:Das Ergebnis ist 21.
ARR.Set Array|1|1|$$PRO
$$PRO=u:Wieviel ist das Ergebnis?
ARR.Set Array|1|2|$$PRO
AIK.Ask Chat|1|$$RES|0
DBP.Result=$$RES
ENR.
[18:57:02] Result=
Entschuldigung, ich habe einen Fehler gemacht.
Ich hatte in meiner vorherigen Antwort fälschlicherweise ein Rechenergebnis genannt, obwohl Sie mich nur begrüßt und nach meinem Befinden gefragt hatten.
Um Ihre aktuelle Frage zu beantworten:
Es gibt kein spezifisches Ergebnis, auf das ich mich beziehen kann, da wir vorher keine Berechnung oder Aufgabe besprochen haben.
Wenn Sie eine bestimmte Berechnung oder Frage haben, können Sie sie gerne stellen und ich werde mein Bestes tun, um Ihnen zu helfen.
'***********************************
' AIK.-Sample with Dialog and Picture
'***********************************
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620
$$ASB= Compare the two pctures and report the differences.
AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA
$$PIC=u:"%Image=?path\SampleA.png"
ARR.Set Array|1|0|$$PIC
' Important, you need to have an a: (Assistant) between two u: (User)Queries.
$$PRO=a:OK.
ARR.Set Array|1|1|$$PRO
$$PRO=u:Was ist auf dem Bild?
ARR.Set Array|1|2|$$PRO
AIK.Ask Chat|1|$$RES|0
'AIC.Show Error|$$RES
DBP.Temp=$$LDA
DBP.Result=$$RES
ENR.
Result=
Das Bild zeigt eine Benutzeroberfläche eines Programms namens "SPR-Editor 1.00". Es handelt sich um eine Entwicklungsumgebung oder einen Texteditor für Skripte.
Hauptelemente des Bildes sind:
1. Ein Textbereich mit Zeilennummern, der Programmcode oder ein Skript enthält.
2. Eine Menüleiste oben mit Optionen wie File, Edit, Search, etc.
3. Eine Reihe von Symbolen unterhalb der Menüleiste für verschiedene Funktionen.
4. Eine Seitenleiste auf der rechten Seite mit mehreren runden, farbigen Schaltflächen, die verschiedene Funktionen oder Werkzeuge darstellen könnten.
Der sichtbare Code im Textbereich enthält Kommentare und Befehle, die auf ein Skript für eine Art KI- oder Sprachmodell-Interaktion hindeuten (z.B. Verweise auf "claude-3-haiku" und AIK-Befehle).
Das Fenster zeigt auch, dass mehrere Dateien geöffnet sind, wie durch die Tabs am oberen Rand des Textbereichs zu sehen ist.
[19:20:07] ---------------
Remarks
-
Limitations:
-
See also:
•