AsposeAIWebClient

AsposeAIWebClient class

A built-in IAIWebClient implementation that connects to Aspose’s own LLM. This is the default client used by the parameterless SlidesAIAgent() constructor.

AsposeAIWebClient

NameDescription
AsposeAIWebClient()Creates an instance of the Aspose AI web client that connects to the default Aspose LLM endpoint. This is the client used by the parameterless SlidesAIAgent() function, so creating it explicitly is only required when passing the client to the SlidesAIAgent(IAIWebClient) function directly. using (AsposeAIWebClient aiClient = new AsposeAIWebClient()) { SlidesAIAgent aiAgent = new SlidesAIAgent(aiClient); using (Presentation presentation = new Presentation(“Presentation.pptx”)) { await aiAgent.TranslateAsync(presentation, “spanish”); presentation.Save(“translated.pptx”, SaveFormat.Pptx); } }

Returns: AsposeAIWebClient


AsposeAIWebClient

NameDescription
AsposeAIWebClient(HttpURLConnection)Creates an instance of the Aspose AI web client that connects to the default Aspose LLM endpoint using an externally managed HttpClient. The provided HttpClient is not disposed by this instance and remains owned by the caller.

Parameters:

NameTypeDescription
httpClientHttpURLConnectionAn externally managed {@code HttpClient} instance. using (HttpClient httpClient = new HttpClient()) { AsposeAIWebClient aiClient = new AsposeAIWebClient(httpClient); SlidesAIAgent aiAgent = new SlidesAIAgent(aiClient); using (Presentation presentation = new Presentation(“Presentation.pptx”)) { await aiAgent.TranslateAsync(presentation, “spanish”); presentation.Save(“translated.pptx”, SaveFormat.Pptx); } }

Returns: AsposeAIWebClient

Error

ErrorCondition
ArgumentNullExceptionHttpClient instance is not provided.

AsposeAIWebClient

NameDescription
AsposeAIWebClient(String)Creates an instance of the Aspose AI web client that connects to a custom endpoint URL. Use this overload when you have a URL provided by the Aspose.Slides team; otherwise, use the AsposeAIWebClient() overload with the default URL.

Parameters:

NameTypeDescription
urlStringEndpoint URL of the Aspose LLM, provided by the Aspose.Slides team. using (AsposeAIWebClient aiClient = new AsposeAIWebClient(customUrl)) { SlidesAIAgent aiAgent = new SlidesAIAgent(aiClient); using (Presentation presentation = new Presentation(“Presentation.pptx”)) { await aiAgent.TranslateAsync(presentation, “spanish”); presentation.Save(“translated.pptx”, SaveFormat.Pptx); } }

Returns: AsposeAIWebClient

Error

ErrorCondition
ArgumentNullExceptionURL can’t be null or empty.

AsposeAIWebClient

NameDescription
AsposeAIWebClient(String, HttpURLConnection)Creates an instance of the Aspose AI web client that connects to a custom endpoint URL using an externally managed HttpClient. The provided HttpClient is not disposed by this instance and remains owned by the caller. Use this overload when you have a URL provided by the Aspose.Slides team and want to supply your own HttpClient; if you only need your own HttpClient with the default URL, use the AsposeAIWebClient(HttpClient) overload instead.

Parameters:

NameTypeDescription
urlStringEndpoint URL of the Aspose LLM, provided by the Aspose.Slides team.
httpClientHttpURLConnectionAn externally managed {@code HttpClient} instance. using (HttpClient httpClient = new HttpClient()) { AsposeAIWebClient aiClient = new AsposeAIWebClient(customUrl, httpClient); SlidesAIAgent aiAgent = new SlidesAIAgent(aiClient); using (Presentation presentation = new Presentation(“Presentation.pptx”)) { await aiAgent.TranslateAsync(presentation, “spanish”); presentation.Save(“translated.pptx”, SaveFormat.Pptx); } }

Returns: AsposeAIWebClient

Error

ErrorCondition
ArgumentNullExceptionHttpClient instance is not provided.

callChat

NameDescription
callChat (String)

Returns: String


createConversation

NameDescription
createConversation ()Creates a conversation instance. Unlike regular AI calls, conversations retain the entire context.

Returns: OpenAIConversation


dispose

NameDescription
dispose ()Releases resources used by this instance.