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

# Standalone query rewriter 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>;
};

[old doc.lw link]: https://doc.lucidworks.com/lw-platform/ai/2u3u6l

[localhost link]: http://localhost:3000/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-prediction-api/standalone-query-rewriter-prediction

[mintlify link]: https://doc.lucidworks.com/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-prediction-api/standalone-query-rewriter-prediction

The Standalone query rewriter use case of the [LWAI Prediction API](/docs/lw-platform/lw-ai/lw-ai-apis/lw-ai-prediction-api/overview) rewrites the text in reference to the context based on the `memoryUuid` into a standalone query.

This use case can only use the `memoryUuid` from a previous RAG query or standalone interaction.

<Note>
  For detailed API specifications in Swagger/OpenAPI format, see [Platform APIs](/api-reference/get-predictions/standalone-query-rewriter).
</Note>

<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 for the use case request. The path is: `/ai/prediction/USE_CASE/MODEL_ID`. A list of supported models 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).

## Common parameters and fields

Some parameters in the `/ai/async-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](/api-reference/get-predictions/standalone-query-rewriter) for more information.

## Unique values for the standalone query rewriter use case

Some parameter values available in the `standalone query rewriter` use case are unique to this use case, including values for the `useCaseConfig` parameter.
Refer to the [API spec](/api-reference/get-predictions/standalone-query-rewriter) for more information.

This example does not include `modelConfig` parameters, but you can submit requests that include parameters described in [Common parameters and fields](#common-parameters-and-fields).

<CodeGroup>
  ```json Request theme={"dark"}
  curl --request POST \
    --url https://APPLICATION_ID.applications.lucidworks.com/ai/prediction/standalone-query-rewriter/MODEL_ID \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'Content-type: application/json' \
    --data '{
    "batch": [
      {
        "text": "Is it a framework?"
        }
    ],
      "useCaseConfig": {
        "memoryUuid": "27a887fe-3d7c-4ef0-9597-e2dfc054c20e"
      }
  }'
  ```

  ```json Response theme={"dark"}
  {
    "predictions": [
      {
        "response": "Is RAG a framework?",
        "tokensUsed": {
         "promptTokens": 245,
         "completionTokens": 6,
         "totalTokens": 251
         }
      }
    ]
  }
  ```
</CodeGroup>
