> ## 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

> The FAQ enrichment use case uses a large language model (LLM) to ingest input text and return a JSON response that contains a list of question and answer pairs.



## OpenAPI

````yaml /api-reference/saas/machine-learning-platform-predict.json post /ai/prediction/faq-enrichment/{MODEL_ID}
openapi: 3.0.1
info:
  title: Lucidworks AI Prediction API
  version: v0
  description: >-
    The Lucidworks AI Prediction API is used to send synchronous API calls that
    run predictions from pre-trained models or custom models.


    The Use Case API returns a list of all supported models.


    The `prediction` endpoints require an authentication token with scope
    `machinelearning.predict`.
  contact:
    name: Lucidworks
    url: https://lucidworks.com/
    email: support@lucidworks.com
  termsOfService: https://lucidworks.com/legal/developer-license-agreement/
  license:
    name: Lucidworks
    url: https://lucidworks.com/legal/developer-license-agreement/
servers:
  - url: https://APPLICATION_ID.applications.lucidworks.com
    description: Production
security: []
tags:
  - name: Get predictions
    description: Submit prediction tasks to Lucidworks AI.
paths:
  /ai/prediction/faq-enrichment/{MODEL_ID}:
    post:
      tags:
        - Get predictions
      summary: FAQ Enrichment use case
      description: >-
        The FAQ enrichment use case uses a large language model (LLM) to ingest
        input text and return a JSON response that contains a list of question
        and answer pairs.
      operationId: post-ai-prediction-faq-enrichment-modelId
      parameters:
        - schema:
            type: string
          name: MODEL_ID
          in: path
          required: true
          description: Unique identifier for the model.
          example: bge-large
        - in: header
          name: Authorization
          required: true
          schema:
            type: string
          description: Bearer token used for authentication.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FaqEnrichmentRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaqEnrichmentResponse'
