Quickstart
Get a key, store a memory, search it and build prompt context with curl or the JavaScript SDK
Create a project key, store your first memory and search it.
Create a project key
Sign in at console.neurophic.ai, create a project and create a key on its API Keys page. Copy it when it is shown and set it as NEUROPHIC_API_KEY in your environment.
Install the SDK
npm install neurophic
pnpm add neurophic
yarn add neurophic
Store a memory
import { Neurophic } from 'neurophic';
const client = new Neurophic({ apiKey: process.env.NEUROPHIC_API_KEY });
const { id, status } = await client.ingest({
identifier: 'user-123',
name: 'Jane Doe',
content: 'Prefers window seats and vegetarian meals on long flights.',
});
curl https://api.neurophic.ai/v1/ingest \
-H "Authorization: Bearer nph_..." \
-H "Content-Type: application/json" \
-d '{"identifier":"user-123","name":"Jane Doe","content":"Prefers window seats and vegetarian meals on long flights."}'
Learn more under API reference > Ingest.
Retrieve it
const { result } = await client.retrieve({
identifier: 'user-123',
query: 'travel preferences',
});
console.log(result); // the most relevant memories, as markdown
curl https://api.neurophic.ai/v1/retrieve \
-H "Authorization: Bearer nph_..." \
-H "Content-Type: application/json" \
-d '{"identifier":"user-123","query":"travel preferences"}'
Learn more under API reference > Retrieve.
Get prompt context
const { result } = await client.context({
identifier: 'user-123',
query: 'book a flight for the user',
});
curl https://api.neurophic.ai/v1/context \
-H "Authorization: Bearer nph_..." \
-H "Content-Type: application/json" \
-d '{"identifier":"user-123","query":"book a flight for the user"}'
Learn more under API reference > Context.