Memory API: Retrieve beta

The retrieve memory API endpoint allows you to retrieve similar chunks from an existing memory on Langbase based on a query. This endpoint requires an Org or User API key.


Deprecation Notice

This API endpoint has been deprecated. Please use the new retrieve memory API endpoint.


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


Deprecated/beta/memory/retrieve

Retrieve similar chunks by specifying the owner login, query, and memory names in the request body.

Required headers

  • Name
    Content-Type
    Type
    string
    Description

    Request content type. Needs to be application/json.

  • Name
    Authorization
    Type
    string
    Description

    Replace <YOUR_API_KEY> with your Org/User API key.

Required body parameters

  • Name
    ownerLogin
    Type
    string
    Description

    The username of the owner (either an organization or a user). Replace <ownerLogin> with your organization or user username.

  • Name
    query
    Type
    string
    Description

    The search query for retrieving similar chunks.

  • Name
    memory
    Type
    array
    Description

    An array of memory names from which to retrieve similar chunks.

Optional body parameters

  • Name
    topK
    Type
    number
    Description

    The number of top similar chunks to return from memory. Default is 20, minimum is 1, and maximum is 100.

POST
/beta/memory/retrieve
curl -X POST https://api.langbase.com/beta/memory/retrieve \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer <YOUR_API_KEY>" \ -d '{ "ownerLogin": "<ownerLogin>", "query": "your query here", "memory": [ { "name": "memory1" }, { "name": "memory2" } ] }'

Response

[ { "text": "This is the first similar chunk", "similarity": 0.98, "meta": { "docName": "Filename.ext" } }, { "text": "This is the second similar chunk", "similarity": 0.95, "meta": { "docName": "Filename.ext" } } ]

Deprecated/beta/memorysets/{ownerLogin}/{memoryName}/retrieve

Deprecation Notice

This endpoint is deprecated. Please use the new retrieve endpoint /beta/memory/retrieve instead.

Retrieve similar chunks by specifying the owner login and memory name in the path and providing the query in the request body.

Required headers

  • Name
    Content-Type
    Type
    string
    Description

    Request content type. Needs to be application/json.

  • Name
    Authorization
    Type
    string
    Description

    Replace <YOUR_API_KEY> with your Org/User API key.

Required path parameters

  • Name
    ownerLogin
    Type
    string
    Description

    The username of the owner (either an organization or a user).

    Replace {ownerLogin} with your organization or user username.

  • Name
    memoryName
    Type
    string
    Description

    The name of the memory from which to retrieve similar chunks.

    Replace {memoryName} with the name of the memory.

Required body parameters

  • Name
    query
    Type
    string
    Description

    The search query for retrieving similar chunks.

Optional body parameters

  • Name
    topK
    Type
    number
    Description

    The number of top similar chunks to return from memory. Default is 20, minimum is 1, and maximum is 100.

POST
/beta/memorysets/{ownerLogin}/{memoryName}/retrieve
curl -X POST https://api.langbase.com/beta/memorysets/{ownerLogin}/{memoryName}/retrieve \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer <YOUR_API_KEY>" \ -d '{ "query": "your query here" }'

Response

[ { "text": "This is the first similar chunk", "similarity": 0.98, "meta": { "docName": "Filename.ext" } }, { "text": "This is the second similar chunk", "similarity": 0.95, "meta": { "docName": "Filename.ext" } } ]