Overview

The Gradient Accelerator Block for Q&A accurately responds to questions on documents stored in RAG or provided via text inputs. Q&A can support a variety of use cases that enables users to request information from a reference pool.

Create an account and workspace

If you haven't already, go to gradient.ai, click sign up and create your account. Once you have verified your email, log in to the account. Click "Create New Workspace" and give it a name.

You can see your workspaces at any time by going to https://auth.gradient.ai/select-workspace.

Use the Accelerator Blocks playground

You can easily try out the Gradient Accelerator Block for Q&A via the playground UI.

  1. Log into Gradient and select the workspace you want to use. Select the “Accelerator Blocks” tab from the left sidebar.

  2. Navigate to the “Question & Answer” block.

    Screenshot 2024-01-24 at 12.11.08 AM.png
  3. Either select the RAG Collection for reference or insert the reference document directly into the input.

    1. RAG Collection – Follow our RAG Guide to set up a RAG Collection first if you haven’t already.
  4. Ask a question, hit “Submit”, and the answer will be displayed below!

Use the SDK

The SDK is best suited for integrating Q&A into your application or business workflow.

Follow our SDK Quickstart to get set up. From there, simply provide the question and a RAG Collection ID or your reference document.

from gradientai import Gradient

gradient = Gradient()

document = (
    "When Apple released the Apple Watch in 2015, it was business "
    + "as usual for a company whose iPhone updates had become cultural "
    + "touchstones. Before the watch went on sale, Apple gave early "
    + "versions of it to celebrities like Beyoncé, featured it in fashion "
    + "publications like Vogue and streamed a splashy event on the "
    + "internet trumpeting its features."
)
question = "How was the Apple watch marketed?"

result = gradient.answer(
    question=question,
    source={
        "type": "document",
        "value": document,
    },
)