JavaScript 에서 대규모 언어 모델(LLM)을 사용하여 DOCX 파일에서 핵심 정보를 프로그래밍 방식으로 추출합니다. Aspose.Words for Node.js via .NET 이 DOCX 문서를 읽고 원본 텍스트의 핵심 의미를 포착하는 간결한 요약을 생성합니다.
다음 예제는 JavaScript 에서 DOCX 문서를 요약하는 방법을 보여줍니다:
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.