![]()  | 
  
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
 
      (SQL Server) Full Transcript Mode vs Summarized Mode ConversationsSee more AI ExamplesWhen 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. TheFullTranscript property can be set to 1 to full re-send the data or URL with the next request.Note: This example requires Chilkat v11.2.0 or greater. 
 -- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) DECLARE @success int SELECT @success = 0 -- This example assumes the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @ai int EXEC @hr = sp_OACreate 'Chilkat.Ai', @ai OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- 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.. EXEC sp_OASetProperty @ai, 'Provider', 'xai' -- Use your provider's API key. EXEC sp_OASetProperty @ai, 'ApiKey', 'MY_API_KEY' -- Choose a model. EXEC sp_OASetProperty @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. DECLARE @systemMsg nvarchar(4000) SELECT @systemMsg = 'You are a helpful assistant' DECLARE @developerMsg nvarchar(4000) SELECT @developerMsg = 'Respond only with markdown' DECLARE @conversationName nvarchar(4000) SELECT @conversationName = 'test_conversation' EXEC sp_OAMethod @ai, 'NewConvo', @success OUT, @conversationName, @systemMsg, @developerMsg -- The FullTranscript property is set to 0 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. EXEC sp_OASetProperty @ai, 'FullTranscript', 0 -- Add both text input and image data EXEC sp_OAMethod @ai, 'InputAddText', @success OUT, 'Describe what you see in the following image.' DECLARE @bd int EXEC @hr = sp_OACreate 'Chilkat.BinData', @bd OUT -- We're passing a relative local file path here.. (relative the the app's current working directory) EXEC sp_OAMethod @bd, 'LoadFile', @success OUT, 'qa_data/jpg/starfish.jpg' IF @success = 0 BEGIN EXEC sp_OAGetProperty @bd, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @bd RETURN END -- 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.) DECLARE @summaryText nvarchar(4000) SELECT @summaryText = 'image previously uploaded.' EXEC sp_OAMethod @ai, 'InputAddImageData', @success OUT, @bd, @summaryText -- Ask the AI for text output. EXEC sp_OAMethod @ai, 'Ask', @success OUT, 'text' IF @success = 0 BEGIN EXEC sp_OAGetProperty @ai, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @bd RETURN END -- Get the text response. DECLARE @sbResponse int EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponse OUT EXEC sp_OAMethod @ai, 'GetOutputTextSb', @success OUT, @sbResponse EXEC sp_OAMethod @sbResponse, 'GetAsString', @sTmp0 OUT PRINT @sTmp0 -- 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 0. -- However, the summary text and the AI assistant's previous answer IS sent. EXEC sp_OAMethod @ai, 'InputAddText', @success OUT, 'How is this starfish different than a Brisingida?' EXEC sp_OAMethod @ai, 'Ask', @success OUT, 'text' IF @success = 0 BEGIN EXEC sp_OAGetProperty @ai, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @bd EXEC @hr = sp_OADestroy @sbResponse RETURN END -- Get the text response. EXEC sp_OAMethod @sbResponse, 'Clear', NULL EXEC sp_OAMethod @ai, 'GetOutputTextSb', @success OUT, @sbResponse EXEC sp_OAMethod @sbResponse, 'GetAsString', @sTmp0 OUT PRINT @sTmp0 -- 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! EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @bd EXEC @hr = sp_OADestroy @sbResponse END GO  | 
  ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.