Skip to content

Instantly share code, notes, and snippets.

@tonyOreglia
Created April 26, 2023 14:54
Show Gist options
  • Select an option

  • Save tonyOreglia/86fcff89aa2f1975f351d763bf28ad22 to your computer and use it in GitHub Desktop.

Select an option

Save tonyOreglia/86fcff89aa2f1975f351d763bf28ad22 to your computer and use it in GitHub Desktop.
import { ChromaClient } from 'chromadb';
export const handler = async (event: APIGatewayEvent) => {
// ... ommitted
const chromaDbClient = new ChromaClient(CHROMADB_BASE_PATH);
let userCollection = await chromaDbClient.getOrCreateCollection(userUuid);
const entryIds = [1, 2, 3]
// embeddings are generated in previous snippet
await userCollection.add(entryIds, embeddings);
// ... ommitted
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment