Retry Doc Embedding langbase.memory.documents.embedding.retry()

Retry the embedding process for a failed document using the langbase.memory.documents.embedding.retry() function.

Document embeddings generation may fail due to various reasons such as OpenAI API rate limits, invalid API keys, document parsing errors, special characters, corrupted or locked PDFs, and excessively large documents. If the issue is related to the API key, it needs to be corrected; before retrying, ensure that the document is accessible and can be parsed correctly.


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.embedding.retry(options)

Function Signature

langbase.memory.documents.embedding.retry(options);

// with types.
langbase.memory.documents.embedding.retry(options: MemoryRetryDocEmbedOptions);

options

  • Name
    options
    Type
    MemoryRetryDocEmbedOptions
    Description

    MemoryRetryDocEmbedOptions Object

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

    Following are the properties of the options object.


  • Name
    memoryName
    Type
    string
    Required
    Required
    Description

    The name of memory to which the document belongs.

  • Name
    documentName
    Type
    string
    Required
    Required
    Description

    The name of the document.

Usage example

Install the SDK

npm i langbase
pnpm i langbase
yarn add langbase

Environment variables

.env file

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

Retry document embedding

Retry document embedding on Langbase

import {Langbase} from 'langbase';

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

await langbase.memory.documents.embedding.retry({
	memoryName: 'knowledge-base',
	documentName: 'technical-doc.pdf'
});

Response

  • Name
    MemoryRetryDocEmbedResponse
    Type
    object
    Description

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

    MemoryRetryDocEmbedResponse

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

      Indicates whether the embedding retry was successfully initiated.

Response of langbase.memory.documents.embedding.retry()

{
	"success": true
}