@tpmjs/tools-faq-from-text
Extract Q&A pairs from text that looks like FAQ format. Detects question patterns (?, "Q:", "Question:", numbered questions, etc.) and pairs them with their answers. Returns an array of FAQ objects with question and answer fields.
Test @tpmjs/tools-faq-from-text (faqFromTextTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-faq-from-textpnpm add @tpmjs/tools-faq-from-textyarn add @tpmjs/tools-faq-from-textbun add @tpmjs/tools-faq-from-textdeno add npm:@tpmjs/tools-faq-from-textimport { faqFromTextTool } from '@tpmjs/tools-faq-from-text';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { faqFromTextTool } from '@tpmjs/tools-faq-from-text';
const result = await generateText({
model: openai('gpt-4o'),
tools: { faqFromTextTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
textstringText containing FAQ-style content with questions and answers
Schema extracted: 1/1/2026, 8:18:12 AM
Extract Q&A pairs from text that looks like FAQ format. Detects question patterns and pairs them with their answers.
npm install @tpmjs/tools-faq-from-text ai
import { faqFromTextTool } from '@tpmjs/tools-faq-from-text'; const result = await faqFromTextTool.execute({ text: ` Q: What is TPMJS? A: TPMJS is a package manager for AI tools. Q: How do I install it? A: Run npm install @tpmjs/core Question: Is it free? Answer: Yes, it's open source and free to use. `, }); console.log(result); // { // faqs: [ // { question: "What is TPMJS?", answer: "TPMJS is a package manager for AI tools." }, // { question: "How do I install it?", answer: "Run npm install @tpmjs/core" }, // { question: "Is it free?", answer: "Yes, it's open source and free to use." } // ], // count: 3 // }
?Q: or Question: prefixes1., 1), etc.)Q:, A:, numbers)text (string, required) - Text containing FAQ-style content with questions and answers{ faqs: Array<{ question: string; answer: string; }>; count: number; }
The tool recognizes various FAQ formats:
Q: What is this?
A: This is an answer.
Question: Another question?
Answer: Another answer.
1. Numbered question?
The answer follows.
What about bare questions?
They work too!
MIT
Downloads/month
0
Quality Score