JavaScript में लार्ज लैंग्वेज मॉडल (LLM) का उपयोग करके PDF फ़ाइलों से प्रोग्रामेटिक रूप से मुख्य जानकारी निकालें। Aspose.Words for Node.js via .NET आपके PDF दस्तावेज़ को पढ़ता है और एक संक्षिप्त सारांश तैयार करता है जो मूल पाठ के मूल अर्थ को व्यक्त करता है।
निम्नलिखित उदाहरण दर्शाता है कि PDF में 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.pdf");
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.pdf");
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.