Retrieve from a Memory

This example demonstrates how to retrieve from a memory.


Retrieve from a Memory Example

Retrieve from a Memory Example

import 'dotenv/config';
import {Langbase} from 'langbase';

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

async function main() {
	const response = await langbase.memories.retrieve({
		memory: [
			{
				name: 'memory-sdk',
			},
		],
		query: 'What are pipes in Langbase?',
		topK: 2,
	});

	console.log(response);
}

main();