Skip to content

Commit c420775

Browse files
Update API Reference for Aspose.Words for C++ with autoported api examples
1 parent 4e0cc5c commit c420775

File tree

3,906 files changed

+52496
-95494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,906 files changed

+52496
-95494
lines changed

english/cpp/aspose.words.ai/aimodel/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,31 @@ class AiModel : public virtual System::Object
2525
| [Is](./is/)(const System::TypeInfo\&) const override | |
2626
| static [Type](./type/)() | |
2727
| [WithApiKey](./withapikey/)(const System::String\&) | Sets a specified API key to the model. |
28+
29+
## Examples
30+
31+
32+
33+
Shows how to summarize text using OpenAI and [Google](../../aspose.words.ai.google/) models.
34+
```cpp
35+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
36+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
37+
38+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
39+
// Use OpenAI or Google generative language models.
40+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
41+
42+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
43+
44+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
45+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
46+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
47+
48+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
49+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
50+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
51+
```
52+
2853
## See Also
2954

3055
* Namespace [Aspose::Words::AI](../)

english/cpp/aspose.words.ai/aimodel/create/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ Creates a new instance of [AiModel](../) class.
1616
static System::SharedPtr<Aspose::Words::AI::AiModel> Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType modelType)
1717
```
1818
19+
20+
## Examples
21+
22+
23+
24+
Shows how to summarize text using OpenAI and [Google](../../../aspose.words.ai.google/) models.
25+
```cpp
26+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
27+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
28+
29+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
30+
// Use OpenAI or Google generative language models.
31+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
32+
33+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
34+
35+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
36+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
37+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
38+
39+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
40+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
41+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
42+
```
43+
1944
## See Also
2045

2146
* Class [AiModel](../)

english/cpp/aspose.words.ai/aimodel/withapikey/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ Sets a specified API key to the model.
1616
System::SharedPtr<Aspose::Words::AI::AiModel> Aspose::Words::AI::AiModel::WithApiKey(const System::String &apiKey)
1717
```
1818
19+
20+
## Examples
21+
22+
23+
24+
Shows how to summarize text using OpenAI and [Google](../../../aspose.words.ai.google/) models.
25+
```cpp
26+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
27+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
28+
29+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
30+
// Use OpenAI or Google generative language models.
31+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
32+
33+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
34+
35+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
36+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
37+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
38+
39+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
40+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
41+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
42+
```
43+
1944
## See Also
2045

2146
* Class [AiModel](../)

english/cpp/aspose.words.ai/aimodeltype/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,31 @@ enum class AiModelType
3333
| Claude3Sonnet | 10 | Claude 3 Sonnet generative model type. |
3434
| Claude3Haiku | 11 | Claude 3 Haiku generative model type. |
3535
36+
37+
## Examples
38+
39+
40+
41+
Shows how to summarize text using OpenAI and [Google](../../aspose.words.ai.google/) models.
42+
```cpp
43+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
44+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
45+
46+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
47+
// Use OpenAI or Google generative language models.
48+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
49+
50+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
51+
52+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
53+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
54+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
55+
56+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
57+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
58+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
59+
```
60+
3661
## See Also
3762

3863
* Namespace [Aspose::Words::AI](../)

english/cpp/aspose.words.ai/checkgrammaroptions/_index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ class CheckGrammarOptions : public System::Object
3030
| [set_MakeRevisions](./set_makerevisions/)(bool) | Allows to specify either final or revised document to be returned with proofed text. Default value is **false**. |
3131
| [set_PreserveFormatting](./set_preserveformatting/)(bool) | Allows to specify either [CheckGrammar()](../iaimodeltext/checkgrammar/) will try to preserve layout and formatting of the original document, or not. Default value is **true**. |
3232
| static [Type](./type/)() | |
33+
34+
## Examples
35+
36+
37+
38+
Shows how to check the grammar of a document.
39+
```cpp
40+
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
41+
42+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
43+
// Use OpenAI generative language models.
44+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey));
45+
46+
auto grammarOptions = System::MakeObject<Aspose::Words::AI::CheckGrammarOptions>();
47+
grammarOptions->set_ImproveStylistics(true);
48+
49+
System::SharedPtr<Aspose::Words::Document> proofedDoc = model->CheckGrammar(doc, grammarOptions);
50+
proofedDoc->Save(get_ArtifactsDir() + u"AI.AiGrammar.docx");
51+
```
52+
3353
## See Also
3454

3555
* Namespace [Aspose::Words::AI](../)

english/cpp/aspose.words.ai/googleaimodel/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,31 @@ class GoogleAiModel : public Aspose::Words::AI::AiModel,
2626
| [Is](./is/)(const System::TypeInfo\&) const override | |
2727
| static [Type](./type/)() | |
2828
| [WithApiKey](../aimodel/withapikey/)(const System::String\&) | Sets a specified API key to the model. |
29+
30+
## Examples
31+
32+
33+
34+
Shows how to summarize text using OpenAI and [Google](../../aspose.words.ai.google/) models.
35+
```cpp
36+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
37+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
38+
39+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
40+
// Use OpenAI or Google generative language models.
41+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
42+
43+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
44+
45+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
46+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
47+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
48+
49+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
50+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
51+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
52+
```
53+
2954
## See Also
3055

3156
* Class [AiModel](../aimodel/)

