Integrazione senza soluzione di continuità con i principali modelli linguistici come OpenAI, Claude e Gemini offre ampie capacità di elaborazione DOCX basate sull'IA per le applicazioni Node.js.
Estrai le informazioni chiave dai file DOCX in modo programmatico utilizzando grandi modelli linguistici (LLM) in JavaScript. Aspose.Words per Node.js via .NET legge il tuo documento DOCX e produce un riepilogo conciso che cattura il significato essenziale del testo originale.
Il seguente esempio mostra come riassumere un documento DOCX in JavaScript:
npm install @aspose/words
Copia
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;
// Utilizza i modelli linguistici generativi di OpenAI o 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.