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_3_5_turbo_16k",
"system_message": "You are a helpful travel assistant specialized in budget travel",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
"num_tokens_for_completion": 8400,
"llm_endpoint_params": {
"type": "openai_params",
"temperature": 0.0,
"top_p": 1.0,
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>"
},
"embeddings": {
"model": "openai__text_embedding_ada_002",
"strategy": {
"id": "basic",
"num_tokens_per_chunk": 8400
}
}
},
"basic_text": {
"model": ""azure__openai__gpt_3_5_turbo_16k"",
"system_message": "You are a helpful travel assistant specialized in budget travel",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
"num_tokens_for_completion": 8400,
"llm_endpoint_params": {
"type": "openai_params",
"temperature": 0.0,
"top_p": 1.0,
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>"
}
},
"long_text_multi": {
"model": "azure__openai__gpt_3_5_turbo_16k",
"system_message": "You are a helpful travel assistant specialized in budget travel",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
"num_tokens_for_completion": 8400,
"llm_endpoint_params": {
"type": "openai_params",
"temperature": 0.0,
"top_p": 1.0,
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>"
},
"embeddings": {
"model": "openai__text_embedding_ada_002",
"strategy": {
"id": "basic",
"num_tokens_per_chunk": 8400
}
}
},
"basic_text_multi": {
"model": ""azure__openai__gpt_3_5_turbo_16k"",
"system_message": "You are a helpful travel assistant specialized in budget travel",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
"num_tokens_for_completion": 8400,
"llm_endpoint_params": {
"type": "openai_params",
"temperature": 0.0,
"top_p": 1.0,
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>"
}
}
}'
await client.ai.createAiAsk({
mode: 'multiple_item_qa' as AiAskModeField,
prompt: 'Which direction sun rises?',
items: [
new AiItemBase({
id: fileToAsk1.id,
type: 'file' as AiItemBaseTypeField,
content: 'Earth goes around the sun',
}),
new AiItemBase({
id: fileToAsk2.id,
type: 'file' as AiItemBaseTypeField,
content: 'Sun rises in the East in the morning',
}),
],
} satisfies AiAsk);
client.ai.create_ai_ask(
CreateAiAskMode.MULTIPLE_ITEM_QA.value,
"Which direction sun rises?",
[
AiItemBase(
id=file_to_ask_1.id,
type=AiItemBaseTypeField.FILE.value,
content="Earth goes around the sun",
),
AiItemBase(
id=file_to_ask_2.id,
type=AiItemBaseTypeField.FILE.value,
content="Sun rises in the East in the morning",
),
],
)
await client.Ai.CreateAiAskAsync(requestBody: new AiAsk(mode: AiAskModeField.MultipleItemQa, prompt: "Which direction sun rises?", items: Array.AsReadOnly(new [] {new AiItemBase(id: fileToAsk1.Id, type: AiItemBaseTypeField.File) { Content = "Earth goes around the sun" },new AiItemBase(id: fileToAsk2.Id, type: AiItemBaseTypeField.File) { Content = "Sun rises in the East in the morning" }})));
BoxAIResponse response = BoxAI.sendAIRequest(
api,
"What is the content of the file?",
Collections.singletonList("123456", BoxAIItem.Type.FILE),
BoxAI.Mode.SINGLE_ITEM_QA
);
BoxAIResponse response = await client.BoxAIManager.SendAIQuestionAsync(
new BoxAIAskRequest
{
Prompt = "What is the name of the file?",
Items = new List<BoxAIAskItem>() { new BoxAIAskItem() { Id = "12345" } },
Mode = AiAskMode.single_item_qa
};
);
Make my email about public APIs sound more professional
dialogue_history.answer
以前にLLMから提供された回答。
Here is a draft of your professional email about public APIs.
dialogue_history.created_at
プロンプトに対する前回の回答が作成された時点のISO日付形式のタイムスタンプ。
2012-12-12T10:53:43-08:00
include_citations
回答で引用情報を返すかどうかを指定します。
true, false
true
items.id
入力データとして指定するBoxファイルID。
112233445566
items.type
指定した入力データのタイプ。現在は、1つのファイルまたは複数のファイルを指定できます。
file
file
items.content
項目のコンテンツ (多くの場合はテキストレプリゼンテーション)。
An application programming interface (API) is a way for two or more computer programs or components to communicate with each other. It is a type of software interface...