メインコンテンツへスキップ
POST
/
ai
/
text_gen
cURL
curl -i -L 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"
  }
}
このリソースは、バージョン2024.0のエンドポイントで使用されています。 詳細については、 Box APIのバージョン管理を参照してください。Box SDKのバージョニング戦略について詳しく学ぶ。」

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

AIへのテキスト生成リクエストオブジェクト。

prompt
string
required

LLMが回答するようにクライアントが提供するプロンプト。プロンプトの長さは10000文字に制限されています。

Example:

"Write an email to a client about the importance of public APIs."

items
object[]
required

LLMで処理する項目 (多くの場合はファイル)。この配列に含めることができる要素は1つだけです。

: Box AIは、最大1 MBのテキストレプリゼンテーションを含むドキュメントを処理します。ファイルサイズが1 MBを超えた場合は、テキストレプリゼンテーションの最初の1 MBが処理されます。

Required array length: 1 element
dialogue_history
会話履歴 · object[]

これまでにLLMに渡されたプロンプトおよび回答の履歴。このパラメータにより、レスポンスの生成時にLLMに追加のコンテキストが提供されます。

ai_agent
AIへのテキスト生成リクエストのエージェント · object

テキストの生成に使用されるAIエージェント。

Response

LLMからの回答を含む成功したレスポンス。

AIの応答。

answer
string
required

LLMから提供された回答。

Example:

"Public APIs are important because of key and important reasons."

created_at
string<date-time>
required

プロンプトに対する回答が作成された時点のISO日付形式のタイムスタンプ。

Example:

"2012-12-12T10:53:43-08:00"

completion_reason
string

応答が終了した理由。

Example:

"done"

ai_agent_info
リクエストで使用されるモデルおよびプロセッサに関する情報。 · object

リクエストで使用されるモデルおよびプロセッサに関する情報。