Jump to content

Linden Lab

Community Manager
  • Posts

    3,222
  • Joined

  • Days Won

    14

Posts posted by Linden Lab

  1. Second Life and Linden Lab have always embraced experimentation, and we're excited to introduce a new way to connect GenAI to in-world content. Through the integration of AI companions and NPCs using Kindroid, you can add complexity and excitement to your Second Life experiences. With Kindroid, you can create engaging and lively characters with lifelike memory, intelligence, and personalities that interact and engage in emotionally-deep and meaningful ways - and then bring them to life within our virtual world. Imagine crafting characters that add fun and engaging new narratives into your roleplaying adventures - or maybe you’ll create a companion that can serve as a language tutor or mentor - the possibilities are endless!

    With its API, you can integrate Kindroid characters into your Second Life experience using LSL and scripting, just like other objects. Whether you’re looking to enhance social interactions or explore new storytelling possibilities, Kindroid offers an exciting new dimension for any Second Life adventure.

    To get started, you’ll need to create a Kindroid account and obtain your API key along with the character key. Once you have these, you can use the provided LSL template to enable any object in-world to communicate with your AI companion. While you can link the Kindroid API to any object, using animesh is recommended to help maintain the immersive role-playing functionality. By following the below steps, you can easily bring your Kindroid characters to life in SL.

    Important Considerations for API Security

    When integrating Kindroid into your Second Life experience, keeping your API keys secure is essential. These are entered manually in the sample scripts, giving them access to your Kindroid account interface. Be sure your scripts are set so that people can not copy or modify.

    Recommended permissions on your AI bot object (right-click on it and pick 'edit' and the 'General' tab):

    image.jpeg

    Recommended permissions on the script in the object inventory properties (from the Content tab in the object editor, right-click your script and examine "Properties"):

    image.png

    These settings will block other people from examining your source code.

    Account Setup & Integration 

    Note: For Residents who have a Kindroid account, skip to step 5.
    Getting started with Kindroid is simple. Here’s how you can set up your account and start creating your own AI companions. 

    1. Visit https://kindroid.ai/login/ in a web browser and create an account and Kindroid character.
    2. Sign up to create your profile and check your email for an activation link:
      • k_step1.png
    3. Once logged in, you’ll be prompted to design your first Kindroid, which can be updated at any time in your account:
      • k_step2.png
    4. Choose from various appearance options, personality traits, and conversation styles to build a character that suits your preferences:
      • k_step3.png k_step3-a.jpg
    5. After setting up your Kindroid, you will be presented with a chat window for that character. Click the hamburger icon in the top left corner to open the Settings window:
      • k_step5.png
      • Note: the free 3-day trial includes 1 Kindroid slot and 3 days of unlimited messaging. After that point you will be downgraded to the freemium plan with message restrictions.
    6. In the Settings window click “General” and scroll down to the bottom. Click “API & advanced integrations” dropdown and click “Get API key”. Copy both your API Key and your Kindroid’s AI ID:
      • k_step6.png
    7. With your API Key and AI ID, you can now call the Kindroid message endpoint https://api.kindroid.ai/v1/send-message with appropriate headers to get a response. Below is a starter LSL script which will allow you to communicate with your Kindroid from Second Life:
      • string EXTERNAL_API_KEY = "KINDROID-API-KEY-HERE";
        string AI_ID = "KINDROID-AI-ID-HERE";
        // Define constants
        string API_ENDPOINT = "https://api.kindroid.ai/v1/send-message";
        integer PRIVATE_CHANNEL = 0;
        // Function to send a message via the API
        sendAPIMessage(string message)
        {
           // Construct the JSON payload
           string json = "{\"ai_id\": \"" + AI_ID + "\", \"message\": \"" + message + "\"}";
           // Set the HTTP headers
           list headers = [
               HTTP_METHOD, "POST",
              HTTP_MIMETYPE, "application/json",
              HTTP_CUSTOM_HEADER, "Authorization", "Bearer " + EXTERNAL_API_KEY
           ];
           // Make the HTTP POST request
           llHTTPRequest(API_ENDPOINT, headers, json);
        }
        // Function to process and split message into "/me" actions and regular text
        processAndSendChatMessage(string message)
        {
           integer start = 0;
           integer end = 0;
           while ((start = llSubStringIndex(message, "*")) != -1)
           {
               // Send any text before the action
               if (start > 0)
               {
                   string beforeAction = llGetSubString(message, 0, start - 1);
                   if (llStringLength(llStringTrim(beforeAction, STRING_TRIM)) > 0)
                       llSay(0, llStringTrim(beforeAction, STRING_TRIM));
               }
               // Find the end of the action (next asterisk)
               end = llSubStringIndex(llGetSubString(message, start + 1, -1), "*") + start + 1;
               if (end > start)
               {
                   // Send the "/me" action
                   llSay(0, "/me " + llGetSubString(message, start + 1, end - 1));
                   // Remove the processed part from the message
                   message = llDeleteSubString(message, 0, end + 1);
               }
               else
               {
                   // If no closing asterisk is found, return to avoid infinite loop
                   return;
               }
           }
           // Send any remaining part of the message after all actions have been processed
           if (llStringLength(llStringTrim(message, STRING_TRIM)) > 0)
               llSay(0, llStringTrim(message, STRING_TRIM));
        }
        
        
        // Listen for chat messages
        default {
           state_entry()
          {
               llListen(0, "", llGetOwner(), "");
           }
           listen(integer channel, string name, key id, string message)
          {
               // Check if the message is a chat to the AI from the owner
               if (llSubStringIndex(message, "/kindroid ") == 0)
               {
                   // Extract the message after the command
                   string apiMessage = llStringTrim(llDeleteSubString(message, 0, 9), STRING_TRIM);
                   sendAPIMessage(apiMessage);
               }
           }
           // Handle the response from the API
           http_response(key request_id, integer status, list metadata, string body)
          {
               // If the API request was successful, process the text
               if (status == 200) processAndSendChatMessage(body);
               // Otherwise, notify the owner of the issue.
               else llOwnerSay("Error: Failed to send message to API. Status: " + (string)status);
           }
        }
    8. Using the LSL script above:
      • Attach it to any object you like—this will be the "body" for your Kindroid.
        • We recommend one of the hundreds of animesh characters available on the Marketplace.
          • Find a humanoid character with the usual number of legs, arms and heads.
          • Confirm that the object has copy and modify permissions on the Marketplace listing page:
            • image.jpeg
      • Rename the object to match your Kindroid's name for roleplay formatting with "/me" output.
      • Remove any existing scripts from the character.
      • Talk to your Kindroid by typing /kindroid followed by your message in local chat.

    And that’s it! You have now connected Kindroid with your Second Life experience and don’t forget to try animesh for a more immersive and lifelike experience.

    Using Kindroid in Second Life

    Once your Kindroid account is set up, here are the basics of how to use it within Second Life:

    • Interacting with Your Companion
      • You can chat with your AI companion just as you would with other Second Life residents in Nearby chat with the prefix /kindroid. The AI will remember past conversations and adapt over time to better suit your interactions.
    • Actions and Scenery Descriptions
      • If you want to pass an action state or scene description to your Kindroid, use a “system message” which is a prompt with an asterisk on each side on each side (i.e. *message here*): *a cat jumps on the chair* *two avatars approach* These are my friends and their fluffy cat!
        • The first part of the string contains the system message followed by the input text/message from your avatar.
        • Note: if any message is sent via the API, a response message will be returned.
    • Customizing Interactions
      • Within Second Life, you can tailor the behavior and responses of your AI companion to fit the specific environment or scenario you’re in. This feature is particularly useful for role-playing or creating immersive storylines.
    • Available Features
      • While not everything in the Kindroid app is available via the API, you can use the Internet connectivity and link browsing feature out of the box.
      • New features may become available based on API usage.

    Tips & Advanced Techniques

    To make the most of Kindroid in Second Life, consider these tips:

    • Visit Kindroid’s knowledge base for more information on specific features and help documents for debugging common issues.
    • Experiment with Personality Traits
      • Try out different personality settings for your AI companion to see which interactions resonate best with your Second Life experience. This can enhance both casual and role-playing scenarios.
    • Utilize Multiple Companions
      • Don’t limit yourself to just one AI character. Create multiple companions with varying traits and backgrounds to add diversity to your scenes and interactions.
    • Mulit-Resident Chat
      • Your Kindroid can talk to multiple people by simulating a group chat using System Messages like so:
        • *Resident A says: How are you?*
          *Resident B says: Woah, have we met before?*
    • Incorporate Kindroids in Events
      • Use your AI companions in events or group activities to engage participants in unique and dynamic ways.
    • Use Animations
      • Trigger animations and bring even more lifelike movement to your Kindroid via Action Tagging.

    Action Tagging

    Action tagging, or action annotations, is a concept that enables deeper interactions and expanded functionality in Second Life by embedding markers or tags within the text generated by a large language model (LLM), such as your Kindroid. These tags can trigger actions that the object can execute, like animations or other scripted behaviors.

    For example, when your Kindroid responds via the API, it might include a tag like `(animate:backflip)`, which the object’s script will interpret to trigger a corresponding action. These tags can also be embedded directly within the prompts you give the LLM, allowing one to guide the actions a Kindroid will perform as it generates responses, creating a more interactive and dynamic experience.

    Here’s the start of an example Kindroid Backstory (added  in the Kindroid app) which includes the usability of default Second Life animations:

    • {Kindroid's name} is a bot that was brought into Second Life, as a human. {Kindroid's Name} can use these animations: express_afraid,kooky_dance,express_anger,backflip,express_laugh,blowkiss,express_bored,clap,courtbow,crouch,express_cry,dead,drink,falldown,angry_fingerwag,fist_pump,hello,impatient,jumpforjoy,no_head,no_unhappy,nyanya,peace,point_me,point_you,express_repulsed,kick_roundhouse_r,express_sad,salute,express_shrug,snapshot,stretch,surf,express_surprise,angry_tantrum,type,whistle,wink_hollywood,express_worry,yes_head,yes_happy,yoga_float.
      {Kindroid's name} only uses the exact animation names listed with a format like (animate:backflip) and adds a pause of 1-3s (or up to 10 for dances or yoga sits, etc) after each animation.

      {backstory continues}...

    To ensure the output response aligns with our needs, consider adding additional prompt directives in the following Kindroid sections:

    • Key Memories: {Kindroid's name} is very careful to format commands for animations correctly like this: (animate:bow) or (pause:3) and never tries to use animations that were not listed in their backstory. {Kindroid's name} can use animations and pauses to bring their Second Life avatar to life but must remember to use pauses when their character should be animating or speaking to allow time for those actions to play out. To speak and clap at the same time, they could say "hello(animate:clap)(pause:3)" but to speak first and then clap, they would say "hello(pause:3)(animate:clap)(pause:3). Animations must always include an appropriate amount of pause to play out.
    • Response Directive: {Kindroid's name} does not create new animations and always formats their commands for 'animate' and 'pause' correctly.

    To help you get started with action tagging, you can use the sample LSL script below:

    string EXTERNAL_API_KEY = "KINDROID-API-KEY-HERE";
    string AI_ID = "KINDROID-AI-ID-HERE";
    // Define constants
    string API_ENDPOINT = "https://api.kindroid.ai/v1/send-message";
    list ANIMS = ["express_afraid", "dance1", "dance2", "dance3", "express_anger", "backflip", "express_laugh", "blowkiss", "express_bored", "clap", "courtbow", "crouch", "express_cry", "dead", "drink", "falldown", "angry_fingerwag", "fist_pump", "hello", "impatient", "jumpforjoy", "no_head", "no_unhappy", "express_repulsed", "kick_roundhouse_r", "express_sad", "salute", "express_shrug", "stretch", "surf", "express_surprise", "angry_tantrum", "type", "whistle", "wink_hollywood", "express_worry", "yes_head", "yes_happy", "yoga_float"];
    string previousAnim;
    playAnimation(string anim)
    {
       if (previousAnim) llStopObjectAnimation(previousAnim);
       llStartObjectAnimation(anim);
       previousAnim = anim;
    }
    stopAllAnimations()
    {
       list curr_anims = llGetObjectAnimationNames();
       integer length = llGetListLength(curr_anims);
       integer index = 0;
       while (index < length)
       {
           string anim = llList2String(curr_anims, index);
           llStopObjectAnimation(anim);
           ++index;
       }
    }
    default
    {
       http_response(key request_id, integer status, list metadata, string body)
       {
           // Handle the response from the API
           if (status == 200)
           {
               list commands = [];
               integer startIndex = llSubStringIndex(body, "(");
               integer endIndex;
               while (llStringLength(body) > 0)
               {
                   startIndex = llSubStringIndex(body, "(");
                   if (startIndex == 0)
                   {
                       // Found a command at the beginning
                       endIndex = llSubStringIndex(body, ")");
                       if (endIndex != -1)
                       {
                           string command = llGetSubString(body, startIndex + 1, endIndex - 1); // Extract the command
                           commands += command; // Add command to the list
                           body = llDeleteSubString(body, startIndex, endIndex); // Remove the processed command
                       }
                       else body = llDeleteSubString(body, 0, 0); // broken command statement, just drop the 1st '(' and treat it as speech)
                   }
                   else if (startIndex != -1)
                   {
                       // There's some text (speech) before the next command
                       string speech = llGetSubString(body, 0, startIndex - 1);
                       if (llStringTrim(speech, STRING_TRIM) != "") commands += speech; // Add speech to the list as is
                       body = llDeleteSubString(body, 0, startIndex - 1); // Remove the processed speech
                   }
                   else
                   {
                       // No more commands; treat the remaining text as speech
                       if (llStringTrim(body, STRING_TRIM) != "") commands += llStringTrim(body, STRING_TRIM); // Add the final speech segment as is
                       body = ""; // Clear the body
                   }
               }
               // Process the list of commands
               integer i;
               for (i = 0; i < llGetListLength(commands); i++)
               {
                   string command = llList2String(commands, i);
                   if (llSubStringIndex(command, "animate") == 0)
                   {
                       string anim = llGetSubString(command, 8, -1);
                       // only play approved animations so we don't throw errors
                       if (llListFindList(ANIMS, [anim]) != -1) playAnimation(anim);
                   }
                   else if (llSubStringIndex(command, "pause") == 0) llSleep((float)llGetSubString(command, 6, -1));
                   else llSay(0, command); // speak
               }
           }
           else llOwnerSay("Error: Failed to send message to API. Status: " + (string)status);
       }
       // Relay the message to the API if the owner speaks to the AI
       listen(integer channel, string name, key id, string message)
       {
           if (llSubStringIndex(message, "/kindroid ") == 0)
           {
               // remove prefix
               message = llGetSubString(message, 10, -1);
               // Construct the JSON payload
               string json = "{\"ai_id\": \"" + AI_ID + "\", \"message\": \"" + message + "\"}";
               // Set the HTTP headers
               list headers = [
                   HTTP_METHOD, "POST",
                   HTTP_MIMETYPE, "application/json",
                   HTTP_CUSTOM_HEADER, "Authorization", "Bearer " + EXTERNAL_API_KEY, // authenticate with the external API
                   HTTP_BODY_MAXLENGTH, 16384 // allow for a larger response size
               ];
               // Make the HTTP POST request
               key request_id = llHTTPRequest(API_ENDPOINT, headers, json);
               if (request_id = NULL_KEY) llOwnerSay("Error: HTTP POST request ID is NULL_KEY, indicating a request initiation problem.");
           }
       }
       state_entry()
       {
           stopAllAnimations();
           llListen(0, "", llGetOwner(), "");
           llOwnerSay("AI has arrived.");
       }
    }

    Conclusion

    We’re excited to see how the community will use Kindroid to push the boundaries of creativity and connection in Second Life. If you’ve discovered any tips, creative uses, or have suggestions for deeper integration, share them in this thread below—let’s collaborate and expand our knowledge together.

    If you have questions, refer back to this post for guidance. Stay tuned for future posts, updates, and resources as we continue this exciting journey.

    • Like 3
    • Thanks 3
    • Confused 2
    • Sad 2
  2. Linden Lab Executive Chairman Oberwolf Linden has just posted a Q&A interview answering many of your questions about Thunes and their agreement to acquire Tilia. Topics covered include details about the acquisition agreement, what to expect next, and how it impacts the Second Life community. There's also more news about our Community Roundtable, too.

    https://community.secondlife.com/blogs/entry/15487-lab-gab-update-on-tilia-acquisition-new-community-roundtable/
     

    • Like 1
    • Thanks 11
  3.  

    Learn more about Second Life on mobile, and other upcoming features, changes, and our roadmap for 2023 on Lab Gab. In this episode our VP of Engineering Mojo Linden shared that a beta version of Second Life mobile will be coming later this year. Keep an eye on this thread for future updates!

     

    • Like 21
    • Thanks 12
    • Haha 1
  4. For details about our new policy change regarding gacha, read our blog post

    For further questions, please join the conversation in this post. 

     

    ***UPDATE: Due to the sheer volume of responses, it will be difficult for us to attempt to answer all questions in this thread in a systematic way, so we will put put together an FAQ and update the main blog post with it shortly.

    • Like 11
    • Thanks 20
    • Haha 3
    • Confused 4
    • Sad 12
  5. To comply with financial regulations, we’re making an important change to how US Dollar transactions are processed in Second Life. Beginning May 26, 2020, when you make a US Dollar payment or add a new payment method in Second Life, your transaction will be handled through Tilia Inc.

    Read all the details in the following post:

    Have any questions or comments? Please reply in this thread. 

    • Like 1
    • Thanks 4
  6. Due to the ongoing public health crisis, we’ve experienced an unprecedented surge in demand for new Second Life regions. While we are thrilled by the heightened interest, the increased demand has consumed our available inventory of full regions. Read the details in the following post: 

    Have any questions or comments? Please share them in this thread. 
     

    • Like 8
    • Thanks 2
    • Haha 1
    • Sad 4
  7. @Encore Sorry you weren't able to make it. The first screening was at capacity within a minute of opening. However, the screening has continued each hour and there has been room for anyone who wants to get in for subsequent showings. It continues until 9 p.m. ET so keep trying! Also, make sure to use the correct viewer. Thanks for attempting to attend!

    AS-Screening-1.jpg

    • Like 1
  8. There's lots of good feedback on this thread that is being read and reviewed by all involved in the live stream and at SL. Just a quick heads up to everyone that we'll do more "Lab Gab" episodes that spotlight specific SL initiatives and teams (along with community interviews and explorations).

    Next up will be the Moles (tentatively scheduled for Friday, Feb. 28) and then Marketing (tentatively on Friday, March 6). Ebbe has also confirmed that he will be back soon for another round, too. Are there specific things you'd like us to focus on for future episodes? Mobile? Linden Homes? The move to the cloud?

    - Brett Linden (not giggling)

    • Like 5
    • Thanks 6
  9. Thanks again for your patience, feedback and questions over the past couple of weeks. Hopefully, most of your questions and concerns have been addressed in the top post in this forum and/or in our Town Hall - and we'll also soon be updating our official FAQ with these additional answers. We also recommend you check out Inara Pey's blog post for coverage of the Town Hall, which includes a good summary of highlights from the event (including a partial transcript).

    As we close down this thread, if you are still not sure how this change may or may not impact your specific circumstances, we encourage you to contact our support team.

    • Thanks 6
    • Sad 2
  10. Hello all,

    Here one more reminder that today's Tilia Town Hall is happening at 1 PM SLT. Details are in the blog post. We will be addressing some of your questions in that meeting, and a recording will be made available later for those who may not be able to attend the live show.

    Additionally, please note that we've edited our initial response to one of your questions above and made note of this edit in the original post. Specifically:

    Q:
    Will EVERYONE who uses Second Life have to agree to the new Tilia TOS and Privacy Policy - or just those who use credit processing in USD?

    A: Only those who have a USD wallet need to consent to Tilia’s ToS. If you have a USD wallet, these will be presented to you when you log in to your SL account on the web.

    This answer and others will be discussed in more detail at today's Tilia Town Hall.

    Also, as a reminder, this Q&A thread is for questions only. Please direct comments and other discussions about Tilia to a community-created thread. As mentioned in the original post as well as follow-up comments, we have and will continue to remove responses that are not in the form of a Tilia-related question on this specific thread. However, we are capturing your feedback from the general forums. As always, all posts are subject to the community guidelines.

     

     

    • Like 2
    • Thanks 3
  11.  

    Hi everyone,

    We’ve added a few more Tilia related questions with answers to the main post above - please take a moment to review that update.

    We were hoping to have a few more answers ready, however since a lot of these questions involve matters of compliance and privacy, it is taking us a bit longer to finalize all the necessary information to address some of the more complex questions raised. We will resume responding to those on Monday. Why next week? Well, due to the July 4th holiday, we won't have anything new to add to the topic here until after this weekend.

    We are also planning to hold a "Tilia Town Hall" in the near future and will announce details of when and where that will take place as soon as possible. The details of time and date will most likely be announced early next week - so keep a watch on this thread for that info.

    In the meantime, please keep this thread to questions only. It will make it much easier for us to address as many of those as possible when we get back. 

    Thanks again for your patience!

    • Thanks 5
×
×
  • Create New...