Join us on May 20th for the Content + AI Virtual Summit. Register now
curl -i -L -X POST "https://api.box.com/2.0/ai/text_gen" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"prompt": "Write a social media post about protein powder.",
"items": [
{
"id": "12345678",
"type": "file",
"content": "More information about protein powders"
}
],
"dialogue_history": [
{
"prompt": "Can you add some more information?",
"answer": "Public API schemas provide necessary information to integrate with APIs...",
"created_at": "2013-12-12T11:20:43-08:00"
}
],
"ai_agent": {
"type": "ai_agent_text_gen",
"basic_gen": {
"model": "azure__openai__gpt_4o_mini"
}
}
}'{
"answer": "Public APIs are important because of key and important reasons.",
"created_at": "2012-12-12T10:53:43-08:00",
"completion_reason": "done",
"ai_agent_info": {
"models": [
{
"name": "azure__openai__text_embedding_ada_002",
"provider": "azure",
"supported_purpose": "embedding"
}
],
"processor": "basic_text"
}
}Sends an AI request to supported Large Language Models (LLMs) and returns generated text based on the provided prompt.
curl -i -L -X POST "https://api.box.com/2.0/ai/text_gen" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"prompt": "Write a social media post about protein powder.",
"items": [
{
"id": "12345678",
"type": "file",
"content": "More information about protein powders"
}
],
"dialogue_history": [
{
"prompt": "Can you add some more information?",
"answer": "Public API schemas provide necessary information to integrate with APIs...",
"created_at": "2013-12-12T11:20:43-08:00"
}
],
"ai_agent": {
"type": "ai_agent_text_gen",
"basic_gen": {
"model": "azure__openai__gpt_4o_mini"
}
}
}'{
"answer": "Public APIs are important because of key and important reasons.",
"created_at": "2012-12-12T10:53:43-08:00",
"completion_reason": "done",
"ai_agent_info": {
"models": [
{
"name": "azure__openai__text_embedding_ada_002",
"provider": "azure",
"supported_purpose": "embedding"
}
],
"processor": "basic_text"
}
}Documentation Index
Fetch the complete documentation index at: https://developer.box.com/llms.txt
Use this file to discover all available pages before exploring further.
The access token received from the authorization server in the OAuth 2.0 flow.
AI text gen request object.
The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
"Write an email to a client about the importance of public APIs."
The items to be processed by the LLM, often files. The array can include exactly one element.
Note: Box AI handles documents with text representations up to 1MB in size. If the file size exceeds 1MB, the first 1MB of text representation will be processed.
1 elementShow child attributes
The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response.
Show child attributes
The AI agent to be used for generating text.
Show child attributes
A successful response including the answer from the LLM.
AI response.
The answer provided by the LLM.
"Public APIs are important because of key and important reasons."
The ISO date formatted timestamp of when the answer to the prompt was created.
"2012-12-12T10:53:43-08:00"
The reason the response finishes.
"done"
The information on the models and processors used in the request.
Show child attributes
Was this page helpful?