Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Michael c514791528
chore(deps): update all example dependencies to latest versions (#4900)
1 month ago
..
09fbd07470
docs: Full rag example (#1228)
1 year ago
360d7b519d
docs(examples): add uniform init commands to all example READMEs (#4068)
3 months ago
bfa8a39a8a
docs(examples): add OpenAI Agents SDK example (#4006)
3 months ago
665242dda8
chore(examples): add yaml schema and descriptions to config files (#2358)
8 months ago
76797692e5
feat(schema): add yaml schema validation to config files (#1990)
10 months ago
c514791528
chore(deps): update all example dependencies to latest versions (#4900)
1 month ago
fc4a6bbc7d
docs(examples): update model references from gpt-4o-mini to gpt-4.1-mini (#4289)
2 months ago

README.md

You have to be logged in to leave a comment. Sign In

rag-full (Rag Full)

You can run this example with:

npx promptfoo@latest init --example rag-full

This RAG example allows you to ask questions over a number of public company SEC filings. It uses LangChain, but the flow is representative of any RAG solution.

There are 3 parts:

  1. ingest.py: Chunks and loads PDFs into a vector database (PDFs are pulled from a public Google Cloud bucket)

  2. retrieve.py: Promptfoo-compatible provider that answers RAG questions using the database.

  3. promptfooconfig.yaml: Test inputs and requirements.

To get started:

  1. Set the OPENAI_API_KEY environment variable.

  2. Create a python virtual environment: python3 -m venv venv

  3. Enter the environment: source venv/bin/activate

  4. Install python dependencies: pip install -r requirements.txt

  5. Run ingest.py to create the vector database: python ingest.py

Now we're ready to go.

  • Edit promptfooconfig.yaml to your liking to configure the questions you'd like to ask in your tests. Then run:
  • Edit retrieve.py to control how context is loaded and questions are answered.
promptfoo eval

Afterwards, you can view the results by running promptfoo view

See promptfooconfig.with-asserts.yaml for a more complete example that compares the performance of two RAG configurations.

Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...