Delete Document langbase.memory.documents.delete()

Delete an existing document from a memory on Langbase using the langbase.memory.documents.delete() function.


Generate a User/Org API key

You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.


API reference

langbase.memory.documents.delete(options)

Function Signature

langbase.memory.documents.delete(options);

// with types.
langbase.memory.documents.delete(options: MemoryDeleteDocOptions);

options

  • Name
    options
    Type
    MemoryDeleteDocOptions
    Description

    MemoryDeleteDocOptions Object

    interface MemoryDeleteDocOptions {
    	memoryName: string;
    	documentName: string;
    }
    

    Following are the properties of the options object.


  • Name
    memoryName
    Type
    string
    Required
    Required
    Description

    Name of the memory instance containing the document.

  • Name
    documentName
    Type
    string
    Required
    Required
    Description

    Name of the document to delete.

Usage example

Install the SDK

npm i langbase

Environment variables

.env file

LANGBASE_API_KEY="<USER/ORG-API-KEY>"

Delete document

Delete document from memory

import {Langbase} from 'langbase';

const langbase = new Langbase({
	apiKey: process.env.LANGBASE_API_KEY!,
});

const response = await langbase.memory.documents.delete({
	memoryName: 'knowledge-base',
	documentName: 'old-report.pdf'
});

Response

  • Name
    MemoryDeleteDocResponse
    Type
    object
    Description

    The response object returned by the langbase.memory.documents.delete() function.

    MemoryDeleteDocResponse

    interface MemoryDeleteDocResponse {
    	success: boolean;
    }
    
    • Name
      success
      Type
      boolean
      Description

      Indicates whether the document deletion was successful.

Response of langbase.memory.documents.delete()

{
	"success": true
}