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"
}
}
}'
await client.ai.createAiTextGen({
prompt: 'Paraphrase the documents',
items: [
new AiTextGenItemsField({
id: fileToAsk.id,
type: 'file' as AiTextGenItemsTypeField,
content:
'The Earth goes around the Sun. The Sun rises in the east in the morning.',
}),
],
dialogueHistory: [
{
prompt: 'What does the earth go around?',
answer: 'The Sun',
createdAt: dateTimeFromString('2021-01-01T00:00:00Z'),
} satisfies AiDialogueHistory,
{
prompt: 'On Earth, where does the Sun rise?',
answer: 'east',
createdAt: dateTimeFromString('2021-01-01T00:00:00Z'),
} satisfies AiDialogueHistory,
],
} satisfies AiTextGen);
client.ai.create_ai_text_gen(
"Paraphrase the documents",
[
CreateAiTextGenItems(
id=file_to_ask.id,
type=CreateAiTextGenItemsTypeField.FILE,
content="The Earth goes around the Sun. The Sun rises in the east in the morning.",
)
],
dialogue_history=[
AiDialogueHistory(
prompt="What does the earth go around?",
answer="The Sun",
created_at=date_time_from_string("2021-01-01T00:00:00Z"),
),
AiDialogueHistory(
prompt="On Earth, where does the Sun rise?",
answer="east",
created_at=date_time_from_string("2021-01-01T00:00:00Z"),
),
],
)
await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Paraphrase the documents", items: Array.AsReadOnly(new [] {new AiTextGenItemsField(id: fileToAsk.Id, type: AiTextGenItemsTypeField.File) { Content = "The Earth goes around the Sun. The Sun rises in the east in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The Sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the Sun rise?", Answer = "east", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
try await client.ai.createAiTextGen(requestBody: AiTextGen(prompt: "Paraphrase the documents", items: [AiTextGenItemsField(id: fileToAsk.id, type: AiTextGenItemsTypeField.file, content: "The Earth goes around the Sun. The Sun rises in the east in the morning.")], dialogueHistory: [AiDialogueHistory(prompt: "What does the earth go around?", answer: "The Sun", createdAt: try Utils.Dates.dateTimeFromString(dateTime: "2021-01-01T00:00:00Z")), AiDialogueHistory(prompt: "On Earth, where does the Sun rise?", answer: "east", createdAt: try Utils.Dates.dateTimeFromString(dateTime: "2021-01-01T00:00:00Z"))]))
client.getAi().createAiTextGen(new AiTextGen.Builder("Paraphrase the documents", Arrays.asList(new AiTextGenItemsField.Builder(fileToAsk.getId()).type(AiTextGenItemsTypeField.FILE).content("The Earth goes around the Sun. The Sun rises in the east in the morning.").build())).dialogueHistory(Arrays.asList(new AiDialogueHistory.Builder().prompt("What does the earth go around?").answer("The Sun").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build(), new AiDialogueHistory.Builder().prompt("On Earth, where does the Sun rise?").answer("east").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build())).build())
await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Paraphrase the documents", items: Array.AsReadOnly(new [] {new AiTextGenItemsField(id: fileToAsk.Id, type: AiTextGenItemsTypeField.File) { Content = "The Earth goes around the Sun. The Sun rises in the east in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The Sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the Sun rise?", Answer = "east", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
await client.ai.createAiTextGen({
prompt: 'Paraphrase the documents',
items: [
new AiTextGenItemsField({
id: fileToAsk.id,
type: 'file' as AiTextGenItemsTypeField,
content:
'The Earth goes around the Sun. The Sun rises in the east in the morning.',
}),
],
dialogueHistory: [
{
prompt: 'What does the earth go around?',
answer: 'The Sun',
createdAt: dateTimeFromString('2021-01-01T00:00:00Z'),
} satisfies AiDialogueHistory,
{
prompt: 'On Earth, where does the Sun rise?',
answer: 'east',
createdAt: dateTimeFromString('2021-01-01T00:00:00Z'),
} satisfies AiDialogueHistory,
],
} satisfies AiTextGen);
curl -i -L POST "https://api.box.com/2.0/ai/text_gen" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"items": [
{
"id": "12345678",
"type": "file"
}
],
"prompt": "Create a short blog post that provides information on Box AI for Documents and focuses on best practices for asking questions. You can add emoticons, but not too many."
}'
結果は次のようになります。
{
"answer": "📝 **Box AI for Documents: Best Practices for Asking Questions** 🤔\n\n---\n\nWelcome to our blog post on Box AI for Documents! 🎉 Today, we're going to dive into some best practices when it comes to asking questions within this innovative platform.\n\n1. **Be Clear and Concise**: When formulating a question in Box Notes, make sure your query is clear and to the point. This helps Box AI understand exactly what you're looking for.\n\n2. **Provide Context**: Giving context around your question can significantly improve the accuracy of the response generated by Box AI. Include relevant details or background information.\n\n3. **Use Keywords**: Utilize keywords related to your query within the question itself. This can help Box AI better identify the main topic of your inquiry.\n\n4. **Avoid Ambiguity**: Try to avoid vague or ambiguous questions that could lead to misunderstandings. The more precise you are, the better Box AI can assist you.\n\n5. **Review Suggestions Carefully**: After receiving suggestions from Box AI, take the time to review them carefully before incorporating them into your document. Ensure they align with your intended message.\n\nBy following these best practices, you can maximize the effectiveness of Box AI for Documents and streamline your workflow like never before! 💼✨\n\nStay tuned for more tips and tricks on leveraging technology for enhanced productivity! 👩💻🚀",
"created_at": "2024-11-04T02:46:23.459-08:00",
"completion_reason": "done"
}