SmythOS SDK
    Preparing search index...

    Base class for all SDK objects.

    This class provides a base implementation for all SDK objects. It handles event emission, promise management, and initialization.

    This object is used to ensure that an SRE instance is initialized, and if not, create one with default settings.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _conversation: Conversation

    Accessors

    Methods

    • Send a prompt to the chat and get a response.

      The returned command can be executed in multiple ways:

      • Promise mode: await chat.prompt("question") - returns final result
      • Explicit execution: await chat.prompt("question").run() - same as above
      • Streaming mode: await chat.prompt("question").stream() - returns event emitter

      Parameters

      • prompt: string

        The message or question to send to the chat

      Returns ChatCommand

      ChatCommand that can be executed or streamed

      const chat = agent.chat('my_chat_id');

      // Simple prompt (promise mode)
      const answer = await chat.prompt("What is the capital of France?");


      // Streaming for long responses
      const stream = await chat.prompt("Write a detailed report").stream();
      stream.on('data', chunk => console.log(chunk));
      stream.on('end', () => console.log('Complete!'));