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

# Keyword extraction use case

> In the keyword-extraction use case, the LLM ingests text and returns a JSON response that contains a list of keywords extracted from the text. No options can be configured.



## OpenAPI

````yaml /api-reference/saas/machine-learning-platform-predict.json post /ai/prediction/keyword-extraction/{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/keyword-extraction/{MODEL_ID}:
    parameters:
      - schema:
          type: string
        name: MODEL_ID
        in: path
        required: true
        description: Unique identifier for the model.
        example: llama-3-8b-instruct
    post:
      tags:
        - Get predictions
      summary: Keyword extraction use case
      description: >-
        In the keyword-extraction use case, the LLM ingests text and returns a
        JSON response that contains a list of keywords extracted from the text.
        No options can be configured.
      operationId: post-ai-prediction-keyword-extraction-modelId
      parameters:
        - in: header
          name: Authorization
          schema:
            type: string
          required: true
          description: >-
            Bearer token used for authentication. Format: `Authorization: Bearer
            ACCESS_TOKEN`.
          example: Bearer abc123def456
        - schema:
            type: string
            example: application/json
          in: header
          name: Content-Type
          description: application/json
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeywordExtractionRequest'
            example:
              batch:
                - text: >-
                    Joseph Robinette Biden Jr.is an American politician who is
                    the 46th and current president of the United States.
                    Ideologically a moderate member of the Democratic Party, he
                    previously served as the 47th vice president from 2009 to
                    2017 under President Barack Obama and represented Delaware
                    in the United States Senate from 1973 to 2009.Born in
                    Scranton, Pennsylvania, Biden moved with his family to
                    Delaware in 1953. He studied at the University of Delaware
                    before earning his law degree from Syracuse University. He
                    was elected to the New Castle County Council in 1970 and to
                    the U.S. Senate in 1972. As a senator, Biden drafted and led
                    the effort to pass the Violent Crime Control and Law
                    Enforcement Act and the Violence Against Women Act. He also
                    oversaw six U.S. Supreme Court confirmation hearings,
                    including the contentious hearings for Robert Bork and
                    Clarence Thomas. Biden ran unsuccessfully for the Democratic
                    presidential nomination in 1988 and 2008. In 2008, Obama
                    chose Biden as his running mate, and Biden was a close
                    counselor to Obama during his two terms as vice president.
                    In the 2020 presidential election, Biden and his running
                    mate, Kamala Harris, defeated incumbents Donald Trump and
                    Mike Pence. Biden is the second Catholic president in U.S.
                    history (after John F. Kennedy), and his politics have been
                    widely described as profoundly influenced by Catholic social
                    teaching.
              useCaseConfig:
                maxKeywords: 100
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeywordExtractionResponse'
              example:
                predictions:
                  - tokensUsed:
                      promptTokens: 369
                      completionTokens: 1000
                      totalTokens: 1369
                    keywords:
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Hearing
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Hearing
                      - Confirmation
                      - Supreme Court
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                    response: |-
                      keywords:
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Hearing
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Hearing
                      - Confirmation
                      - Supreme Court
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      - Donald Trump
                      - Mike Pence
                      - Catholic
                      - Social teaching
                      - Kennedy
                      - Pennsylvania
                      - University
                      - Law degree
                      - New Castle County
                      - U.S. history
                      - Presidential election
                      - Vice president
                      - Nomination
                      - Running mate
                      - Hearing
                      - Confirmation
                      - Act
                      - Election
                      - History
                      - Family
                      - Scranton
                      - Syracuse University
                      - County Council
                      - Biden
                      - United States
                      - President
                      - Democratic Party
                      - Senate
                      - Delaware
                      - Obama
                      - Supreme Court
                      - Crime
                      - Law Enforcement
                      - Violence
                      - Women
                      - Robert Bork
                      - Clarence Thomas
                      - Kamala Harris
                      -
components:
  schemas:
    KeywordExtractionRequest:
      title: KeywordExtractionRequest
      type: object
      x-examples: {}
      properties:
        batch:
          type: array
          description: >-
            The batch of key:value pairs used as inputs in the prediction. Up to
            32 inputs per request are allowed.
          maxItems: 32
          items:
            type: object
            properties:
              text:
                type: string
                description: The content the model analyzes.
                example: >-
                  Joseph Robinette Biden Jr.is an American politician who is the
                  46th and current president of the United States. Ideologically
                  a moderate member of the Democratic Party, he previously
                  served as the 47th vice president from 2009 to 2017 under
                  President Barack Obama and represented Delaware in the United
                  States Senate from 1973 to 2009.Born in Scranton,
                  Pennsylvania, Biden moved with his family to Delaware in 1953.
                  He studied at the University of Delaware before earning his
                  law degree from Syracuse University. He was elected to the New
                  Castle County Council in 1970 and to the U.S. Senate in 1972.
                  As a senator, Biden drafted and led the effort to pass the
                  Violent Crime Control and Law Enforcement Act and the Violence
                  Against Women Act. He also oversaw six U.S. Supreme Court
                  confirmation hearings, including the contentious hearings for
                  Robert Bork and Clarence Thomas. Biden ran unsuccessfully for
                  the Democratic presidential nomination in 1988 and 2008. In
                  2008, Obama chose Biden as his running mate, and Biden was a
                  close counselor to Obama during his two terms as vice
                  president. In the 2020 presidential election, Biden and his
                  running mate, Kamala Harris, defeated incumbents Donald Trump
                  and Mike Pence. Biden is the second Catholic president in U.S.
                  history (after John F. Kennedy), and his politics have been
                  widely described as profoundly influenced by Catholic social
                  teaching.
        useCaseConfig:
          $ref: '#/components/schemas/UseCaseConfigKeywordExtraction'
        modelConfig:
          $ref: '#/components/schemas/ModelConfig'
    KeywordExtractionResponse:
      type: object
      x-examples: {}
      properties:
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/KeywordExtractionResponseTokens'
    UseCaseConfigKeywordExtraction:
      title: UseCaseConfigKeywordExtraction
      type: object
      properties:
        maxKeywords:
          type: integer
          example: 100
          description: >-
            This parameter specifies the maximum number of keywords that can be
            extracted, even though the model may contain more than the maximum
            number specified in this field.
    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]'
    KeywordExtractionResponseTokens:
      type: object
      x-examples: {}
      properties:
        response:
          type: string
          description: The results returned from the request.
          example: >-
            Joseph Robinette Biden Jr., 46th president of the United States,
            Democratic Party, Vice President, Barack Obama, Delaware, University
            of Delaware, Syracuse University, Violent Crime Control and Law
            Enforcement Act, Violence Against Women Act.
        tokensUsed:
          $ref: '#/components/schemas/Token'
        keywords:
          type: array
          description: >-
            Keywords derived from the response. The number of keywords is
            limited to the `maxKeywords` field in the request. 

            ```json

            "keywords": [
                    "Joseph Robinette Biden Jr.",
                    "46th president of the United States",
                    "Democratic Party",
                    "Vice President",
                    "Barack Obama",
                    "Delaware",
                    "University of Delaware",
                    "Syracuse University",
                    "Violent Crime Control and Law Enforcement Act",
                    "Violence Against Women Act"
                  ]
            ```
          items:
            type: string
            example: Joseph Robinette Biden Jr.
    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

````