Skip to content

Commit 90cb9bb

Browse files
authored
Merge pull request #152 from aspose-words/main
Aspose.Words for Python via .Net 25.7.0
2 parents 46ba1f2 + bdabeba commit 90cb9bb

File tree

92 files changed

+778
-375
lines changed

Some content is hidden

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

92 files changed

+778
-375
lines changed

english/python-net/aspose.words.ai/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This functionality extends the power of document automation, facilitating effici
2323

2424
| Class | Description |
2525
| --- | --- |
26-
| [AiModel](./aimodel/) | Represents information about a Generative Language Model. |
26+
| [AiModel](./aimodel/) | An abstract class representing the integration with various AI models within the Aspose.Words. |
2727
| [AnthropicAiModel](./anthropicaimodel/) | An abstract class representing the integration with Anthropic’s AI models within the Aspose.Words. |
2828
| [CheckGrammarOptions](./checkgrammaroptions/) | Allows to specify various options while checking grammar of a document using AI. |
2929
| [GoogleAiModel](./googleaimodel/) | An abstract class representing the integration with Google’s AI models within the Aspose.Words. |

english/python-net/aspose.words.ai/aimodel/_index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ title: AiModel class
33
linktitle: AiModel class
44
articleTitle: AiModel class
55
second_title: Aspose.Words for Python
6-
description: "aspose.words.ai.AiModel class. Represents information about a Generative Language Model."
6+
description: "aspose.words.ai.AiModel class. An abstract class representing the integration with various AI models within the Aspose.Words."
77
type: docs
88
weight: 10
99
url: /python-net/aspose.words.ai/aimodel/
1010
---
1111

1212
## AiModel class
1313

14-
Represents information about a Generative Language Model.
14+
An abstract class representing the integration with various AI models within the Aspose.Words.
1515

1616

