[LLM] Create LLM feature documentation#433
Merged
Merged
Conversation
…r-llm-features Add LLM feedback endpoints, deterministic LLM mocking, and integration tests
|
@Johnpii1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Description
Add LLMFeedback ORM model to persist feature, prompt, output, rating, expert flag/weight and timestamps (api/models/orm.py).
Add LLM feedback request/response schemas and dashboard/prompt-improvement models (api/schemas.py) and validate inputs (LLMFeedbackIn / LLMFeedbackOut).
Expose feedback APIs on the LLM router: POST /api/v1/llm/feedback, GET /api/v1/llm/feedback/dashboard, and GET /api/v1/llm/feedback/prompt-improvements with aggregation/weighted metrics (api/routers/llm.py).
Add deterministic LLM mocking helpers with latency, token/cost accounting and injectable failures for chaos testing (api/tests/llm_mocking.py).
Add golden regression cases and an integration test suite that enforces p95 latency gate, mock-cost gates, chaos behavior and feedback/dashboard flows (api/tests/llm_golden/ask_cases.json, api/tests/test_llm_integration_quality.py).
Document public LLM endpoints, usage examples, testing guidance and troubleshooting in docs/llm/features.md.
Testing
Successfully compiled the modified modules with python -m py_compile api/routers/llm.py api/routers/feedback.py api/models/orm.py api/schemas.py api/tests/test_llm_integration_quality.py api/tests/llm_mocking.py and no syntax errors were reported.
Ran pytest ... invocation for the LLM integration tests but it was blocked by missing dependency fastapi (test collection failed with ModuleNotFoundError: No module named 'fastapi'), so the full pytest suite could not be executed in the current environment.
Unit-level sanity checks (file compilation) passed; the new integration tests and endpoints are present and ready to run in CI or a dev environment with required dependencies installed.
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Fixes # (issue)
close #403
Type of change
Checklist: