@dummyzauto/canopus
v1.0.7
Published
An SDK for Canopus
Maintainers
Readme
Canopus SDK
The Canopus SDK provides a client for interacting with the Canopus AI platform, allowing developers to work with various AI models such as Text, Speech-to-Text (STT), Text-to-Speech (TTS), and Embedding models via a simple JavaScript API.
Installation
You can install the Canopus SDK using npm:
npm install @zauto/canopusClientor using yarn:
yarn add @zauto/canopusClientGetting Started
Import the SDK
import CanopusSDK from '@zauto/canopusClient';Create an Instance of CanopusSDK
To use the SDK, instantiate it with your API key:
const canopus = new CanopusSDK({ apiKey: 'YOUR_API_KEY' });API Methods
1. Verify API Key
Verify if the provided API key is valid.
try {
await canopus.verifyApiKey();
console.log('API key verified successfully.');
} catch (error) {
console.error('Invalid API key:', error.message);
}2. Get Models
Retrieve the list of available models. Optionally, filter models by type (TEXT, STT, TTS, EMBEDDING).
try {
const models = await canopus.getModels(); // Get all models
const textModels = await canopus.getModels('TEXT'); // Get models of type 'TEXT'
console.log(models);
} catch (error) {
console.error('Error fetching models:', error.message);
}3. Call Text Models
Call a text model with a prompt and optional chat history or system prompt.
try {
const response = await canopus.callTextModels('MODEL_ID', 'What is the capital of France?');
console.log(response.data);
} catch (error) {
console.error('Error calling text model:', error.message);
}4. Call TTS Model
Convert text to speech using a TTS model.
try {
const response = await canopus.callTtsModel('MODEL_ID', 'Hello, how are you?', 'en-IN', 'meera');
console.log(response.data);
} catch (error) {
console.error('Error calling TTS model:', error.message);
}5. Call STT Model
Convert an audio file to text using an STT model.
try {
const response = await canopus.callSttModel('MODEL_ID', '/path/to/audio.mp3', 'Optional prompt');
console.log(response.data);
} catch (error) {
console.error('Error calling STT model:', error.message);
}6. Call Embedding Model
Generate embeddings for an array of strings using an Embedding model.
try {
const response = await canopus.callEmbeddingModel('MODEL_ID', ['sentence 1', 'sentence 2']);
console.log(response.data);
} catch (error) {
console.error('Error calling embedding model:', error.message);
}Model Types
The SDK supports the following model types:
TEXT: For text-based queries.STT: Speech-to-Text models.TTS: Text-to-Speech models.EMBEDDING: For generating text embeddings.
Contributing
We welcome contributions! If you encounter any bugs or have suggestions for improvements, please create an issue or submit a pull request.
License
This SDK is licensed under the MIT License. See the LICENSE file for more details.
Support
For questions, issues, or further help, please contact us at [email protected] or visit https://canopus.zauto.ai.
Disclaimer
Please use this SDK responsibly and ensure that you comply with the terms and conditions of the Canopus AI platform.
