Getting Started

Getting Started

Account Setup

All endpoints provided by ReLLM will require you to have an API key associated with a business. Navigate to https://rellm.ai/account (opens in a new tab) to create your account and business.

Once you have an API key from your business page we can begin sending data!

Installation

Currently we support two methods of using the API. A REST API that any application can use via web requests, or a NPM package.

yarn add rellm
or
npm install rellm --save-dev

Embedding Data

All data that you might want to be included as context must be embedded within ReLLM.

To do this we need to make a post request to https://rellm.ai/api/embed

Here is an example using axios

axios ({
  method: 'POST',
  url: 'https://rellm.ai/api/embed',
  headers: {
    authorization: `Bearer ${token}`,
  },
  data: {
    text: "My cat's name is Merlin",
    permission: ["merlin"],
    metadata: {
      pet_type: "cat",
      pet_name: "Merlin"
    }
  }
})

Here we store the string "My cat's name is Merlin" within ReLLM. We also tell ReLLM that only users able to see "merlin" data may view the information. The metadata allows us to refer to the embedded data in the future for managing/deleting.

Setting Permissions

In order to make that stored data usable, we must tell ReLLM that there is a user who is allowed to see Merlin. Lets tell ReLLM that "Dave" can see "merlin".

axios ({
  method: 'POST',
  url: 'https://rellm.ai/api/permission',
  headers: {
    authorization: `Bearer ${token}`,
  },
  data: {
    user_id: "Dave",
    permission: "merlin"
  }
})

Retrieving data

Now we want to retrieve that information. Let's make a post request to the chat endpoint. And tell ReLLM that Dave is asking a question.

axios ({
  method: 'POST',
  url: 'https://rellm.ai/api/chat',
  headers: {
    authorization: `Bearer ${token}`,
  },
  data: {
    text: "What are my pets names?",
    user_id: "Dave"
  }
})

We cannot be sure exactly what the LLM will return, but it will have "My cat's name is Merlin" available as context. Usually the response will be similar to:

Your cat's name is Merlin

Removing Access

Let's say we want to remove Dave's ability to see Merlin's data.

axios({
  method: 'DELETE',
  url: 'https://rellm.ai/api/chat',
  headers: {
    authorization: `Bearer ${token}`,
  },
  params: {
    user_id: "Dave",
    permission: "merlin"
  }
})

Now if we make another request to chat, the AI will answer with a "I don't know" response as it does not have the Merlin context.

Deleting Embedded Data

We can delete data we have previously embedded by targeting it via the metadata tags we set earlier.

axios({
  method: "DELETE",
  url: "https://rellm.ai/api/embed",
  headers: {
    authorization: `Bearer ${token}`,
  },
  params: {
    metadata_key: "pet_name",
    metadata_value: "Merlin"
  }
})

This request will delete all entries of embedding stored with the metadata key and value included in params.