Post

Launching the Ask Relevance Widget - embed ChatGPT on your website

6 min read

Since we launched our Ask Relevance feature we've had customers use it to:

  • search large PDFs for answers
  • turn documentations into AI assistants
  • ask questions of their customer surveys
  • and lots more

One of the most frequently requested features has been to embed it to your website and today we're launching the the Ask Relevance widget alongside our support for the ChatGPT API.

Embeddable Ask Relevance Widget


Upload your dataset

Getting started is quick and easy - head to cloud.relevanceai.com and register for a free account. Follow the onboarding wizard and upload a CSV or a PDF with the data you want to search. For best results for websites, have fields for title, URL and content.

For PDFs, then use the workflow to enable Ask Relevance and for CSVs, use the workflow to enable QA. You'll then get an email with instructions on how to try Ask Relevance for yourself or you can hit the "Ask Relevance" button on the workflow.

Once it's ready, you'll need to add your OpenAI API key. You can do so by clicking on your profile in the top-right, selecting Project Settings and adding it to API keys (stored in encrypted format).


Embed widget

To use the widget you need to add the following snippet to your `<head>` section.

<script src="https://cdn.jsdelivr.net/gh/relevanceai/ask-relevance-widget/dist/bundle.min.js" config="BASE64_CONFIG" defer />

You will need to generate a base64 encoded config and replace it with BASE64_CONFIG. To do so with Javascript you can run the following:

let fieldName = "content";
let datasetName = "mydata-docs";
let config = { field: `${fieldName}`, vector_field: `${fieldName}_vector_`, reference_url_field: "url", reference_title_field: "title", url: `https://api-bcbe5a.stack.tryrelevance.com/latest/datasets/${datasetName}/simple_search` }; // if you're not on the US region, change "bcbe5a" to "f1db6c" for Australia and "d7b62b" for EU

console.log(btoa(JSON.stringify(config)))

And that's it! You can now have an AI assistant on any dataset, on any web page.

March 10, 2023
Contents
Tags:
Learn
GPT
You might also like