BoxWorks 2024でコンテンツとAIの可能性について紹介します。
サポートされている大規模言語モデル (LLM) にAIリクエストを送信し、メタデータをキー/値ペアの形式で抽出します。このリクエストでは、プロンプトと出力の両方を自由形式にすることができます。リクエストを送信する前に、メタデータテンプレートの設定は必要ありません。
抽出に使用されるAIエージェント。
LLMで処理される項目。現在使用できるのはファイルのみです。
"123"ファイルのID。
"file"項目の種類。現在、この値に指定できるのはfileのみです。
次の値に固定: file
"This is file content."項目のコンテンツ (多くの場合はテキストレプリゼンテーション)。
"\"fields\":[{\"type\":\"string\",\"key\":\"name\",\"displayName\":\"Name\",\"description\":\"The customer name\",\"prompt\":\"Name is always the first word in the document\"},{\"type\":\"date\",\"key\":\"last_contacted_at\",\"displayName\":\"Last Contacted At\",\"description\":\"When this customer was last contacted at\"}]"リクエストで大規模言語モデル (LLM) に提供されるプロンプト。プロンプトには、最大10,000文字を指定できるほか、XMLまたはJSONスキーマを使用することができます。
curl -i -L 'https://api.box.com/2.0/ai/extract' \
-H 'content-type: application/json' \
-H 'authorization: Bearer <ACCESS_TOKEN>' \
-d '{
"prompt": "Extract data related to contract conditions",
"items": [
{
"type": "file",
"id": "1497741268097"
}
],
"ai_agent": {
"type": "ai_agent_extract",
"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",
}
}
}'await client.ai.createAiExtract({
prompt: 'firstName, lastName, location, yearOfBirth, company',
items: [new AiItemBase({ id: file.id })],
aiAgent: aiExtractAgentBasicTextConfig,
} satisfies AiExtract);client.ai.create_ai_extract(
"firstName, lastName, location, yearOfBirth, company",
[AiItemBase(id=file.id)],
ai_agent=ai_extract_agent_basic_text_config,
)await client.Ai.CreateAiExtractAsync(requestBody: new AiExtract(prompt: "firstName, lastName, location, yearOfBirth, company", items: Array.AsReadOnly(new [] {new AiItemBase(id: file.Id)})));try await client.ai.createAiExtract(requestBody: AiExtract(prompt: "firstName, lastName, location, yearOfBirth, company", items: [AiItemBase(id: file.id)]))client.getAi().createAiExtract(new AiExtract.Builder("firstName, lastName, location, yearOfBirth, company", Arrays.asList(new AiItemBase(file.getId()))).aiAgent(aiExtractAgentBasicTextConfig).build())BoxAIResponse response = BoxAI.extractMetadataFreeform(
api,
"firstName, lastName, location, yearOfBirth, company",
Collections.singletonList(new BoxAIItem("123456", BoxAIItem.Type.FILE))
);{
"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.",
"completion_reason": "done",
"created_at": "2012-12-12T10:53:43-08:00"
}