Skip to content

How Tos

Alfred Nutile edited this page May 31, 2023 · 1 revision

How to Create an API

Step 1: Import Your Data

image

To begin, select the type of data you'd like to import. This could be a web file such as a PDF, or a web page to scrape. We plan to support more data types soon.

Step 2: Transform Your Data

image

In this example, we're converting HTML text and PDF content into Text + Pages. Following this, we need to build Embeddings, which will enable us to make the data searchable in the vector database.

Step 3: Set Up Outbound

For this step, we will focus on the API option illustrated in the image below.

image

After selecting the API option, you will see a list of "Response Types" to implement. These are ordered in the sequence they will be processed.

image

In this case, we:

  • Embed the question to enable search functionality
  • Search the database to retrieve related data
  • Use Preg Replace to clean up some irregularities from the PDF
  • Trim the text to save token space
  • Combine the final rows of data into a size that leaves enough token room for a response
  • Finally, add the ChatAPI response type

The settings for the ChatAPI response type are shown in the image below.

image

The image shows the URL you can use to access the data. Since we're using JetStream, you can see how to do that here.

Then, you need to create the prompt that the Large Language Model (LLM) will use in the chat process.