サポートされているLLMにAIリクエストを送信し、提供されたコンテキストを考慮してユーザーの質問に特化した回答を返します。
リクエストの処理に使用されるAIエージェント。
これまでにLLMに渡されたプロンプトおよび回答の履歴。これにより、レスポンスの生成時にLLMに追加のコンテキストが提供されます。
"Here is the first draft of your professional email about public APIs."
以前にLLMから提供された回答。
"2012-12-12T10:53:43-08:00"
プロンプトに対する前回の回答が作成された時点のISO日付形式のタイムスタンプ。
"Make my email about public APIs sound more professional."
以前にクライアントによって提供され、LLMが回答したプロンプト。
true
引用情報を返すかどうかを示すフラグ。
LLMで処理する項目 (多くの場合はファイル)。
"123"
ファイルのID。
"file"
項目の種類。hubs
項目は、単一の項目として使用する必要があります。
次の値のいずれか1つ: file
,hubs
"This is file content."
項目のコンテンツ (多くの場合はテキストレプリゼンテーション)。
"multiple_item_qa"
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で処理されるのはテキストのみです。
次の値のいずれか1つ: multiple_item_qa
,single_item_qa
"What is the value provided by public APIs based on this document?"
LLMが回答するようにクライアントが提供するプロンプト。プロンプトの長さは10000文字に制限されています。
LLMからの回答を含む成功したレスポンス。
質問への回答に使用できるコンテンツがありません。これは、リクエストの項目がHubであっても、Hubのコンテンツにインデックスが作成されていない場合に返されます。Hub内のコンテンツにインデックスが作成されるようにするには、Hubを作成する前に、管理コンソールでBox AI for Hubsが有効になっていることを確認してください。
予期しないサーバーエラー。
予期しないエラー。
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",
}
}
}'
{
"ai_agent_info": {
"models": [
{
"name": "azure__openai__text_embedding_ada_002",
"provider": "azure",
"supported_purpose": "embedding"
}
],
"processor": "basic_text"
},
"answer": "Public APIs are important because of key and important reasons.",
"citations": [
{
"content": "Public APIs are key drivers of innovation and growth.",
"id": "123",
"name": "The importance of public APIs.pdf",
"type": "file"
}
],
"completion_reason": "done",
"created_at": "2012-12-12T10:53:43-08:00"
}