public class SlidesAIAgent
extends java.lang.Object
Provides AI-powered features for processing presentations.
| Constructor and Description |
|---|
SlidesAIAgent(IAIWebClient aiClient)
SlidesAIAgent constructor
|
| Modifier and Type | Method and Description |
|---|---|
IPresentation |
generatePresentation(java.lang.String description,
int presentationContentAmount)
Generates a presentation instance from a text description.
|
IPresentation |
generatePresentation(java.lang.String description,
int presentationContentAmount,
IPresentation presentationTemplate)
Generates a presentation instance from a text description.
|
void |
translate(IPresentation presentation,
java.lang.String language)
Translates a presentation to the specified language using AI (synchronous version).
|
public SlidesAIAgent(IAIWebClient aiClient)
SlidesAIAgent constructor
aiClient - AI client instancecom.aspose.ms.System.ArgumentNullException - AI client instance is not providedpublic void translate(IPresentation presentation, java.lang.String language)
Translates a presentation to the specified language using AI (synchronous version).
presentation - Target presentationlanguage - Target language
Presentation presentation = new Presentation("Presentation.pptx");
try {
IAIWebClient aiWebClient = new OpenAIWebClient("gpt-4o-mini", "apiKey", null);
SlidesAIAgent aiAgent = new SlidesAIAgent(aiWebClient);
aiAgent.translate(presentation, "spanish");
presentation.save("translated.pptx", SaveFormat.Pptx);
} finally {
if (presentation != null) presentation.dispose();
}
com.aspose.ms.System.ArgumentNullException - Presentation instance is not providedcom.aspose.ms.System.ArgumentException - Language value can't be null or emptypublic final IPresentation generatePresentation(java.lang.String description, int presentationContentAmount)
Generates a presentation instance from a text description. Provide a topic, ideas, quotes, or text snippets in the required language.
description - The topic, ideas, quotes, or text snippets.presentationContentAmount - The amount of content in the resulting presentation.
String prompt = "Generate a presentation about Aspose.Slides for Java. Highlight its key features, use cases, and explain why it is better than its competitors.";
OpenAIWebClient aiWebClient = new OpenAIWebClient("gpt-4o-mini", apiKey, null);
try {
SlidesAIAgent aiAgent = new SlidesAIAgent(aiWebClient);
IPresentation pres = aiAgent.generatePresentation(prompt, PresentationContentAmountType.Brief);
pres.save("result.pptx", SaveFormat.Pptx);
} finally {
if (aiWebClient != null) aiWebClient.close();
}
com.aspose.ms.System.ArgumentException - AI chat instruction can't be null or empty.public final IPresentation generatePresentation(java.lang.String description, int presentationContentAmount, IPresentation presentationTemplate)
Generates a presentation instance from a text description. Provide a topic, ideas, quotes, or text snippets in the required language.
description - The topic, ideas, quotes, or text snippets.presentationContentAmount - The amount of content in the resulting presentation.presentationTemplate - A presentation to use as a template for layout and design, replacing the default template.
String prompt = "Generate a presentation about Aspose.Slides for Java. Highlight its key features, use cases, and explain why it is better than its competitors.";
IPresentation template = new Presentation("masterPresentation.pptx");
try {
OpenAIWebClient aiWebClient = new OpenAIWebClient("gpt-4o-mini", apiKey, null);
try {
SlidesAIAgent aiAgent = new SlidesAIAgent(aiWebClient);
IPresentation pres =
aiAgent.generatePresentation(prompt, PresentationContentAmountType.Brief, template);
pres.save("result.pptx", SaveFormat.Pptx);
} finally {
if (aiWebClient != null) aiWebClient.close();
}
} finally {
if (template != null) template.dispose();
}
com.aspose.ms.System.ArgumentNullException - Presentation template is not provided.com.aspose.ms.System.ArgumentException - AI chat instruction can't be null or empty.Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.