Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
What is this page about?
This page explains which AI models Aspose.Words supports for document tasks.
Aspose.Words now leverages advanced AI models to enhance document processing and analysis. With the Aspose.Words.AI namespace, developers can access AI‑powered features such as document summarization and analysis, document translation, and grammar checking by integrating generative language models from industry leaders.
Aspose.Words library currently supports integration with:
These models bring powerful capabilities for working with documents. By enabling seamless interaction with these AI tools, Aspose.Words simplifies complex tasks and enhances productivity for developers.
You can create a model instance using the Create method of the AiModel class.
The following code example shows how to create a new instance of AiModel class:
public static AiModel Create(AiModelType modelType)
With Aspose.Words, developers can also integrate self-hosted LLMs (Large Language Models), providing an alternative to OpenAI/Anthropic/Google’s hosted services.
The following code example shows how to create a self‑hosted LLM based on OpenAI’s generative language model:
public void SelfHostedModel()
{
Document doc = new Document(MyDir + "Big document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use OpenAI generative language models.
AiModel model = new CustomAiModel().WithApiKey(apiKey);
Document translatedDoc = model.Translate(doc, Language.Russian);
translatedDoc.Save(ArtifactsDir + "AI.SelfHostedModel.docx");
}
// Custom self-hosted AI model.
internal class CustomAiModel : OpenAiModel
{
protected override string Url
{
get { return "https://localhost/"; }
}
protected override string Name
{
get { return "my-model-24b"; }
}
}
Q: Which AI model providers are supported by Aspose.Words?
A: Aspose.Words supports models from OpenAI, Google (Gemini), and Anthropic’s Claude families. The supported models are exposed through the AiModelType enumeration, allowing you to select the desired provider and version.
Q: How do I create an instance of a specific AI model, such as GPT‑4o?
A: Use the static AiModel.Create method and pass the corresponding AiModelType value. For example:
AiModel gpt4o = AiModel.Create(AiModelType.OpenAi_Gpt4o);
The returned AiModel object can then be used for summarization, translation, or other AI‑driven operations.
Q: Can I integrate a self‑hosted LLM with Aspose.Words?
A: Yes. Derive a class from the appropriate provider base class (e.g., OpenAiModel) and override the Url and Name properties to point to your local endpoint. Instantiate your custom class and use it like any other AiModel.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.