隨著 Aspose.Words 25.11 的發布,開發者現在可以配置 custom AI model service endpoints。此增強功能在與 AI 驅動的功能(例如文字摘要、語法檢查或翻譯)整合時提供了更大的靈活性。 新屬性 Url 和 Timeout 允許開發人員定義自訂 API 端點並控制 AI 模型的請求逾時。
配置自訂 AI 端點
現在您可以將 AI 整合指向特定的服務端點,並定義請求在逾時之前應該等待多長時間。
以下程式碼範例展示如何實現:
// Use OpenAI generative language models as an example.
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
AiModel model = AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey);
// Specify the model URL. Default value "https://api.openai.com/".
model.Url = "https://my.a.com/";
// Specify the model timeout. Default value 100000ms.
model.Timeout = 250000;
// Specify the required options and use AI-powered features for text summarization, grammar checking, or translation.
...
為什麼配置 AI 模型服務很重要
此次更新賦予開發者以下功能:
- 與 custom AI models 集成
- 使用自訂逾時微調 request performance and reliability
- 維護 full control,控制 AI 資料的處理位置和方式。
透過允許靈活的端點配置,Aspose.Words 讓建立符合您的基礎架構和合規性要求的智慧型文件處理解決方案變得比以往任何時候都更加容易。
