@airbolt/sdk
    Preparing search index...

    Function createChatSession

    • Create a new chat session for managing conversation state

      Parameters

      • Optionaloptions: ChatOptions

        Optional configuration for the chat session

      Returns ChatSession

      A new chat session instance

      const session = createChatSession();

      const response1 = await session.send('What is 2+2?');
      console.log(response1); // "2+2 equals 4"

      const response2 = await session.send('What did I just ask?');
      console.log(response2); // "You asked what 2+2 equals"

      console.log(session.getMessages());
      // [
      // { role: 'user', content: 'What is 2+2?' },
      // { role: 'assistant', content: '2+2 equals 4' },
      // { role: 'user', content: 'What did I just ask?' },
      // { role: 'assistant', content: 'You asked what 2+2 equals' }
      // ]
      // With provider and model
      const session = createChatSession({
      baseURL: 'https://api.airbolt.dev',
      provider: 'anthropic',
      model: 'claude-3-5-sonnet-20241022'
      });