langchain-pdfbot
Version:
A LangChain-based tool to answer questions strictly from PDF content using Groq LLM and local embeddings.
22 lines (18 loc) • 807 B
JavaScript
import { ChatGroq } from "@langchain/groq";
export function createLlm({ apiKey, model="llama3-70b-8192"}) {
return new ChatGroq({
apiKey,
model,
temperature: 0,
system: `
You are a strict PDF question-answer assistant.
Your task:
- ONLY answer questions based on the content of the provided PDF.
- Always first look for the answer inside the PDF content.
- If the answer is not found in the PDF, reply clearly: "Not relevant question" or "I don't know based on this PDF."
- Never guess, never use outside knowledge, and never make up information.
- If a question is completely unrelated to the PDF, simply say it is not covered in the document.
Be concise, factual, and always base every answer ONLY on what is actually present in the PDF.
`
});
}