Get started
Introduction
Start using Memora’s JS library in two minutes
Our Javascript/Typescript library is the ideal way to utilize Memora’s API.
If you’re just getting started with Memora, we suggest you start with our quickstart guide first.
Installation
Quick example
Here’s a straightforward example of how to use our library:
import memora from 'usememora'
memora.auth('your-api-key-here')
const citations = [
'Life is like a box of chocolates.',
'May the Force be with you.'
]
const metadata = [
{ from: 'Forrest Gump' },
{ from: 'Stars Wars' }
]
await memora
.add(citations)
.metadata(metadata)
.go()
const docs = await memora
.find('the movie citation about chocolates')
.go()
console.log(docs[0])
// TODO with response
Design
The library employs the builder pattern, which makes it incredibly easy-to-use and ensures high readability, even for more complex queries. Here’s an example:
const docs = await memora
.in('documentation')
.find('how to change my subscription to the pro plan')
.where('tags', 'contains', 'support')
.and('published_year', '>=', 2020)
.go()
Core methods
Our library mainly revolves around three core methods: add()
, find()
, and delete()
. We’ll go into detail about each of these in the following sections.
Was this page helpful?