AiModelType enumeration
AiModelType enumeration
Represents the types of AiModel that can be integrated into the document processing workflow.
This enumeration is used to define which large language model (LLM) should be utilized for tasks such as summarization, translation, and content generation.
Members
Name | Description |
---|---|
GPT_4O | GPT-4o generative model type. |
GPT_4O_MINI | GPT-4o mini generative model type. |
GPT_4_TURBO | GPT-4 Turbo generative model type. |
GPT_35_TURBO | GPT-3.5 Turbo generative model type. |
GEMINI_15_FLASH | Gemini 1.5 Flash generative model type. |
GEMINI_15_FLASH_8B | Gemini 1.5 Flash-8B generative model type. |
GEMINI_15_PRO | Gemini 1.5 Pro generative model type. |
Examples
Shows how to summarize text using OpenAI and Google models.
first_doc = aw.Document(MyDir + "Big document.docx")
second_doc = aw.Document(MyDir + "Document.docx")
api_key = os.getenv("API_KEY")
# Use OpenAI or Google generative language models.
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model()
options = aw.ai.SummarizeOptions()
options.summary_length = aw.ai.SummaryLength.SHORT
one_document_summary = model.summarize(first_doc, options)
oneDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.One.docx")
options.summary_length = aw.ai.SummaryLength.LONG
multi_document_summary = model.summarize([first_doc, second_doc], options)
multiDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.Multi.docx")
See Also
- module aspose.words.ai