民间科学家 發表於 2025-12-2 10:33:00

如何在Aspose.Words for .NET中配置AI模型服务端点?

<p style="text-align: center"><img src="https://image.evget.com/attachment/keditor/image/20251202/092409_6.png"></p>
<p><strong>Aspose.Words 25.11</strong>版本发布后,开发者现在可以配置<strong>自定义 AI 模型服务端点</strong>。这项增强功能在集成 AI 功能(例如文本摘要、语法检查或翻译)时提供了更大的灵活性。新增的Url和Timeout属性允许开发者定义自定义 API 端点并控制 AI 模型的请求超时时间。</p>
<p style="text-align: center"><span style="color: rgba(230, 126, 35, 1)"><strong>Aspose.Words官方试用版免费下载,请联系Aspose官方授权代理商慧都科技</strong></span></p>
<p style="text-align: center"><span style="color: rgba(230, 126, 35, 1)"><strong><em>加入Aspose技术交流QQ群(1041253375),与更多小伙伴一起探讨提升开发技能。</em></strong></span></p>
<h3>配置自定义 AI 端点</h3>
<p>现在您可以将 AI 集成指向特定的服务端点,并定义请求超时前应等待多长时间。</p>
<p>以下代码示例展示了如何实现:</p>
<pre class="prettyprint highlighter-hljs"><code>// 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.
...</code></pre>
<h3>为什么配置 AI 模型服务至关重要</h3>
<p>此次更新赋予开发者以下功能:</p>
<ul>
<li><strong>与自定义人工智能模型</strong>集成</li>
<li>通过自定义超时来微调<strong>请求性能和可靠性</strong></li>
<li><strong>完全掌控</strong>人工智能数据的处理地点和方式</li>
</ul>
<p><strong>Aspose.Words&nbsp;</strong>允许灵活的端点配置,使构建符合您的基础架构和合规性要求的智能文档处理解决方案变得比以往任何时候都更加容易。</p>
<p style="text-align: center"><span style="color: rgba(230, 126, 35, 1)"><strong>Aspose.Words官方试用版免费下载,请联系Aspose官方授权代理商慧都科技</strong></span></p>
<p style="text-align: center"><span style="color: rgba(230, 126, 35, 1)"><strong><em>加入Aspose技术交流QQ群(1041253375),与更多小伙伴一起探讨提升开发技能。</em></strong></span></p><br><br>
来源:https://www.cnblogs.com/software-Development/p/19296289
頁: [1]
查看完整版本: 如何在Aspose.Words for .NET中配置AI模型服务端点?