Join a webinar on April 30th: Unlocking Your Data using AI with Box Extract & MCP Server. Register here
curl -i -L POST "https://api.box.com/2.0/ai/ask" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"mode": "single_item_qa",
"prompt": "What is the value provided by public APIs based on this document?",
"items": [
{
"type": "file",
"id": "9842787262"
}
],
"dialogue_history": [
{
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
}
],
"include_citations": true,
"ai_agent": {
"type": "ai_agent_ask",
"long_text": {
"model": "azure__openai__gpt_4o_mini",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
},
"basic_text": {
"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"
},
"citations": [
{
"content": "Public APIs are key drivers of innovation and growth.",
"id": "123",
"type": "file",
"name": "The importance of public APIs.pdf"
}
]
}サポートされているLLMにAIリクエストを送信し、提供されたコンテキストを考慮してユーザーの質問に特化した回答を返します。
curl -i -L POST "https://api.box.com/2.0/ai/ask" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"mode": "single_item_qa",
"prompt": "What is the value provided by public APIs based on this document?",
"items": [
{
"type": "file",
"id": "9842787262"
}
],
"dialogue_history": [
{
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
}
],
"include_citations": true,
"ai_agent": {
"type": "ai_agent_ask",
"long_text": {
"model": "azure__openai__gpt_4o_mini",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
},
"basic_text": {
"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"
},
"citations": [
{
"content": "Public APIs are key drivers of innovation and growth.",
"id": "123",
"type": "file",
"name": "The importance of public APIs.pdf"
}
]
}The access token received from the authorization server in the OAuth 2.0 flow.
AIへの質問リクエストオブジェクト。
Box AIは、最大1 MBのテキストレプリゼンテーションを含むテキストドキュメント、または最大25ファイルを処理します (いずれか先に到達した方)。ファイルサイズが1 MBを超える場合は、テキストレプリゼンテーションの最初の1 MBが処理されます。Box AIは、解像度が1024 x 1024ピクセルの画像ドキュメントを処理し、最大5つの画像か、複数ページの画像の場合は5ページを処理します。画像数または画像ページ数が5を超える場合は、最初の5つの画像または5ページが処理されます。modeパラメータをsingle_item_qaに設定した場合、items配列に含めることができる要素は1つのみです。現在、Box AIでは、マルチモーダルリクエストがサポートされていません。画像とテキストの両方が送信された場合、Box AIで処理されるのはテキストのみです。
multiple_item_qa, single_item_qa "multiple_item_qa"
LLMが回答するようにクライアントが提供するプロンプト。プロンプトの長さは10000文字に制限されています。
"What is the value provided by public APIs based on this document?"
LLMで処理する項目 (多くの場合はファイル)。
1 - 25 elementsShow child attributes
これまでにLLMに渡されたプロンプトおよび回答の履歴。これにより、レスポンスの生成時にLLMに追加のコンテキストが提供されます。
Show child attributes
引用情報を返すかどうかを示すフラグ。
true
リクエストの処理に使用されるAIエージェント。
Show child attributes
LLMからの回答を含む成功したレスポンス。
AIの質問への応答。
LLMから提供された回答。
"Public APIs are important because of key and important reasons."
プロンプトに対する回答が作成された時点のISO日付形式のタイムスタンプ。
"2012-12-12T10:53:43-08:00"
応答が終了した理由。
"done"
リクエストで使用されるモデルおよびプロセッサに関する情報。
Show child attributes
LLMの回答で参照された部分の引用情報。
Show child attributes
このページは役に立ちましたか?