Skip to main content

Before you start

Make sure you followed the steps listed in to create a platform app and authenticate. To get more context, read about .

Override prompt

This example shows how to use the prompt_template parameter to change the query result. The first step is to ask Box AI to summarize a document about Box AI for Documents. The mode parameter is set to single_item_qa because only one document is supplied.
You will get a response similar to the following:
To further improve the result, you can use the prompt_template parameter to add some more instructions for Box AI. In this example, letโ€™s change the tone of the response.
The response would be slightly less formal:

Override AI model (text generation)

This example shows you how changing the AI model in the ai_agent options can influence the way the text is generated. First letโ€™s generate some text using the POST ai/text_gen endpoint. This endpoint is using the OpenAI 3.5 turbo model by default.
The response is as follows:
Letโ€™s change the model using the ai_agent configuration:
After the model switch, the response is slightly different:
As you can see the responses differ to some extent. Thanks to the model switch, you can optimize your interaction with Box AI and choose the most suitable model for your needs.

Override AI model (metadata extraction)

Switching models can also give us different results for metadata extraction. Letโ€™s use a sample contract to extract the metadata. In this example, the model used is Google Gemini.
The response is a set of metadata:
Letโ€™s change the model to the most recent OpenAI option:
Using this model results in a response listing more metadata entries:
Last modified on April 27, 2026