Skip to main content
The FAQ enrichment use case of the LWAI Prediction API 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

Prerequisites

To use this API, you need:
  • The unique APPLICATION_ID for your Lucidworks AI application. For more information, see credentials to use APIs.
  • A bearer token generated with a scope value of machinelearning.predict. For more information, see Authentication API.
  • The USE_CASE and MODEL_ID fields for the use case request. The path is: /ai/prediction/USE_CASE/MODEL_ID. A list of supported models is returned in the link:/lw-platform/ai/0stpyb/use-case-api[Lucidworks AI Use Case API]. For more information about supported models, see Generative AI models.
  • Other required fields specified in each individual use case.

Common parameters and fields

Some parameters in the /ai/prediction/USE_CASE/MODEL_ID 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 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 for more information.

Example request

This example does not include modelConfig parameters, but you can submit requests that include parameters described in Common parameters and fields.
curl --request POST \
 --url https://APPLICATION_ID.applications.lucidworks.com/ai/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:
{
   "predictions": [
       {
           "tokensUsed": {
               "promptTokens": 981,
               "completionTokens": 578,
               "totalTokens": 1559
           },
           "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."
               },
               {
                   "question": "What loan options are available for financing travel expenses?",
                   "answer": "Travelers can consider personal loans or credit card financing options like 'buy now, pay later' plans, though many prefer using cash or debit for travel-related expenses."
               },
               {
                   "question": "What are the typical interest rates for travel-specific credit cards?",
                   "answer": "Interest rates for travel-specific credit cards vary by issuer and creditworthiness, but they often range from 15% to 25% APR. It's important to check with the card issuer for specific rates."
               },
               {
                   "question": "What investment products are suitable for travelers looking to save for future trips?",
                   "answer": "Travelers might consider savings accounts, CDs, or investment funds tailored for travel savings, though these come with varying risks and returns."
               },
               {
                   "question": "How can travelers protect themselves from fraud while using payment methods abroad?",
                   "answer": "Travelers should use secure payment methods, monitor their accounts regularly, and look for acceptance signage to ensure their cards are accepted safely."
               },
               {
                   "question": "What security measures are in place for online banking and mobile apps for travelers?",
                   "answer": "Online banking and mobile apps often include features like two-factor authentication, encryption, and fraud alerts to protect travelers' financial information."
               },
               {
                   "question": "What customer support options are available for travelers facing payment issues abroad?",
                   "answer": "Travelers can access customer support through phone, email, or live chat services provided by their bank or card issuer, often available 24/7."
               },
               {
                   "question": "Are there any fees or hidden charges associated with using credit cards for travel expenses?",
                   "answer": "Credit cards may have fees such as foreign transaction fees, annual fees, or cash advance fees. It's important to review the card's terms and conditions for any hidden charges."
               },
               {
                   "question": "What transaction limits should travelers be aware of when using debit or credit cards abroad?",
                   "answer": "Transaction limits can vary by card issuer and account type, but travelers should check with their bank to understand daily spending and withdrawal limits when traveling internationally."
               }
           ],
           "response": "[\n    {\n        \"question\": \"What types of accounts are available for travelers looking to manage their finances?\",\n        \"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.\"\n    },\n    {\n        \"question\": \"What are the eligibility requirements for obtaining a travel-specific credit card?\",\n        \"answer\": \"Eligibility for travel-specific credit cards typically requires a good credit score and a stable income. Specific requirements may vary by issuer.\"\n    },\n    {\n        \"question\": \"What loan options are available for financing travel expenses?\",\n        \"answer\": \"Travelers can consider personal loans or credit card financing options like 'buy now, pay later' plans, though many prefer using cash or debit for travel-related expenses.\"\n    },\n    {\n        \"question\": \"What are the typical interest rates for travel-specific credit cards?\",\n        \"answer\": \"Interest rates for travel-specific credit cards vary by issuer and creditworthiness, but they often range from 15% to 25% APR. It's important to check with the card issuer for specific rates.\"\n    },\n    {\n        \"question\": \"What investment products are suitable for travelers looking to save for future trips?\",\n        \"answer\": \"Travelers might consider savings accounts, CDs, or investment funds tailored for travel savings, though these come with varying risks and returns.\"\n    },\n    {\n        \"question\": \"How can travelers protect themselves from fraud while using payment methods abroad?\",\n        \"answer\": \"Travelers should use secure payment methods, monitor their accounts regularly, and look for acceptance signage to ensure their cards are accepted safely.\"\n    },\n    {\n        \"question\": \"What security measures are in place for online banking and mobile apps for travelers?\",\n        \"answer\": \"Online banking and mobile apps often include features like two-factor authentication, encryption, and fraud alerts to protect travelers' financial information.\"\n    },\n    {\n        \"question\": \"What customer support options are available for travelers facing payment issues abroad?\",\n        \"answer\": \"Travelers can access customer support through phone, email, or live chat services provided by their bank or card issuer, often available 24/7.\"\n    },\n    {\n        \"question\": \"Are there any fees or hidden charges associated with using credit cards for travel expenses?\",\n        \"answer\": \"Credit cards may have fees such as foreign transaction fees, annual fees, or cash advance fees. It's important to review the card's terms and conditions for any hidden charges.\"\n    },\n    {\n        \"question\": \"What transaction limits should travelers be aware of when using debit or credit cards abroad?\",\n        \"answer\": \"Transaction limits can vary by card issuer and account type, but travelers should check with their bank to understand daily spending and withdrawal limits when traveling internationally.\"\n    }\n]"
       }
   ]
}