Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Objective-C Examples
Web API Categories

AI
ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Apple Keychain
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Markdown
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
Regular Expressions
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Objective-C) Full Transcript Mode vs Summarized Mode Conversations

See more AI Examples
When a conversation involves multimodal inputs, like images, files, or URLs, resending the full transcript can be costly. To address this, we send summary text instead of the previously sent data or URLs. This is the default approach. The FullTranscript property can be set to YES to full re-send the data or URL with the next request.

Note: This example requires Chilkat v11.2.0 or greater.

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoAi.h>
#import <NSString.h>
#import <CkoBinData.h>
#import <CkoStringBuilder.h>

BOOL success = NO;

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

CkoAi *ai = [[CkoAi alloc] init];

// The provider can be "openai", "google", "claude", "deepseek", "xai", or "perplexity".
// Support for additional providers will be added in future versions of Chilkat.
// xAI (Grok) will be used here..
ai.Provider = @"xai";

// Use your provider's API key.
ai.ApiKey = @"MY_API_KEY";

// Choose a model.
ai.Model = @"grok-4";

// Create a new conversation to be maintained locally in memory.
// If the conversation is the first to be created, it is also automatically selected.
NSString *systemMsg = @"You are a helpful assistant";
NSString *developerMsg = @"Respond only with markdown";
NSString *conversationName = @"test_conversation";
[ai NewConvo: conversationName sysMsg: systemMsg devMsg: developerMsg];

// The FullTranscript property is set to NO by default, enabling summary mode. 
// In this mode, for previously sent multimodal items, a summary message (e.g., "Previously uploaded image data") is sent instead of the actual data or URL.
ai.FullTranscript = NO;

// Add both text input and image data
[ai InputAddText: @"Describe what you see in the following image."];

CkoBinData *bd = [[CkoBinData alloc] init];
// We're passing a relative local file path here.. (relative the the app's current working directory)
success = [bd LoadFile: @"qa_data/jpg/starfish.jpg"];
if (success == NO) {
    NSLog(@"%@",bd.LastErrorText);
    return;
}

// The full image data is sent in this request because it is part of the current inputs.
// In the followup request (below), the summary text is sent instead of the image data.
// (But remember, the AI's response is part of the transcript, and it will also be sent.  Therefore,
// the transcript sent in the followup request will have information about what is contained in the image.)
NSString *summaryText = @"image previously uploaded.";
[ai InputAddImageData: bd summary: summaryText];

// Ask the AI for text output.
success = [ai Ask: @"text"];
if (success == NO) {
    NSLog(@"%@",ai.LastErrorText);
    return;
}

// Get the text response.
CkoStringBuilder *sbResponse = [[CkoStringBuilder alloc] init];
[ai GetOutputTextSb: sbResponse];
NSLog(@"%@",[sbResponse GetAsString]);

// Sample output:

// ### Image Description
// 
// - **Subject**: A small, orange starfish (sea star) with five arms radiating from a central body.
// - **Color**: Bright orange with subtle shading for texture.
// - **Texture**: Bumpy or nodular surface, resembling the rough skin of a real starfish.
// - **Position**: Viewed from above, slightly tilted, with one arm pointing upwards.
// - **Background**: Plain white, making the starfish the focal point.
// - **Style**: Appears to be a realistic illustration or photo, possibly a clipart or icon.

// ---------------------------
// Now let's send a followup question.  The image data will not be included in what is sent because FullTranscript is NO.
// However, the summary text and the AI assistant's previous answer IS sent.
[ai InputAddText: @"How is this starfish different than a Brisingida?"];

success = [ai Ask: @"text"];
if (success == NO) {
    NSLog(@"%@",ai.LastErrorText);
    return;
}

// Get the text response.
[sbResponse Clear];
[ai GetOutputTextSb: sbResponse];
NSLog(@"%@",[sbResponse GetAsString]);

// Sample output:

// ### Differences Between the Described Starfish and Brisingida
// 
// The starfish described in the image appears to be a typical shallow-water sea star (likely from the order Asteroida or similar), while Brisingida is a distinct order of deep-sea starfish. Here's a breakdown of key differences based on general characteristics:
// 
// - **Number of Arms**:
//   - Described Starfish: 5 arms (standard for many common starfish like those in the Asterias genus).
//   - Brisingida: Typically 6 to 20 arms (often more than 5, with some species having up to 16 or more).
// 
// - **Arm Structure and Flexibility**:
//   - Described Starfish: Shorter, stiffer arms with a bumpy, nodular texture; arms are broader and less flexible, suited for crawling on surfaces.
//   - Brisingida: Long, slender, highly flexible arms covered in spines; they resemble brittle stars and are adapted for suspension feeding by extending arms into water currents.
// 
// - **Size and Body Shape**:
//   - Described Starfish: Small and compact, with a central disc and radiating arms; overall body is relatively flat and sturdy.
//   - Brisingida: Larger central disc with arms that can be very elongated (up to several times the disc's diameter); body is more delicate and adapted for deep-sea environments.
// 
// - **Habitat and Lifestyle**:
//   - Described Starfish: Likely shallow coastal waters; active predators or scavengers that move across the seafloor.
//   - Brisingida: Deep-sea (abyssal) environments, often at depths of 1,000–5,000 meters; passive filter feeders that attach to substrates and capture plankton from currents.
// 
// - **Color and Appearance**:
//   - Described Starfish: Bright orange, which is common in many shallow-water species for camouflage or warning.
//   - Brisingida: Often reddish, orange, or purplish, but with a more spiny, feathery look due to pedicellariae (tiny pincer-like structures) and spines.
// 
// - **Regeneration and Reproduction**:
//   - Both can regenerate arms, but Brisingida may have more specialized adaptations for deep-sea survival, including asexual reproduction in some species.
// 
// If the image represents a specific species (e.g., a common sea star like *Asterias rubens*), these differences would be even more pronounced. Brisingida are rarer and not commonly encountered outside scientific contexts. For precise identification, more details or a real photo would help!
 

© 2000-2025 Chilkat Software, Inc. All Rights Reserved.