components:
  schemas:
    FaqEnrichmentRequest:
      title: FaqEnrichmentRequest
      type: object
      x-examples: {}
      properties:
        batch:
          type: array
          description: >-
            The text analyzed to predict possible frequently asked questions and
            corresponding answers.
          items:
            type: object
            properties:
              text:
                type: string
                description: The content the model analyzes.
                example: >-
                  Global Travel Spending and Payment Trends in 2024


                  Global 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.

                  1. Cash Remains Essential


                  While 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.

                  2. Payment Choices Prioritize Ease, Deals, and Security


                  Travelers 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.

                  3. Travelers Plan Around Payment Acceptance


                  Although 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.

                  4. North American Travelers Favor Credit Cards


                  While most global travelers prefer debit cards, North
                  Americans rely heavily on credit—58% of respondents favor
                  credit cards over debit (43%) or cash (40%).

                  5. Airline-Branded Credit Cards Are Popular


                  Among 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.

                  6. Many Travelers Don’t Maximize Their Rewards


                  Although 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.

                  By understanding these trends, merchants can optimize payment
                  options to attract and accommodate travelers worldwide.
        useCaseConfig:
          $ref: '#/components/schemas/UseCaseConfigFaqEnrichment'
        modelConfig:
          $ref: '#/components/schemas/ModelConfig'
    FaqEnrichmentResponse:
      type: object
      properties:
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/FaqEnrichmentResponseTokens'
      x-examples: {}
    UseCaseConfigFaqEnrichment:
      title: UseCaseConfigFaqEnrichment
      type: object
      properties:
        maxPairs:
          type: integer
          example: 10
          description: >-
            This parameter specifies the maximum number of questions and answer
            pairs that can be generated, though the model may not honor the
            number specified in this field.
        domain:
          type: string
          description: >-
            This parameter specifies the domain specific for which the input FAQ
            documents would be considered. The domain specification helps the
            model generate more accurate and relevant questions for the content.
            The domains are listed here.
          enum:
            - retail
            - finance
            - tourism
            - consulting
            - healthcare
            - hospitality
            - manufacturing
            - it (information technology)
          example: finance
    ModelConfig:
      title: ModelConfig
      type: object
      description: >-
        Provides fields and values that specify ranges for tokens. Fields used
        for specific use cases and models are specified. The default values are
        used if other values are not specified.
      properties:
        temperature:
          type: number
          format: float
          example: 0.8
          minimum: 0
          maximum: 2
          description: >-
            A sampling temperature between 0 and 2. A higher sampling
            temperature such as 0.8, results in more random (creative) output. A
            lower value such as 0.2 results in more focused (conservative)
            output. A lower value does not guarantee the model returns the same
            response for the same input. We recommend staying at or below a
            temperature of 1.0. Values above 1.0 might return nonsense unless
            the topP value is lowered to be more deterministic.
        topP:
          type: number
          format: float
          example: 1
          minimum: 0
          maximum: 1
          description: >-
            A floating-point number between 0 and 1 that controls the cumulative
            probability of the top tokens to consider, known as the randomness
            of the LLM's response. This parameter is also referred to as top
            probability. Set `topP` to 1 to consider all tokens. A higher value
            specifies a higher probability threshold and selects tokens whose
            cumulative probability is greater than the threshold. The higher the
            value, the more diverse the output.
        topK:
          type: integer
          example: -1
          description: >-
            An integer that controls the number of top tokens to consider. Set
            topK to -1 to consider all tokens.
        presencePenalty:
          type: number
          format: float
          minimum: -2
          maximum: 2
          description: >-
            A floating-point number between -2.0 and 2.0 that penalizes new
            tokens based on whether they have already appeared in the text. This
            increases the model's use of diverse tokens. A value greater than
            zero (0) encourages the model to use new tokens. A value less than
            zero (0) encourages the model to repeat existing tokens. This is
            applicable for all OpenAI and Llama models.
          example: 2
        frequencyPenalty:
          type: number
          format: float
          minimum: -2
          maximum: 2
          example: 1
          description: >-
            A floating-point number between -2.0 and 2.0 that penalizes new
            tokens based on their frequency in the generated text. A value
            greater than zero (0) encourages the model to use new tokens. A
            value less than zero (0) encourages the model to repeat existing
            tokens. This is applicable for all OpenAI and Llama models.
        maxTokens:
          type: integer
          format: int32
          example: 1
          description: >-
            The maximum number of tokens to generate per output sequence. The
            value is different for each model. Review individual model
            specifications when the value exceeds 2048.
        apiKey:
          type: string
          description: >-
            This optional parameter is only required when using the model for
            prediction. You can find this value in your model's settings:


            * **OpenAI**: Copy and paste the API key found in your
            organization's settings. For more information, see <a
            href="https://platform.openai.com/docs/api-reference/authentication">OpenAI
            Authentication API keys</a>.


            * **Azure OpenAI**: Copy and paste the API key found in your Azure
            portal. See <a
            href="https://learn.microsoft.com/en-us/azure/api-management/api-management-authenticate-authorize-azure-openai#authenticate-with-api-key">Authenticate
            with API key</a>.


            * **Anthropic**: Copy and paste the API key found in your <a
            href="https://console.anthropic.com/settings/keys">Anthropic
            console</a> or by using the <a
            href="https://docs.anthropic.com/en/api/admin-api/apikeys/get-api-key">Anthropic
            API</a>.


            * **Google Vertex AI**: Copy and paste the base64-encoded service
            account key JSON found in your <a
            href="https://cloud.google.com/iam/docs/keys-list-get#list-keys">Google
            Cloud console</a>. This service account key must have the <a
            href="https://cloud.google.com/iam/docs/understanding-roles#aiplatform.user">Vertex
            AI user</a> role enabled. For more information, see <a
            href="https://cloud.google.com/iam/docs/keys-create-delete#creating">generate
            service account key</a>.
          example: API key specific to use case and model
        azureDeployment:
          type: string
          example: DEPLOYMENT_NAME
          description: >-
            This optional parameter is the name of the deployed Azure OpenAI
            model and is only required when a deployed Azure OpenAI model is
            used for prediction.
        azureEndpoint:
          type: string
          description: "\t\nThis optional parameter is the URL endpoint of the deployed Azure OpenAI model and is only required when a deployed Azure OpenAI model is used for prediction."
          example: https://azure.endpoint.com
        googleProjectId:
          type: string
          example: '[GOOGLE_PROJECT_ID]'
          description: >-
            This parameter is optional, and is only required when a Google
            Vertex AI model is used for prediction.  
        googleRegion:
          type: string
          description: >-
            This parameter is optional, and is only required when a Google
            Vertex AI model is used for prediction. A value of `global` routes
            the query to any available region. Other possible region values are:


            * us-central1

            * us-west4

            * northamerica-northeast1

            * us-east4

            * us-west1

            * asia-northeast3

            * asia-southeast1

            * asia-northeast
          example: '[GOOGLE_PROJECT_REGION_OF_MODEL_ACCESS]'
    FaqEnrichmentResponseTokens:
      type: object
      properties:
        faqPairs:
          type: array
          description: >-
            A list of question and answer pairs returned from the FAQ enrichment
            request.
          items:
            type: object
            properties:
              question:
                type: string
                description: The frequently asked question.
              answer:
                type: string
                description: The answer corresponding to the question.
            required:
              - question
              - answer
          example:
            - 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.
        tokensUsed:
          $ref: '#/components/schemas/Token'
    Token:
      type: object
      properties:
        promptTokens:
          type: integer
          format: int32
          description: >-
            The number of tokens generated to prompt the model to continue
            generating results.
          example: 148
        completionTokens:
          type: integer
          format: int32
          description: The number of tokens used until the model completes.
          example: 27
        totalTokens:
          type: integer
          format: int32
          description: The sum of the prompt and completion tokens used in the model.
          example: 175

````