Code Monkey home page Code Monkey logo

astra-db-ts's People

Contributors

alexleventer avatar bdunn313 avatar clun avatar johnsmartco avatar mfortman11 avatar nicoloboschi avatar toptobes avatar yuqi-du avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

astra-db-ts's Issues

change `collection` to `createCollection` in README sample code

The lines in the README sample code

// Create a collection
const collection = await astraDb.collection(COLLECTION_NAME);

seem to be incorrect, as that method does not create a collection rather returns a reference to an existing one.

Creating a collection, in my understanding, is done through createCollection with the (possible, but required for vector coll.s) addition of some parameters.

`createCollection` is not idempotent

Given this code snippet:

image

I get this error:

image

My workaround is to actually make it idempotent and not raise an error by wrapping the call to createCollection in a try/catch block and swallowing the error. When I do this, everything continues as normal.

Current status: calling createCollection on an existing collection raises an error when the documentation says it does not.
Expected: no error if collection already exists.

There is no difference in configuration.

createCollection should throw a catchable error

When implementing a create if does not exist type of method the logs are bogged down w/ error logs and the error is not catchable.

This method should throw an appropriate error or we should have a create if does not exist method

error: Error: Command "createCollection" failed with the following errors: [{"message":"Server call failed, please retry!"}]
    at handleIfErrorResponse (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@datastax/astra-db-ts/dist/client/httpClient.js:226:15)
    at HTTPClient.executeCommand (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@datastax/astra-db-ts/dist/client/httpClient.js:206:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@datastax/astra-db-ts/dist/collections/db.js:67:20
    at async executeOperation (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@datastax/astra-db-ts/dist/collections/utils.js:161:15)
    at async AstraDB.createCollection (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@datastax/astra-db-ts/dist/collections/client.js:73:16)
    at async AstraDBVectorStore.initialize (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@langchain/community/dist/vectorstores/astradb.cjs:88:13)
    at async AstraDBVectorStore.fromDocuments (/Users/mendon.kissling/Documents/GitHub/temporary-astra/node-test-applications/node_modules/@langchain/community/dist/vectorstores/astradb.cjs:226:9)
Collection already exists, connecting to vector_test

Add support for vectorize in typescript client

Work is in progress to add a feature to the Data API that allows users to specify a $vectorize field in JSON documents that the API will then take and calculate an embedding for using a configured algorithm. We need to expose this functionality in the typescript client as well.

Work under this related issue for stargate-mongoose may help suggest syntax stargate/stargate-mongoose#188

change "projection" to "fields"

I'm not positive whether the API was changed, but instead of having a field "projection" which is confusing, please change it to "fields" to match the python client

Support Keyspaces when connecting via API endpoint

Api Endpoint is the preferred connection method moving forward so we should support the ability to use keyspaces along side the endpoint.

export class AstraDB extends Client {
  constructor(...args: any[]) {
    // token: string, path: string
    if (args.length === 2) {
      let endpoint = args[1];
      endpoint += "/api/json/v1";
      endpoint += "/default_keyspace";
      super(endpoint, "default_keyspace", { isAstra: true, applicationToken: args[0] });
    } else {
      // token: string, dbId: string, region: string, keyspace?: string
      const keyspaceName = args[3] || "default_keyspace";
      const endpoint = createAstraUri(args[1], args[2], keyspaceName);
      super(endpoint, keyspaceName, { isAstra: true, applicationToken: args[0] });
    }
  }
}

Error: Command "deleteMany" failed with the following error: More records found to be deleted even after deleting 20 records

Hello,
We are using a metadata key to partition vectors in a collection for multi-tenancy.
In the delete operation we run the following code:


const astraClient = new AstraDB(
    process.env.ASTRA_DB_APPLICATION_TOKEN,
    process.env.ASTRA_DB_ENDPOINT
  );
  const collection: Collection = await astraClient.collection(collectionName);
  return collection.deleteMany({ tenant: namespace });

Namespace is the string contained in the tenant field.
When running, I get the following error thrown by the package:


error: Error: Command "deleteMany" failed with the following error: More records found to be deleted even after deleting 20 records

What do I have to do when there are more than 20 records to delete in a single colllection? Is the approach of separating vectors by metadata key not optimal? If so what should I be doing?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.