@swiftwise.ai/sdk
v3.1.2
Published
Swiftwise AI SDK
Downloads
347
Readme
Swiftwise AI SDK
The Swiftwise AI SDK is a TypeScript library that provides an interface to interact with bespoke generative AI solutions. This SDK allows you to retrieve data, ingest data, and initialize the AI models.
Getting Started
To get started with the Swiftwise AI SDK, follow these steps:
Installation
First, install the SDK by running the following command:
npm install @swiftwise.ai/sdk
Initialization
To use the SDK, you need to initialize it with the required configuration. Here's an example of how to initialize the SDK:
import { SwiftWiseAPI, SwiftWiseConfig } from "@swiftwise.ai/sdk";
const config: SwiftWiseConfig = {
clientId: "your-client-id",
appId: "your-app-id",
sessionId: "your-session-id",
apiKey: "your-api-key",
environment: "your-environment",
debug: true,
};
const swiftWise = new SwiftWiseAPI(config);
Retrieving Data
To retrieve data from the AI models, you can use the retrieve method. It takes a RetrieverConfiguration object as input and returns a promise that resolves to an AxiosResponse containing the retrieved data or an error.
Here's an example of how to use the retrieve method:
const retrieverConfig = {
prompt: "your-prompt",
retrieverId: "your-retriever-id",
};
let retrieverResult = swiftWise.retrieve(retrieverConfig);
Ingesting Data
To ingest data into the AI models, you can use the ingest method. It takes an IngestionConfiguration object as input and returns a promise that resolves to an AxiosResponse containing the ingestion result or an error.
Here's an example of how to use the ingest method:
const ingestionConfig = {
data: "your-data",
datasourceId: "your-datasource-id",
};
let ingestionResult = await swiftWise.ingest(ingestionConfig);