Delete Document langbase.memories.documents.delete()

Delete an existing document from a memory on Langbase using the langbase.memories.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.memories.documents.delete(options)

Function Signature

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

options

  • Name
    options
    Type
    MemoryDeleteDocOptions
    Description

    MemoryDeleteDocOptions Object

    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

Environment variables

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!, }); async function main() { const hasDocDeleted = await langbase.memories.documents.delete({ memoryName: 'knowledge-base', documentName: 'old-report.pdf' }); console.log('Document deleted:', hasDocDeleted); } main();

Response

  • Name
    MemoryDeleteDocResponse
    Type
    object
    Description

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

    MemoryDeleteDocResponse

    success: boolean;
    • Name
      success
      Type
      boolean
      Description

      Indicates whether the document deletion was successful.

Response of langbase.memories.documents.delete()

{ "success": true }