@eloquentai/chat-sdk
v0.24.0
Published
React SDK for integrating Eloquent AI's chat functionality into your applications.
Maintainers
Readme
@eloquentai/chat-sdk
React SDK for integrating Eloquent AI's chat functionality into your applications.
Prerequisites
- React 18 or higher
- Node.js 18 or higher
- A modern browser that supports ES6+
Installation
# Using npm
npm install @eloquentai/chat-sdk
# Using yarn
yarn add @eloquentai/chat-sdk
# Using pnpm
pnpm add @eloquentai/chat-sdkQuick Start
React Implementation
To use the SDK in a React application, you can import the Chat component from the SDK.
import { Chat } from "@eloquentai/chat-sdk";
function App() {
return (
<Chat
// REQUIRED - Your Eloquent AI app ID
appId="YOUR_APP_ID"
// OPTIONAL - You can provide an unique id that should be used to identify the user
userId={crypto.randomUUID()}
/>
);
}Vanilla Implementation
To use the SDK in a vanilla environment, you can include the script tag in your HTML file.
<script src="https://unpkg.com/@eloquentai/chat-sdk"></script>
<div id="chat"></div>
<script>
EloquentChatSDK.renderChat(document.getElementById("chat-container"), {
// REQUIRED - Your Eloquent AI app ID
appId: "YOUR_APP_ID",
// OPTIONAL - You can provide an unique id that should be used to identify the user
userId: crypto.randomUUID(),
});
</script>