import { PiyApi } from '@piyapi/sdk';
const client = new PiyApi({
apiKey: process.env.PIYAPI_API_KEY!,
});
// Store a persistent memory fact
await client.memory.add({
content: 'User prefers dark mode and concise TypeScript examples',
userId: 'user_1029',
tags: ['preference', 'ui'],
});
// Retrieve relevant context for a model prompt
const context = await client.context.retrieve({
query: 'How should I format this component?',
userId: 'user_1029',
maxTokens: 1000,
});