Fireaw.ai

Documentation

Adding Fireaw.ai to your app

To add Fireaw.ai to your app, you need just to add the following HTML:

<script
  src="https://www.fireaw.ai/widget/main.js"
  chatbotId="<your chatbot id>"
  apiToken="<your api token>"
  defer
></script>

Fireaw.ai SDK

You can integrate into your own web UI using our SDK.

Installation

npm i --save @fireaw.ai/sdk

Usage

import { ChatChannel } from "@fireaw.ai/sdk";

// Create a new chat and start listening for messages using web sockets:
const channel = new ChatChannel({
  // See https://www.fireaw.ai/account to manage your API tokens
  apiToken: "<your api token here>",

  // Copy the chatbot id from the publish tab in https://www.fireaw.ai
  chatbotId: "<your chatbot id here>",

  // Will be called each time a new message is received (both user and assistant messages)
  onMessage: (message) => {
    console.log(
      `Received message: id=${message.id}, role=${message.role}, cost=${message.cost}, content=${message.content}`
    );
  },
});

// Send a message to the assistant
channel.send("What kind of products do you have for sale?");

Getting the Context

You can get the context, which is injected into the user prompt, by initializing the ChatChannel with the includContext option:

const channel = new ChatChannel({
  // See https://www.fireaw.ai/account to manage your API tokens
  apiToken: "<your api token here>",

  // Copy the chatbot id from the publish tab in https://www.fireaw.ai
  chatbotId: "<your chatbot id here>",

  // The context will be provided for each response
  includeContext: true,

  // Will be called each time a new message is received (both user and assistant messages)
  onMessage: (message) => {
    if (message.finished) {
      console.log(`Context: ${message.context}`);
    }
  },
});

Data Privacy

When you use Fireaw.ai Cloud, we store your files and web content in our own database. Questions are processed and answered via OpenAI using the access token you provided. Fireaw.ai Cloud is only suitable for information that is already public.

If you want to use Fireaw.ai on your private information, we suggest using Fireaw.ai Enterprise, which runs on your own servers and connects only to your Azure OpenAI account. When use use Fireaw.ai Enterprise, we have no access to your information, whatsoever. Azure OpenAI ensures that your prompts (inputs) and completions (outputs), your embeddings, and your training data:

See Data, privacy, and security for Azure OpenAI Service for more information.