Set up once
On the Provider keys page, save an enabled OpenAI key. On the API keys page, create a key, give it a name, choose a project (or No project), and select Use only. Under Memory for, choose Each user of my app. Copy the Atlaso key when it appears; it is shown only once. Export it in the terminal where you run the example. A file containing these variables is not loaded automatically. Keep the Atlaso key on your server.ATLASO_KEY; its address is built in. ATLASO_BASE_URL is
for curl and the pages that call the HTTP API directly.
Use a test user ID from your own app, such as demo-user-42. In your app, pass
the signed-in user’s ID after your own sign-in check.
Save a fact, then ask about it
Each tab saves the same made-up fact, then asks a new chat a question that only the fact answers. The answer cannot come from chat history. Run one tab, not all three, to avoid saving the fact more than once.- Python
- TypeScript
- curl
quickstart.py and run python quickstart.py:See which memories it used
Add these lines to the end of the same file. They ask again, and print the IDs of the facts Atlaso put into the prompt (the saved fact’s ID) and the cost.- Python
- TypeScript
user.memory.list() shows the saved fact with the same ID. The
Atlaso SDK page covers the receipt, saves, deletes and agent tools.
Just for you
For a script of your own, create the key with Memory for set to Me instead. Calls without a user then use your own memory, the same facts your Atlaso tools save:- Python
- TypeScript
atlaso.memory, using the same Me
key (its memory must not be Off):
- Python
- TypeScript
Check that memory worked
status=none in the receipt (or the x-atlaso-memory header) means recall found
no facts; check the user ID, key scope and project. status=off means memory is
off. status=skipped includes a reason explaining why recall was skipped. See
Memory and Errors.
For an isolation check, ask the same question as demo-user-43, a fresh test
user. It must not receive the saved fact.
When you are done, delete demo-user-42’s memory with user.memory.erase(), or
with the Memory API:
Other languages
Go, Java and C# call the gateway over HTTP with the OpenAI library, using the two variables from Set up once. Send the user in thex-atlaso-user header on each request from your server.
- Go
- Java
- C#
main.go and run go run .: