Official TypeScript SDK for ColiVara API - A powerful document processing and search platform. Checkout Colivara at https://colivara.com
npm install colivara-ts
# or
yarn add colivara-ts
import { ColiVara } from 'colivara-ts';
// Initialize the client
const client = new ColiVara('your-api-key');
// Example: Create a collection
async function createCollection() {
try {
const collection = await client.createCollection({
name: 'my-collection',
metadata: { description: 'My first collection' }
});
console.log('Collection created:', collection);
} catch (error) {
console.error('Error:', error);
}
}
// run the function createCollection
createCollection().catch(console.error);
// Create a collection
const collection = await client.createCollection({
name: 'research',
metadata: { topic: 'AI' }
});
// List all collections
const collections = await client.listCollections();
// Get a specific collection
const collection = await client.getCollection({
collection_name: 'research'
});
// Upload a document
const document = await client.upsertDocument({
name: 'important-doc',
collection_name: 'research',
document_path: './path/to/document.pdf'
});
// Search documents
const searchResults = await client.search({
query: 'What is machine learning?',
collection_name: 'research',
top_k: 5
});
// Search using an image file
const imageSearchResults = await client.searchImage({
collection_name: 'my-collection',
image_path: './path/to/image.jpg',
top_k: 5
});
// Create embeddings for text
const embeddings = await client.createEmbedding({
input_data: 'What is artificial intelligence?',
task: 'query'
});
// Create embeddings for images
const imageEmbeddings = await client.createEmbedding({
input_data: ['./path/to/image1.jpg', './path/to/image2.jpg'],
task: 'image'
});
createCollection({ name, metadata? })
getCollection({ collection_name })
listCollections()
deleteCollection({ collection_name })
partialUpdateCollection({ collection_name, name?, metadata? })
upsertDocument({ name, metadata?, collection_name?, document_url?, document_base64?, document_path?, wait?, use_proxy? })
getDocument({ document_name, collection_name?, expand? })
listDocuments({ collection_name?, expand? })
deleteDocument({ document_name, collection_name? })
partialUpdateDocument({ document_name, ...options })
search({ query, collection_name?, top_k?, query_filter? })
searchImage({ collection_name, image_path?, image_base64?, top_k?, query_filter? })
createEmbedding({ input_data, task? })
addWebhook({ url })
validateWebhook({ webhook_secret, payload, headers })
checkHealth()
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
# Clone the repository
git clone https://github.com/tjmlabs/colivara-ts
# Install dependencies
npm install
# regenerate the sdk client
openapi-generator generate -i https://api.colivara.com/v1/openapi.json -g typescript-axios -o . --config config.yaml
# Run tests
npm test
# Build the package
npm run build
- Write tests for new features in the
__tests__
directory - Ensure all tests pass before submitting PR
- Maintain test coverage above 99%
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.