english/cpp/aspose.words.ai/iaimodeltext/_index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,31 @@ class IAiModelText : public virtual System::Object
2727
| virtual [Summarize](./summarize/)(System::ArrayPtr\<System::SharedPtr\<Aspose::Words::Document\>\>, System::SharedPtr\<Aspose::Words::AI::SummarizeOptions\>) | Generates summaries for an array of documents, with options to control the summary length and other settings. This method utilizes the connected [AI](../) model for processing each document in the array. |
2828
| virtual [Translate](./translate/)(System::SharedPtr\<Aspose::Words::Document\>, Aspose::Words::AI::Language) | Translates the provided document into the specified target language. This operation leverages the connected [AI](../) model for content translating. |
2929
| static [Type](./type/)() | |
30+
31+
## Examples
32+
33+
34+
35+
Shows how to summarize text using OpenAI and [Google](../../aspose.words.ai.google/) models.
36+
```cpp
37+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
38+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
39+
40+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
41+
// Use OpenAI or Google generative language models.
42+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
43+
44+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
45+
46+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
47+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
48+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
49+
50+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
51+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
52+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
53+
```
54+
3055
## See Also
3156

3257
* Namespace [Aspose::Words::AI](../)

english/cpp/aspose.words.ai/iaimodeltext/checkgrammar/_index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ virtual System::SharedPtr<Aspose::Words::Document> Aspose::Words::AI::IAiModelTe
2626
2727
A new [Document](../../../aspose.words/document/) with checked grammar.
2828
29+
## Examples
30+
31+
32+
33+
Shows how to check the grammar of a document.
34+
```cpp
35+
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
36+
37+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
38+
// Use OpenAI generative language models.
39+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey));
40+
41+
auto grammarOptions = System::MakeObject<Aspose::Words::AI::CheckGrammarOptions>();
42+
grammarOptions->set_ImproveStylistics(true);
43+
44+
System::SharedPtr<Aspose::Words::Document> proofedDoc = model->CheckGrammar(doc, grammarOptions);
45+
proofedDoc->Save(get_ArtifactsDir() + u"AI.AiGrammar.docx");
46+
```
47+
2948
## See Also
3049

3150
* Class [Document](../../../aspose.words/document/)

english/cpp/aspose.words.ai/iaimodeltext/summarize/_index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ virtual System::SharedPtr<Aspose::Words::Document> Aspose::Words::AI::IAiModelTe
2626
2727
A summarized version of the document's content.
2828
29+
## Examples
30+
31+
32+
33+
Shows how to summarize text using OpenAI and [Google](../../../aspose.words.ai.google/) models.
34+
```cpp
35+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
36+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
37+
38+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
39+
// Use OpenAI or Google generative language models.
40+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
41+
42+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
43+
44+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
45+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
46+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
47+
48+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
49+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
50+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
51+
```
52+
2953
## See Also
3054

3155
* Class [Document](../../../aspose.words/document/)
@@ -52,6 +76,30 @@ virtual System::SharedPtr<Aspose::Words::Document> Aspose::Words::AI::IAiModelTe
5276
5377
A summarized version of the document's content.
5478
79+
## Examples
80+
81+
82+
83+
Shows how to summarize text using OpenAI and [Google](../../../aspose.words.ai.google/) models.
84+
```cpp
85+
auto firstDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");
86+
auto secondDoc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
87+
88+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
89+
// Use OpenAI or Google generative language models.
90+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = (System::ExplicitCast<Aspose::Words::AI::OpenAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey)))->WithOrganization(u"Organization")->WithProject(u"Project");
91+
92+
auto options = System::MakeObject<Aspose::Words::AI::SummarizeOptions>();
93+
94+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Short);
95+
System::SharedPtr<Aspose::Words::Document> oneDocumentSummary = model->Summarize(firstDoc, options);
96+
oneDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.One.docx");
97+
98+
options->set_SummaryLength(Aspose::Words::AI::SummaryLength::Long);
99+
System::SharedPtr<Aspose::Words::Document> multiDocumentSummary = model->Summarize(System::MakeArray<System::SharedPtr<Aspose::Words::Document>>({firstDoc, secondDoc}), options);
100+
multiDocumentSummary->Save(get_ArtifactsDir() + u"AI.AiSummarize.Multi.docx");
101+
```
102+
55103
## See Also
56104

57105
* Class [Document](../../../aspose.words/document/)

english/cpp/aspose.words.ai/iaimodeltext/translate/_index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ virtual System::SharedPtr<Aspose::Words::Document> Aspose::Words::AI::IAiModelTe
2626
2727
A new [Document](../../../aspose.words/document/) object containing the translated document.
2828
29+
## Examples
30+
31+
32+
33+
Shows how to translate text using [Google](../../../aspose.words.ai.google/) models.
34+
```cpp
35+
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Document.docx");
36+
37+
System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
38+
// Use Google generative language models.
39+
System::SharedPtr<Aspose::Words::AI::IAiModelText> model = System::ExplicitCast<Aspose::Words::AI::GoogleAiModel>(Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gemini15Flash)->WithApiKey(apiKey));
40+
41+
System::SharedPtr<Aspose::Words::Document> translatedDoc = model->Translate(doc, (Aspose::Words::AI::Language)Aspose::Language::Arabic);
42+
translatedDoc->Save(get_ArtifactsDir() + u"AI.AiTranslate.docx");
43+
```
44+
2945
## See Also
3046

3147
* Class [Document](../../../aspose.words/document/)

0 commit comments

Comments
 (0)