Skip to content

docs: fix modifying-prompts-metrics guide with correct API - #2486

Merged
anistark merged 10 commits into
vibrantlabsai:mainfrom
sanjeed5:fix/modifying-prompts-metrics-guide
Dec 14, 2025
Merged

docs: fix modifying-prompts-metrics guide with correct API#2486
anistark merged 10 commits into
vibrantlabsai:mainfrom
sanjeed5:fix/modifying-prompts-metrics-guide

Conversation

@sanjeed5

@sanjeed5 sanjeed5 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Issue Link / Problem Description

The modifying-prompts-metrics guide had significant factual errors that would cause code examples to fail:

  • Used non-existent class names (FaithfulnessInput, FaithfulnessPrompt, etc.)
  • Referenced wrong attribute names (scorer.prompt instead of scorer.statement_generator_prompt)
  • Documented save/load functionality that doesn't exist on the collections BasePrompt class

Changes Made

  • Fixed incorrect class names: FaithfulnessInputStatementGeneratorInput, FaithfulnessOutputStatementGeneratorOutput, etc.
  • Fixed wrong attribute names: scorer.promptscorer.statement_generator_prompt / scorer.nli_statement_prompt
  • Removed non-existent save/load section: ~175 lines documenting functionality that doesn't exist on ragas.prompt.metrics.base_prompt.BasePrompt
  • Added cross-references: Quick start pointing to DiscreteMetric/NumericMetric for simpler custom metrics
  • Converted to pure markdown: Deleted .ipynb source, created clean .md file
  • Fixed mkdocstrings link: Changed [BasePrompt][ragas.prompt.metrics.base_prompt.BasePrompt] to [BasePrompt][ragas.prompt.BasePrompt] (public API)
  • Added docs rule: Added API references guidance to .cursor/rules/docs-structure.mdc

Testing

How to Test

  • Automated tests added/updated
  • Manual testing steps:
    1. Run uv run python tests/docs/test_modifying_prompts_metrics.py - all 7 tests pass
    2. Run make serve-docs and verify the guide renders correctly
    3. Verify all code examples in the guide work

Test Results

✓ Faithfulness has statement_generator_prompt and nli_statement_prompt
✓ Generated prompt string successfully
✓ Custom FactualCorrectness prompt evaluation completed. Score: 1.0
✓ Custom Faithfulness NLI prompt evaluation completed. Score: 1.0
✓ NLI prompt string generated successfully
✓ Faithfulness evaluation completed. Score: 1.0
✓ Language adaptation completed. Score: 1.0

✓ All tests passed!

References

- Fix incorrect class names (FaithfulnessInput → StatementGeneratorInput, etc.)
- Fix wrong attribute names (scorer.prompt → scorer.statement_generator_prompt)
- Remove non-existent save/load section (feature doesn't exist on new BasePrompt)
- Add cross-references to DiscreteMetric/NumericMetric for simpler use cases
- Convert from notebook to pure markdown
- Add comprehensive test coverage for all code examples
- Add mkdocstrings API reference rule to docs-structure.mdc
@sanjeed5
sanjeed5 requested a review from anistark December 9, 2025 13:04
@sanjeed5
sanjeed5 force-pushed the fix/modifying-prompts-metrics-guide branch from ba6384f to 050e3fc Compare December 9, 2025 13:32

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move it to e2e tests directory and import from there in docs if needed?

sanjeed5 and others added 4 commits December 12, 2025 20:49
* test: add claude docs auto-update workflow

Testing the new workflow that automatically updates documentation when code changes.

* fix: add id-token permission and fix max_turns parameter
@sanjeed5

Copy link
Copy Markdown
Contributor Author

@anistark removed the test for now as discussed

Resolve mkdocs.yml conflict: keep new modifying-prompts-metrics.md path,
adopt main's _metrics_language_adaptation.md and train_your_own_metric.md entries.
@anistark
anistark merged commit 84c038d into vibrantlabsai:main Dec 14, 2025
5 checks passed
cgaswin pushed a commit to cgaswin/ragas that referenced this pull request Dec 17, 2025
…bsai#2486)

## Issue Link / Problem Description

The modifying-prompts-metrics guide had significant factual errors that
would cause code examples to fail:
- Used non-existent class names (`FaithfulnessInput`,
`FaithfulnessPrompt`, etc.)
- Referenced wrong attribute names (`scorer.prompt` instead of
`scorer.statement_generator_prompt`)
- Documented save/load functionality that doesn't exist on the
collections `BasePrompt` class

## Changes Made

- **Fixed incorrect class names**: `FaithfulnessInput` →
`StatementGeneratorInput`, `FaithfulnessOutput` →
`StatementGeneratorOutput`, etc.
- **Fixed wrong attribute names**: `scorer.prompt` →
`scorer.statement_generator_prompt` / `scorer.nli_statement_prompt`
- **Removed non-existent save/load section**: ~175 lines documenting
functionality that doesn't exist on
`ragas.prompt.metrics.base_prompt.BasePrompt`
- **Added cross-references**: Quick start pointing to
`DiscreteMetric`/`NumericMetric` for simpler custom metrics
- **Converted to pure markdown**: Deleted `.ipynb` source, created clean
`.md` file
- **Fixed mkdocstrings link**: Changed
`[BasePrompt][ragas.prompt.metrics.base_prompt.BasePrompt]` to
`[BasePrompt][ragas.prompt.BasePrompt]` (public API)
- **Added docs rule**: Added API references guidance to
`.cursor/rules/docs-structure.mdc`

## Testing

### How to Test
- [x] Automated tests added/updated
- [x] Manual testing steps:
1. Run `uv run python tests/docs/test_modifying_prompts_metrics.py` -
all 7 tests pass
  2. Run `make serve-docs` and verify the guide renders correctly
  3. Verify all code examples in the guide work

### Test Results
```
✓ Faithfulness has statement_generator_prompt and nli_statement_prompt
✓ Generated prompt string successfully
✓ Custom FactualCorrectness prompt evaluation completed. Score: 1.0
✓ Custom Faithfulness NLI prompt evaluation completed. Score: 1.0
✓ NLI prompt string generated successfully
✓ Faithfulness evaluation completed. Score: 1.0
✓ Language adaptation completed. Score: 1.0

✓ All tests passed!
```

## References

- Related to PR vibrantlabsai#2394 (documentation structure update)
- Related to PR vibrantlabsai#2407 (metrics collections API documentation)
- Fixes errors introduced in commits `691ad9f` and `e62ff19`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants