SDK Installation
Install the SDK
The SDK runs in your backend and requires Redis and MongoDB drivers for history and local tool execution.
Install
Install the SDK plus Redis and Mongo drivers.
terminal
1npm install @telygent/ai-sdk
2npm install ioredis mongodbEnvironment
Store credentials and connection strings in your server environment.
.env
1TELYGENT_API_KEY=your_api_key
2REDIS_URL=redis://localhost:6379
3MONGO_URI=mongodb://localhost:27017
4MONGO_DB_NAME=appdbAfter installing the AI-SDK, there are a few things to setup in the function/controller where you wish to use Telygent AI
Create history store
The history store is where you want to save conversation messages. You can choose to store messages temporarily using Redis or use one of the available DB Stores for example:
MongoHistoryStore to save conversations to a collection in your mongo db.Create database adapter
After creating your history store, you have to connect your database using one of the available db adapters.
Build your registry
This is where you setup what database collections/tables you want the AI to access and what fields are in the tables and instructions on how to use the table etc.
Create AI client
With your history store, db adapter and registry now set, all you need to do is initialize the Telygent AiClient with these details and your apiKey.