> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FAQ enrichment use case

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-async-prediction-api/faq-enrichment-async

[mintlify link]: https://doc.lucidworks.com/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-async-prediction-api/faq-enrichment-async

The FAQ enrichment use case of the [Lucidworks AI Async Prediction API](/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-async-prediction-api/overview) uses a large language model (LLM) to ingest input text and return a JSON response that contains a list of question and answer pairs. The questions are what the LLM believes are, or could be, frequently asked questions. The answers are generated based on the content of the text.

This use case can be used to generate questions and answers from each document that can be used for the following purposes:

* Populate a Frequently Asked Questions page
* Support a search of similar questions
* Prepare test data for [Smart Answers](https://doc.lucidworks.com/docs/5/fusion/getting-data-out/advanced-query-enhancement/smart-answers/overview#prepare-test-data)

The FAQ enrichment use case contains two requests:

* POST request - submits a prediction task for a specific `useCase` and `modelId`. The API responds with the following information:

* `predictionId`. A unique UUID for the submitted prediction task that can be used later to retrieve the results.

* `status`. The current state of the prediction task.
  * GET request - uses the `predictionId` you submit from a previously-submitted POST request and returns the results associated with that previous request.

<LwTemplate />

## Prerequisites

To use this API, you need:

* The unique `APPLICATION_ID` for your Lucidworks AI application, which is provided by Lucidworks.
* A bearer token generated with a scope value of `machinelearning.predict`. For more information, see [Authentication API](/docs/lw-platform/lw-platform/authentication-api).
* The `USE_CASE` and `MODEL_ID` fields in the `/async-prediction` for the POST request. The path is `/ai/async-prediction/USE_CASE/MODEL_ID`. A list of supported modes is returned in the [Lucidworks AI Use Case API](/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-use-case-api). For more information about supported models, see [Generative AI models](/docs/lw-platform/lw-ai/lw-ai-generative-ai#generative-ai-models).
* Other required fields specified in each individual use case.

## Common POST request parameters and fields

Some parameters in the `/ai/async-prediction/USE_CASE/MODEL_ID` POST request are common to all of the generative AI (Gen-AI) use cases, such as the `modelConfig` parameter.
Also referred to as hyperparameters, these fields set certain controls on the response.
Refer to the [API spec](/api-reference/create-predictions/model-predictions-by-use-case) for more information.

## Unique values for the FAQ enrichment use case

Some parameter values in the `faq-enrichment` use case are unique and may not be available in other use cases, including values for the `text` and `useCaseConfig` parameters. Refer to the [API spec](/api-reference/create-predictions/faq-enrichment-use-case) for more information.

## Example POST request

This example does not include `modelConfig` parameters, but you can submit requests that include parameters described in [Common parameters and fields](/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-prediction-api/faq-enrichment#common-parameters-and-fields).

```bash wrap theme={"dark"}
curl --request POST \
 --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/faq-enrichment/MODEL_ID \
 --header 'Authorization: Bearer ACCESS_TOKEN' \
 --header 'Content-type: application/json' \
 --data '{
 "batch": [
   {
     "text": "Global Travel Spending and Payment Trends in 2024\n\nGlobal tourism spending is expected to return to pre-pandemic levels in 2024. However, with inflation still affecting consumers, finding convenient and cost-effective payment methods remains a top priority for travelers. To understand payment preferences and behaviors, our Bank surveyed 1,800 consumers worldwide about their travel financing experiences and future spending plans. The findings highlight six key trends shaping how merchants can cater to global travelers.\n1. Cash Remains Essential\n\nWhile cash usage declined during the pandemic, it remains an important travel resource. Half of respondents use cash for purchases, while the other half carry it for emergencies. Asian travelers rely on cash the most—99% reported carrying it, compared to just 6% of total respondents who travel without it.\n2. Payment Choices Prioritize Ease, Deals, and Security\n\nTravelers select payment methods based on convenience, the best available deals, and security. Many prefer using cash-on-hand (e.g., debit) over credit or financing options like buy now, pay later.\n3. Travelers Plan Around Payment Acceptance\n\nAlthough credit cards are widely used, 73% of respondents have faced acceptance issues while traveling, with 42% choosing not to make a purchase as a result. To avoid complications, 72% plan ahead to ensure their preferred payment method is accepted, and 80% check for acceptance signage before spending.\n4. North American Travelers Favor Credit Cards\n\nWhile most global travelers prefer debit cards, North Americans rely heavily on credit—58% of respondents favor credit cards over debit (43%) or cash (40%).\n5. Airline-Branded Credit Cards Are Popular\n\nAmong travel-specific credit cards, airline-branded options are the most widely used, with 15% of cardholders relying on them. These cards are particularly popular in Asia and North America.\n6. Many Travelers Don't Maximize Their Rewards\n\nAlthough 43% of respondents have a travel rewards credit card, many don't use their points. Millennials are the most likely to leverage travel rewards, and international travelers are more likely to own a rewards card than domestic travelers. However, only 54% of rewards cardholders use their points for personal travel.\nBy understanding these trends, merchants can optimize payment options to attract and accommodate travelers worldwide."
     }
   ],
   "useCaseConfig": {
     "maxPairs": 10,
     "domain": "finance"
   }
 }'
```

The following is an example response:

```json theme={"dark"}
{
 "predictionId": "fd110486-f168-47c0-a419-1518a4840589",
 "status": "SUBMITTED"
}
```

## Example GET request

<CodeGroup>
  ```bash wrap Request theme={"dark"}
  curl --request GET \
    --url https://APPLICATION_ID.applications.lucidworks.com/ai/async-prediction/fd110486-f168-47c0-a419-1518a4840589 \
    --header 'Authorization: Bearer ACCESS_TOKEN'
  ```

  ```json wrap Response theme={"dark"}
  "value": {
    "predictionId": "b3d4a6f1-8e2c-4a0f-9c73-123456789abc",
    "status": "READY",
    "predictions": [
      {
        "tokensUsed": {
          "promptTokens": 51,
          "completionTokens": 4,
          "totalTokens": 55
        },
        "response": {
          "faqPairs": [
            {
              "question": "What types of accounts are available for travelers looking to manage their finances?",
              "answer": "Travelers can choose from various account types such as debit accounts, credit accounts, and travel-specific credit cards, including airline-branded cards that offer travel rewards."
            },
            {
              "question": "What are the eligibility requirements for obtaining a travel-specific credit card?",
              "answer": "Eligibility for travel-specific credit cards typically requires a good credit score and a stable income. Specific requirements may vary by issuer."
            }
          ]
        }
      }
    ]
  }
  ```
</CodeGroup>
