Built in
π° PDF
Get Started
Components
- EmbedJs Components
- ποΈ Data sources
- ποΈ Vector databases
- π€ Large language models
- 𧩠Embedding models
- β‘ Stores
Integrations
Product
Built in
π° PDF
You can load any pdf file from your local file system or through a URL.
Install PDF addon
npm install @llm-tools/embedjs-loader-pdf
Usage
Load from a local file
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';
import { PdfLoader } from '@llm-tools/embedjs-loader-pdf';
const app = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();
app.addLoader(new PdfLoader({ filePathOrUrl: '/path/to/file.pdf' }))
Load from URL
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';
import { PdfLoader } from '@llm-tools/embedjs-loader-pdf';
const app = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();
await app.addLoader(new PdfLoader({ filePathOrUrl: 'https://arxiv.org/pdf/1706.03762.pdf' }))
await app.query("What is the paper 'attention is all you need' about?");
Note that we do not support password protected pdf files.