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

# Get prediction results

> Fetch the results of a prediction task by its ID.



## OpenAPI

````yaml /api-reference/saas/machine-learning-platform-async-prediction.json get /ai/async-prediction/{PREDICTION_ID}
openapi: 3.0.1
info:
  title: Lucidworks AI Async Prediction API
  version: v0
  description: >-
    The Lucidworks AI Async Prediction API contains two requests:


    * POST Request: This request is used to submit a prediction task for a
    specific `useCase` and `modelId`. Upon submission, the API responds with the
    following information:

        * `predictionId` that is a unique UUID for the submitted prediction task, and can be used later to retrieve the results. 

        * `status` that indicates the current state of the prediction task. 
     
    * GET Request: This request is used to retrieve the results of a
    previously-submitted prediction request. You must provide the unique
    `predictionId` received from the POST request. The API then returns the
    results of the prediction request associated with that `predictionId`.


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


    The `async-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: Create predictions
    description: Submit prediction tasks to Lucidworks AI.
  - name: Fetch predictions
    description: Get the results of a prediction task from Lucidworks AI.
paths:
  /ai/async-prediction/{PREDICTION_ID}:
    parameters:
      - schema:
          type: string
        name: PREDICTION_ID
        in: path
        required: true
        example: b90656aa-5c20-42cb-af02-358da99e34a1
    get:
      tags:
        - Fetch predictions
      summary: Get prediction results
      description: Fetch the results of a prediction task by its ID.
      operationId: get-ai-async-prediction-predictionId
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/FaqEnrichmentResponse'
                  - $ref: '#/components/schemas/PassthroughResponse'
                  - $ref: '#/components/schemas/RagExtDocResponse'
                  - $ref: '#/components/schemas/StandaloneResponse'
                  - $ref: '#/components/schemas/SummarizationResponse'
                  - $ref: '#/components/schemas/KeywordExtractionResponse'
                  - $ref: '#/components/schemas/NerResponse'
              examples:
                FAQ Enrichment prediction:
                  summary: FAQ Enrichment prediction
                  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.
                Passthrough prediction:
                  summary: Passthrough prediction
                  value:
                    predictionId: 5e893b16-01f8-427c-9ca8-ba52b01b1ba3
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 51
                          completionTokens: 4
                          totalTokens: 55
                        response: 'CORRECT: misspelled'
                RAG prediction:
                  summary: RAG prediction
                  value:
                    predictionId: 266fd643-794b-4491-a0b2-cca6b2acbb7a
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 468
                          completionTokens: 20
                          totalTokens: 488
                        answer: You went to Germany to attend the Oktoberfest.
                        answerFound: true
                        sources:
                          - http://example.com/112
                        memoryUuid: d253039f-6a19-4a75-bfef-4f2347e71ccb
                        response: >-
                          SOURCES: 

                          - 0

                          ANSWER: "You went to Germany to attend the
                          Oktoberfest."
                Standalone query rewriter prediction:
                  summary: Standalone query rewriter prediction
                  value:
                    predictionId: 632781ce-0fbd-49c3-96bf-12e1cb90379d
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 92
                          completionTokens: 7
                          totalTokens: 99
                        query: Is it a framework?
                        response: Is Django a framework?
                Summarization prediction:
                  summary: Summarization prediction
                  value:
                    predictionId: cd9a118d-a573-4bf7-9f59-ad6934ef78ab
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 271
                          completionTokens: 81
                          totalTokens: 352
                        summary: >-
                          The Dursleys' home on Privet Drive remained unchanged
                          over the past ten years since Harry Potter's arrival.
                          The only indications of time passing were the updated
                          family photographs, which showed Dudley growing up but
                          no sign of Harry's existence. Despite Harry's presence
                          in their home, the Dursleys continued their neglect
                          and disdain towards him.
                        response: >-
                          The Dursleys' home on Privet Drive remained unchanged
                          over the past ten years since Harry Potter's arrival.
                          The only indications of time passing were the updated
                          family photographs, which showed Dudley growing up but
                          no sign of Harry's existence. Despite Harry's presence
                          in their home, the Dursleys continued their neglect
                          and disdain towards him.
                Keyword extraction prediction:
                  summary: Keyword extraction prediction
                  value:
                    predictionId: b90656aa-5c20-42cb-af02-358da99e34a1
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 432
                          completionTokens: 301
                          totalTokens: 733
                        keywords:
                          - Joseph Robinette Biden Jr.
                          - American politician
                          - 46th and current president
                          - United States
                          - Ideologically moderate
                          - Democratic Party
                          - Previously served as vice president
                          - Barack Obama
                          - Delaware
                          - University of Delaware
                          - Syracuse University
                          - New Castle County Council
                          - U.S. Senate
                          - Violent Crime Control and Law Enforcement Act
                          - Violence Against Women Act
                          - Supreme Court confirmation hearings
                          - Robert Bork
                          - Clarence Thomas
                          - Democratic presidential nomination
                          - '1988'
                          - '2008'
                          - Kamala Harris
                          - Donald Trump
                          - Mike Pence
                          - Catholic
                          - Catholic social teaching
                          - Scranton, Pennsylvania
                          - Born
                          - Family
                          - Moved
                          - Delaware
                          - Law degree
                          - Elected
                          - New Castle County Council
                          - U.S. Senate
                          - Drafted
                          - Led
                          - Passed
                          - Violent Crime Control and Law Enforcement Act
                          - Violence Against Women Act
                          - Oversaw
                          - Six U.S. Supreme Court confirmation hearings
                          - Close counselor
                          - Two terms
                          - Vice president
                          - 2020 presidential election
                          - Defeated
                          - Incumbents
                          - Second Catholic president
                          - John F. Kennedy
                          - Catholic social teaching
                          - Influenced
                          - Politics
                        response: |-
                          keywords:
                          - Joseph Robinette Biden Jr.
                          - American politician
                          - 46th and current president
                          - United States
                          - Ideologically moderate
                          - Democratic Party
                          - Previously served as vice president
                          - Barack Obama
                          - Delaware
                          - University of Delaware
                          - Syracuse University
                          - New Castle County Council
                          - U.S. Senate
                          - Violent Crime Control and Law Enforcement Act
                          - Violence Against Women Act
                          - Supreme Court confirmation hearings
                          - Robert Bork
                          - Clarence Thomas
                          - Democratic presidential nomination
                          - 1988
                          - 2008
                          - Kamala Harris
                          - Donald Trump
                          - Mike Pence
                          - Catholic
                          - Catholic social teaching
                          - Scranton, Pennsylvania
                          - Born
                          - Family
                          - Moved
                          - Delaware
                          - Law degree
                          - Elected
                          - New Castle County Council
                          - U.S. Senate
                          - Drafted
                          - Led
                          - Passed
                          - Violent Crime Control and Law Enforcement Act
                          - Violence Against Women Act
                          - Oversaw
                          - Six U.S. Supreme Court confirmation hearings
                          - Close counselor
                          - Two terms
                          - Vice president
                          - 2020 presidential election
                          - Defeated
                          - Incumbents
                          - Second Catholic president
                          - John F. Kennedy
                          - Catholic social teaching
                          - Influenced
                          - Politics
                NER prediction:
                  summary: NER prediction
                  value:
                    predictionId: 1e5845b3-b328-4f2f-af5f-2f11df24b457
                    status: READY
                    predictions:
                      - tokensUsed:
                          promptTokens: 408
                          completionTokens: 16
                          totalTokens: 424
                        entities:
                          Location:
                            - Porbandar
                            - India
                            - South Africa
                        response: |-
                          Location:
                          - Porbandar
                          - India
                          - South Africa
        4XX:
          $ref: '#/components/responses/Error'
components:
  schemas:
    FaqEnrichmentResponse:
      title: 'Response: FAQ Enrichment'
      type: object
      properties:
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/FaqEnrichmentResponseTokens'
      x-examples: {}
    PassthroughResponse:
      type: object
      x-examples: {}
      title: 'Response: Passthrough'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/PassthroughResponseTokens'
    RagExtDocResponse:
      type: object
      x-examples: {}
      title: 'Response: RAG use case'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/RagExtDocResponseTokens'
      description: ''
    StandaloneResponse:
      type: object
      x-examples: {}
      title: 'Response: Standalone query rewriter'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/StandaloneResponseTokens'
    SummarizationResponse:
      type: object
      x-examples: {}
      title: 'Response: Summarization'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/SummarizationResponseTokens'
    KeywordExtractionResponse:
      type: object
      x-examples: {}
      title: 'Response: Keyword extraction'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/KeywordExtractionResponseTokens'
    NerResponse:
      type: object
      x-examples: {}
      title: 'Response: NER (Named Entity Recognition)'
      properties:
        predictionId:
          $ref: '#/components/schemas/predictionId'
        status:
          $ref: '#/components/schemas/status'
        predictions:
          type: array
          items:
            $ref: '#/components/schemas/NerResponseTokens'
    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'
    predictionId:
      title: predictionId
      type: string
      description: >-
        The universal unique identifier (UUID) returned in the POST request.
        This UUID is required in the GET request to retrieve results.
      format: uuid
      example: fd110486-f168-47c0-a419-1518a4840589
    status:
      title: status
      type: string
      description: >-
        The current status of the prediction. Allowed values are:


        * `SUBMITTED` - The POST request was successful and the response has
        returned the `predictionId` and `status` that is used by the GET
        request.


        * `READY` - The results associated with the `predictionId` are available
        and ready to be retrieved.


        * `ERROR` - An error was generated when the GET request was sent.


        * `RETRIEVED` - The results associated with the `predictionId` are
        returned successfully when the GET request was sent.
      example: READY
    PassthroughResponseTokens:
      type: object
      properties:
        response:
          type: string
          description: The results returned from the request.
          example: 'CORRECT: misspelled'
        tokensUsed:
          $ref: '#/components/schemas/Token'
    RagExtDocResponseTokens:
      type: object
      properties:
        response:
          type: string
          description: The unparsed response returned from the request.
          example: >-
            ANSWER: \"Retrieval Augmented Generation, known as RAG, a framework
            promising to optimize generative AI.\"\nSOURCES:
            [\"http://example.com/112\"]
        tokensUsed:
          $ref: '#/components/schemas/Token'
        answer:
          type: string
          description: 'The parsed response text from the document. '
          example: >-
            Retrieval Augmented Generation, known as RAG, a framework promising
            to optimize generative AI.
        sources:
          type: array
          items:
            type: string
            format: uri
          description: >-
            One or more URLs that identify the source of the document returned
            in the response.
          example:
            - http://example.com/112
        memoryUuid:
          type: string
          description: >-
            The universal unique identifier (UUID) stored in the trained set of
            data in the model that is used in the model request.


            This parameter is optional, and is used when previous chat history
            reference information is available.
          example: 27a887fe-3d7c-4ef0-9597-e2dfc054c20e
        answerNotFoundMessage:
          type: string
          description: >-
            This parameter is optional, and can be passed to change the response
            if the LLM cannot answer the request. The default is "Not possible
            to answer given this content."
          default: Not possible to answer given this content.
        answerFound:
          type: boolean
          description: >-
            This parameter is false if the value in the answerNotFoundMessage
            field is used in the response. If an answer is returned for the
            request, this parameter is true.
    StandaloneResponseTokens:
      type: object
      properties:
        response:
          type: string
          description: The results returned from the request.
          example: Is RAG a framework?
        tokensUsed:
          $ref: '#/components/schemas/Token'
    SummarizationResponseTokens:
      type: object
      properties:
        tokensUsed:
          $ref: '#/components/schemas/Token'
        response:
          type: string
          description: The results returned from the request.
          example: >-
            A decade after the Dursleys found their nephew on their doorstep,
            Privet Drive remains largely unchanged. The only noticeable
            difference is in the family photographs, which now depict Dudley
            Dursley as a large blond boy engaged in various activities,
            replacing his baby pictures. There is no indication of another boy
            living in the house.
      x-examples: {}
    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.
    NerResponseTokens:
      type: object
      x-examples: {}
      properties:
        tokensUsed:
          $ref: '#/components/schemas/Token'
        entities:
          type: object
          properties:
            entity:
              type: array
              description: "The result of the requested entity type that was a key with a list of example values to search.\nFor example:\n\n{\n\t\t\t\t\"Location\": [\n\t\t\t\t\t\"Porbandar\",\n\t\t\t\t\t\"India\",\n\t\t\t\t\t\"South Africa\"\n\t\t\t\t]\n\t\t\t}"
              items:
                type: string
        response:
          type: string
          description: The results returned from the request.
          example: '{\n\"Location\": [\n\"Porbandar\",\n\"India\"\n]\n}'
    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
  responses:
    Error:
      description: >-
        The error varies based on the issue encountered regarding the
        `predictionId` or related information.
      content:
        application/json:
          schema:
            type: object
            properties:
              predictionId:
                $ref: '#/components/schemas/predictionId'
              status:
                $ref: '#/components/schemas/status'
              message:
                type: string
                description: >-
                  The error generated if the `predictionId` cannot be located or
                  the related information cannot be retrieved. For example,
                  "System prompt exceeded the maximum number of allowed input
                  tokens."

````