以程式設計方式從文字和文件中提取關鍵資訊。使用 JavaScript 中的大型語言模型 (LLM) 產生簡潔、資訊豐富的摘要,以捕捉文本的含義。軟體文本摘要的應用範圍廣泛且多元。文字摘要可用於提供有關當前事件的最新資訊。透過將文字摘要功能整合到您的軟體中,您不僅可以提高工作效率,還可以透過盡快存取重要數據來改善決策。.
Aspose.Words 和大型語言模型之間的交互作用建構在 REST 架構之上。此方法可在您的 Node.js via .NET 應用程式和各種 AI 服務之間提供可靠且安全的通訊。要設定驗證,您需要指定您的私鑰 API 和提供您所需模型的 AI 服務的 endpoint(OpenAiModel, GoogleAiModel, AnthropicAiModel)。有關受支援的 LLM 類型的完整列表,請參閱 API Reference。.
立即體驗 JavaScript 智慧文字處理的未來!!
npm install @aspose/words
複製
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;
// 使用 OpenAI 或 Google 生成式語言模型。
const model = aw.AI.AiModel.createGpt4OMini();
model.setApiKey(apiKey);
const options = new aw.AI.SummarizeOptions();
options.summaryLength = aw.AI.SummaryLength.Short;
const summary = model.summarize(doc, options);
summary.save("Output.docx");
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
const model = new CustomAiModel("my-model-24b", "https://your-server.com/v1");
model.setApiKey("");
const options = new aw.AI.SummarizeOptions();
options.summaryLength = aw.AI.SummaryLength.Short;
const summary = model.summarize(doc, options);
summary.save("Output.docx");
class CustomAiModel extends aw.AI.OpenAiModel {
constructor(name, url) {
super(name);
this._url = url;
}
get url() {
return this._url;
}
}
We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.
This package is compatible with Node.js 14.17.0 or higher.