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>
- The collection id is the id of the website you want to use. You can find it at the top of the website page in Fireaw.ai.
- You can find a prefilled version of the code above one the website page in Fireaw.ai.
- You can manage your API tokens in your Team settings.
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:
- are NOT available to other customers.
- are NOT available to OpenAI.
- are NOT used to improve OpenAI models.
- are NOT used to improve any Microsoft or 3rd party products or services.
- are NOT used for automatically improving Azure OpenAI models for your use in your resource (The models are stateless, unless you explicitly fine-tune models with your training data).
- Your fine-tuned Azure OpenAI models are available exclusively for your use.
- The Azure OpenAI Service is fully controlled by Microsoft; Microsoft hosts the OpenAI models in Microsoft’s Azure environment and the Service does NOT interact with any services operated by OpenAI (e.g. ChatGPT, or the OpenAI API).
See Data, privacy, and security for Azure OpenAI Service for more information.