Skip to content
Snippets Groups Projects
user avatar
Marcus Schiesser authored
Co-authored-by: default avatarthucpn <thucsh2@gmail.com>
b4903761
History
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Name Last commit Last update
..
README.md
example.ts
load.ts
query.ts

DataStax AstraDB Vector Store

Here are two sample scripts which work well with the sample data in the Astra Portal

Prerequisites

  • An Astra DB account. You can create one here.
    • An Astra Vector Database
  • An OpenAI API Key

Setup

  1. Set your env variables:
  • ASTRA_DB_APPLICATION_TOKEN: The generated app token for your Astra database
  • ASTRA_DB_API_ENDPOINT: The API endpoint for your Astra database
  • ASTRA_DB_NAMESPACE: (Optional) The namespace where your collection is stored defaults to default_keyspace
  • OPENAI_API_KEY: Your OpenAI key
  1. cd Into the examples directory
  2. run npm i

Example load and query

Loads and queries a simple vectorstore with some documents about Astra DB

run tsx astradb/example

Movie Reviews Example

Load the data

This sample loads the same dataset of movie reviews as the Astra Portal sample dataset. (Feel free to load the data in your the Astra Data Explorer to compare)

run npx tsx astradb/load

Use RAG to Query the data

Check out your data in the Astra Data Explorer and change the sample query as you see fit.

run npx tsx astradb/query