SmythOS SDK
    Preparing search index...

    Class VectorDBInstance

    Base class for all SDK objects.

    This class provides a base implementation for all SDK objects. It handles event emission, promise management, and initialization.

    This object is used to ensure that an SRE instance is initialized, and if not, create one with default settings.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • Delete a document from the vector database

      Parameters

      • name: string

        The name of the document

      Returns Promise<boolean>

      true if the document was deleted, false otherwise

      const pineConeSettings = {/* ... pinecone settings ... */}
      const pinecone = VectorDB.Pinecone('my_namespace', pineConeSettings);
      const success = await pinecone.deleteDoc('test');
    • Insert a document into the vector database

      Parameters

      • name: string

        The name of the document

      • data: string | TParsedDocument

        The data to insert. Can be a string or a TParsedDocument

      • Optionalmetadata: Record<string, string>

        The metadata to insert, can be any key/value pair

      Returns Promise<any>

      const pineConeSettings = {/* ... pinecone settings ... */}
      const pinecone = VectorDB.Pinecone('my_namespace', pineConeSettings);
      const id = await pinecone.insertDoc('test', 'Hello, world!', { myEntry: 'My Metadata' });
    • Purge the current namespace of the vector database

      Note : this will delete all the data in the current namespace.

      Returns Promise<void>

      void

      const pinecone = VectorDB.Pinecone('my_namespace', pineConeSettings);
      await pinecone.purge();
    • Search the vector database for a query

      Parameters

      Returns Promise<any>

      The search results

      const pineConeSettings = {/* ... pinecone settings ... */}
      const pinecone = VectorDB.Pinecone('my_namespace', pineConeSettings);
      const results = await pinecone.search('Hello, world!');
    • Update a document in the vector database.

      Note : this will index the new data on top of the existing data. if you want to replace the existing data, you should delete the document first (see deleteDoc)

      Parameters

      • name: string

        The name of the document

      • data: string | TParsedDocument

        The data to update. Can be a string or a TParsedDocument

      • Optionalmetadata: Record<string, string>

        The metadata to update, can be any key/value pair

      Returns Promise<any>

      const pineConeSettings = {/* ... pinecone settings ... */}
      const pinecone = VectorDB.Pinecone('my_namespace', pineConeSettings);
      const id = await pinecone.updateDoc('test', 'Hello, world!', { myEntry: 'My Metadata' });