0.1.7 • Published 5 months ago

@chroma-core/cohere v0.1.7

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

Cohere Embedding Function for Chroma

This package provides a Cohere embedding provider for Chroma.

Installation

npm install @chroma-core/cohere

Usage

import { ChromaClient } from 'chromadb';
import { CohereEmbeddingFunction } from '@chroma-core/cohere';

// Initialize the embedder
const embedder = new CohereEmbeddingFunction({
  apiKey: 'your-api-key', // Or set COHERE_API_KEY env var
  modelName: 'embed-english-v3.0', // Optional, defaults to 'embed-english-v3.0'
});

// Create a new ChromaClient
const client = new ChromaClient({
  path: 'http://localhost:8000',
});

// Create a collection with the embedder
const collection = await client.createCollection({
  name: 'my-collection',
  embeddingFunction: embedder,
});

// Add documents
await collection.add({
  ids: ["1", "2", "3"],
  documents: ["Document 1", "Document 2", "Document 3"],
});

// Query documents
const results = await collection.query({
  queryTexts: ["Sample query"],
  nResults: 2,
});
0.1.7

5 months ago

0.1.5

5 months ago

0.1.4

5 months ago

0.1.0

5 months ago