1717
### Methods
@@ -21,7 +21,11 @@ Represents information about a Generative Language Model.
2121
|[ as_anthropic_ai_model()](./as_anthropic_ai_model/#default) | Cast AiModel to [AnthropicAiModel](../anthropicaimodel/). |
2222
|[ as_google_ai_model()](./as_google_ai_model/#default) | Cast AiModel to [GoogleAiModel](../googleaimodel/). |
2323
|[ as_open_ai_model()](./as_open_ai_model/#default) | Cast AiModel to [OpenAiModel](../openaimodel/). |
24+
|[ check_grammar(source_document, options)](./check_grammar/#document_checkgrammaroptions) | Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document. |
2425
|[ create(model_type)](./create/#aimodeltype) | Creates a new instance of [AiModel](./) class. |
26+
|[ summarize(source_document, options)](./summarize/#document_summarizeoptions) | Generates a summary of the specified document, with options to adjust the length of the summary. This operation leverages the connected AI model for content processing. |
27+
|[ summarize(source_documents, options)](./summarize/#documentlist_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. |
28+
|[ translate(source_document, target_language)](./translate/#document_language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
2529
|[ with_api_key(api_key)](./with_api_key/#str) | Sets a specified API key to the model. |
2630

2731
### Examples
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: AiModel.check_grammar method
3+
linktitle: check_grammar method
4+
articleTitle: check_grammar method
5+
second_title: Aspose.Words for Python
6+
description: "AiModel.check_grammar method. Checks grammar of the provided document"
7+
type: docs
8+
weight: 40
9+
url: /python-net/aspose.words.ai/aimodel/check_grammar/
10+
---
11+
12+
## check_grammar(source_document, options) {#document_checkgrammaroptions}
13+
14+
Checks grammar of the provided document.
15+
This operation leverages the connected AI model for checking grammar of document.
16+
17+
18+
```python
19+
def check_grammar(self, source_document: aspose.words.Document, options: aspose.words.ai.CheckGrammarOptions):
20+
...
21+
```
22+
23+
| Parameter | Type | Description |
24+
| --- | --- | --- |
25+
| source_document | [Document](../../../aspose.words/document/) | The document being checked for grammar. |
26+
| options | [CheckGrammarOptions](../../checkgrammaroptions/) | Optional settings to control how grammar will be checked. |
27+
28+
### Returns
29+
30+
A new [Document](../../../aspose.words/document/) with checked grammar.
31+
32+
33+
### Examples
34+
35+
Shows how to check the grammar of a document.
36+
37+
```python
38+
doc = aw.Document(file_name=MY_DIR + 'Big document.docx')
39+
api_key = system_helper.environment.Environment.get_environment_variable('API_KEY')
40+
# Use OpenAI generative language models.
41+
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key)
42+
grammar_options = aw.ai.CheckGrammarOptions()
43+
grammar_options.improve_stylistics = True
44+
proofed_doc = model.check_grammar(doc, grammar_options)
45+
proofed_doc.save(file_name=ARTIFACTS_DIR + 'AI.AiGrammar.docx')
46+
```
47+
48+
### See Also
49+
50+
* module [aspose.words.ai](../../)
51+
* class [AiModel](../)
52+

english/python-net/aspose.words.ai/aimodel/create/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ articleTitle: create method
55
second_title: Aspose.Words for Python
66
description: "AiModel.create method. Creates a new instance of [AiModel](../) class."
77
type: docs
8-
weight: 40
8+
weight: 50
99
url: /python-net/aspose.words.ai/aimodel/create/
1010
---
1111

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: AiModel.summarize method
3+
linktitle: summarize method
4+
articleTitle: summarize method
5+
second_title: Aspose.Words for Python
6+
description: "aspose.words.ai.AiModel.summarize method"
7+
type: docs
8+
weight: 60
9+
url: /python-net/aspose.words.ai/aimodel/summarize/
10+
---
11+
12+
## summarize(source_document, options) {#document_summarizeoptions}
13+
14+
Generates a summary of the specified document, with options to adjust the length of the summary.
15+
This operation leverages the connected AI model for content processing.
16+
17+
18+
```python
19+
def summarize(self, source_document: aspose.words.Document, options: aspose.words.ai.SummarizeOptions):
20+
...
21+
```
22+
23+
| Parameter | Type | Description |
24+
| --- | --- | --- |
25+
| source_document | [Document](../../../aspose.words/document/) | The document to be summarized. |
26+
| options | [SummarizeOptions](../../summarizeoptions/) | Optional settings to control the summary length and other parameters. |
27+
28+
### Returns
29+
30+
A summarized version of the document's content.
31+
32+
33+
## summarize(source_documents, options) {#documentlist_summarizeoptions}
34+
35+
Generates summaries for an array of documents, with options to control the summary length and other settings.
36+
This method utilizes the connected AI model for processing each document in the array.
37+
38+
39+
```python
40+
def summarize(self, source_documents: List[aspose.words.Document], options: aspose.words.ai.SummarizeOptions):
41+
...
42+
```
43+
44+
| Parameter | Type | Description |
45+
| --- | --- | --- |
46+
| source_documents | List[[Document](../../../aspose.words/document/)] | An array of documents to be summarized. |
47+
| options | [SummarizeOptions](../../summarizeoptions/) | Optional settings to control the summary length and other parameters |
48+
49+
### Returns
50+
51+
A summarized version of the document's content.
52+
53+
54+
## Examples
55+
56+
Shows how to summarize text using OpenAI and Google models.
57+
58+
```python
59+
first_doc = aw.Document(file_name=MY_DIR + 'Big document.docx')
60+
second_doc = aw.Document(file_name=MY_DIR + 'Document.docx')
61+
api_key = system_helper.environment.Environment.get_environment_variable('API_KEY')
62+
# Use OpenAI or Google generative language models.
63+
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model().with_organization('Organization').with_project('Project')
64+
options = aw.ai.SummarizeOptions()
65+
options.summary_length = aw.ai.SummaryLength.SHORT
66+
one_document_summary = model.summarize(source_document=first_doc, options=options)
67+
one_document_summary.save(file_name=ARTIFACTS_DIR + 'AI.AiSummarize.One.docx')
68+
options.summary_length = aw.ai.SummaryLength.LONG
69+
multi_document_summary = model.summarize(source_documents=[first_doc, second_doc], options=options)
70+
multi_document_summary.save(file_name=ARTIFACTS_DIR + 'AI.AiSummarize.Multi.docx')
71+
```
72+
73+
## See Also
74+
75+
* module [aspose.words.ai](../../)
76+
* class [AiModel](../)
77+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: AiModel.translate method
3+
linktitle: translate method
4+
articleTitle: translate method
5+
second_title: Aspose.Words for Python
6+
description: "AiModel.translate method. Translates the provided document into the specified target language"
7+
type: docs
8+
weight: 70
9+
url: /python-net/aspose.words.ai/aimodel/translate/
10+
---
11+
12+
## translate(source_document, target_language) {#document_language}
13+
14+
Translates the provided document into the specified target language.
15+
This operation leverages the connected AI model for content translating.
16+
17+
18+
```python
19+
def translate(self, source_document: aspose.words.Document, target_language: aspose.words.ai.Language):
20+
...
21+
```
22+
23+
| Parameter | Type | Description |
24+
| --- | --- | --- |
25+
| source_document | [Document](../../../aspose.words/document/) | The document to be translated. |
26+
| target_language | [Language](../../language/) | The language into which the document will be translated. |
27+
28+
### Returns
29+
30+
A new [Document](../../../aspose.words/document/) object containing the translated document.
31+
32+
33+
### See Also
34+
35+
* module [aspose.words.ai](../../)
36+
* class [AiModel](../)
37+

english/python-net/aspose.words.ai/aimodel/with_api_key/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ articleTitle: with_api_key method
55
second_title: Aspose.Words for Python
66
description: "AiModel.with_api_key method. Sets a specified API key to the model."
77
type: docs
8-
weight: 50
8+
weight: 80
99
url: /python-net/aspose.words.ai/aimodel/with_api_key/
1010
---
1111

english/python-net/aspose.words.ai/anthropicaimodel/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ An abstract class representing the integration with Anthropic’s AI models with
2222

2323
| Name | Description |
2424
| --- | --- |
25-
|[ check_grammar(source_document, options)](../iaimodeltext/check_grammar/#document_checkgrammaroptions) | Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.<br>(Inherited from [IAiModelText](../iaimodeltext/)) |
25+
|[ check_grammar(source_document, options)](../aimodel/check_grammar/#document_checkgrammaroptions) | Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.<br>(Inherited from [AiModel](../aimodel/)) |
2626
|[ create(model_type)](../aimodel/create/#aimodeltype) | Creates a new instance of [AiModel](../aimodel/) class.<br>(Inherited from [AiModel](../aimodel/)) |
27-
|[ summarize(source_document, options)](../iaimodeltext/summarize/#document_summarizeoptions) | Generates a summary of the specified document, with options to adjust the length of the summary. This operation leverages the connected AI model for content processing.<br>(Inherited from [IAiModelText](../iaimodeltext/)) |
28-
|[ summarize(source_documents, options)](../iaimodeltext/summarize/#documentlist_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.<br>(Inherited from [IAiModelText](../iaimodeltext/)) |
29-
|[ translate(source_document, target_language)](../iaimodeltext/translate/#document_language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.<br>(Inherited from [IAiModelText](../iaimodeltext/)) |
27+
|[ summarize(source_document, options)](./summarize/#document_summarizeoptions) | Generates a summary of the specified document, with options to adjust the length of the summary. This operation leverages the connected AI model for content processing. |
28+
|[ summarize(source_documents, options)](./summarize/#documentlist_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. |
29+
|[ translate(source_document, target_language)](./translate/#document_language) | Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating. |
3030
|[ with_api_key(api_key)](../aimodel/with_api_key/#str) | Sets a specified API key to the model.<br>(Inherited from [AiModel](../aimodel/)) |
3131

3232
### See Also
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: AnthropicAiModel.summarize method
3+
linktitle: summarize method
4+
articleTitle: summarize method
5+
second_title: Aspose.Words for Python
6+
description: "aspose.words.ai.AnthropicAiModel.summarize method"
7+
type: docs
8+
weight: 10
9+
url: /python-net/aspose.words.ai/anthropicaimodel/summarize/
10+
---
11+
12+
## summarize(source_document, options) {#document_summarizeoptions}
13+
14+
Generates a summary of the specified document, with options to adjust the length of the summary.
15+
This operation leverages the connected AI model for content processing.
16+
17+
18+
```python
19+
def summarize(self, source_document: aspose.words.Document, options: aspose.words.ai.SummarizeOptions):
20+
...
21+
```
22+
23+
| Parameter | Type | Description |
24+
| --- | --- | --- |
25+
| source_document | [Document](../../../aspose.words/document/) | The document to be summarized. |
26+
| options | [SummarizeOptions](../../summarizeoptions/) | Optional settings to control the summary length and other parameters. |
27+
28+
### Returns
29+
30+
A summarized version of the document's content.
31+
32+
33+
## summarize(source_documents, options) {#documentlist_summarizeoptions}
34+
35+
Generates summaries for an array of documents, with options to control the summary length and other settings.
36+
This method utilizes the connected AI model for processing each document in the array.
37+
38+
39+
```python
40+
def summarize(self, source_documents: List[aspose.words.Document], options: aspose.words.ai.SummarizeOptions):
41+
...
42+
```
43+
44+
| Parameter | Type | Description |
45+
| --- | --- | --- |
46+
| source_documents | List[[Document](../../../aspose.words/document/)] | An array of documents to be summarized. |
47+
| options | [SummarizeOptions](../../summarizeoptions/) | Optional settings to control the summary length and other parameters |
48+
49+
### Returns
50+
51+
A summarized version of the document's content.
52+
53+
54+
## See Also
55+
56+
* module [aspose.words.ai](../../)
57+
* class [AnthropicAiModel](../)
58+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: AnthropicAiModel.translate method
3+
linktitle: translate method
4+
articleTitle: translate method
5+
second_title: Aspose.Words for Python
6+
description: "AnthropicAiModel.translate method. Translates the provided document into the specified target language"
7+
type: docs
8+
weight: 20
9+
url: /python-net/aspose.words.ai/anthropicaimodel/translate/
10+
---
11+
12+
## translate(source_document, target_language) {#document_language}
13+
14+
Translates the provided document into the specified target language.
15+
This operation leverages the connected AI model for content translating.
16+
17+
18+
```python
19+
def translate(self, source_document: aspose.words.Document, target_language: aspose.words.ai.Language):
20+
...
21+
```
22+
23+
| Parameter | Type | Description |
24+
| --- | --- | --- |
25+
| source_document | [Document](../../../aspose.words/document/) | The document to be translated. |
26+
| target_language | [Language](../../language/) | The language into which the document will be translated. |
27+
28+
### Returns
29+
30+
A new [Document](../../../aspose.words/document/) object containing the translated document.
31+
32+
33+
### See Also
34+
35+
* module [aspose.words.ai](../../)
36+
* class [AnthropicAiModel](../)
37+

0 commit comments

Comments
 (0)