Seamless integration with major language models such as OpenAI, Claude, and Gemini provides extensive AI-based document processing capabilities for C++ applications.
Extract key information from texts and documents programmatically. Generate concise, informative summaries that capture the meaning of text using large language models (LLM) in C++. The applications of software text summarization are vast and varied. Text summarization can be used to provide up-to-date information on current events. By integrating text summarization function into your software, you will not only increase productivity, but also improve decision making by accessing important data as quickly as possible.
The interaction between Aspose.Words and Large Language Models is built on a REST architecture. This approach provides reliable and secure communication between your C++ application and various AI services. To set up authentication, you will need to specify your private API key and the `endpoint` of the AI service that provides the models you need (OpenAiModel, GoogleAiModel, AnthropicAiModel). For a full list of supported LLM types, see the API Reference.
Experience the future of intelligent text processing in C++ today!
dotnet add package Aspose.Words.Cpp
Copy
auto doc = System::MakeObject<Aspose::Words::Document>(u"Document.docx");
auto apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
// Use OpenAI or Google generative language models.
const auto modelType = Aspose::Words::AI::AiModelType::Gpt4OMini;
auto model = System::ExplicitCast<Aspose::Words::AI::IAiModelText>(Aspose::Words::AI::AiModel::Create(modelType)->WithApiKey(apiKey));
auto summarizeOptions = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
summarizeOptions->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
auto summary = model->Summarize(doc, summarizeOptions);
summary->Save(u"Output.docx");
auto doc = System::MakeObject<Aspose::Words::Document>(u"Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
auto model = System::MakeObject<CustomAiModel>(u"my-model-24b", u"https://your-server.com/v1");
model->WithApiKey(u"");
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
auto summary = model->Summarize(doc, options);
summary->Save(u"Output.docx");
class CustomAiModel : public Aspose::Words::AI::OpenAiModel
{
private:
System::String mUrl;
public:
CustomAiModel(System::String name, System::String url) : OpenAiModel(name) { mUrl = url; }
System::String get_Url() override { return mUrl; }
};
There are three options to install Aspose.Words for C++ to your developer environment. Please choose one that resembles your needs and follow the step-by-step instructions:
You can use this C++ library to develop software on Microsoft Windows, Linux and macOS operating systems:
If you develop software for Linux or macOS, please check information on additional library dependencies (fontconfig and mesa-glu open-source packages) in Product Documentation.