clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/README.md
This package provides an embedding function for the Qwen model family hosted on Chroma's cloud embedding service.
npm install @chroma-core/chroma-cloud-qwen
import { ChromaClient } from "chromadb";
import {
ChromaCloudQwenEmbeddingFunction,
ChromaCloudQwenEmbeddingModel,
ChromaCloudQwenEmbeddingTask,
} from "@chroma-core/chroma-cloud-qwen";
// Initialize the embedder
const embedder = new ChromaCloudQwenEmbeddingFunction({
model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,
task: ChromaCloudQwenEmbeddingTask.CODE_TO_CODE,
apiKeyEnvVar: "CHROMA_API_KEY",
});
// 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,
});
Set your Chroma API key as an environment variable:
export CHROMA_API_KEY=your-api-key
Get your API key from Chroma's dashboard.
CHROMA_API_KEY)Qwen/Qwen3-Embedding-0.6B