-
Notifications
You must be signed in to change notification settings - Fork 2
CMRNLP-75 Golden Dataset - Evaluate collection embedding search with golden dataset #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
16bb5d5
b711a68
5a31a35
af1ce24
5fd982e
45d7173
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,94 @@ | ||||||||||||||||||||||||||
| # RAG Evaluation | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Evaluate a RAG (Retrieval Augmented Generation) system with custom metrics | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Quick Start | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### 1. Set Your API Key | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Choose your LLM provider: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| # OpenAI (default) | ||||||||||||||||||||||||||
| export OPENAI_API_KEY="your-openai-key" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Or use Anthropic Claude | ||||||||||||||||||||||||||
| export ANTHROPIC_API_KEY="your-anthropic-key" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Or use Google Gemini | ||||||||||||||||||||||||||
| export GOOGLE_API_KEY="your-google-key" | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
Comment on lines
+7
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quick Start API key instructions are misleading — code uses AWS Bedrock, not OpenAI/Anthropic/Google. The actual implementation in 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### 2. Install Dependencies | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Using `uv` (recommended): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| uv sync | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Or using `pip`: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| pip install -e . | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### 3. Run the Evaluation | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Using `uv`: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| uv run python evals.py | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Or using `pip`: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| python evals.py | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Project Structure | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
| rag_eval/ | ||||||||||||||||||||||||||
| ├── README.md # This file | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These directory listings are nice but sort of hard to maintain. It looks like these are already out of date 😅 |
||||||||||||||||||||||||||
| ├── pyproject.toml # Project configuration | ||||||||||||||||||||||||||
| ├── rag.py # Your RAG application code | ||||||||||||||||||||||||||
| ├── evals.py # Evaluation workflow | ||||||||||||||||||||||||||
| ├── __init__.py # Makes this a Python package | ||||||||||||||||||||||||||
| └── evals/ # Evaluation-related data | ||||||||||||||||||||||||||
| ├── datasets/ # Test datasets | ||||||||||||||||||||||||||
| ├── experiments/ # Experiment results | ||||||||||||||||||||||||||
| └── logs/ # Evaluation logs and traces | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
Comment on lines
+52
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a language specifier to the fenced code block and correct the project structure. The code block at Line 52 is missing a language specifier (flagged by markdownlint MD040). Also, Suggested fix-```
+```text
rag_eval/
├── README.md # This file
├── pyproject.toml # Project configuration
-├── rag.py # Your RAG application code
+├── mcp_client.py # MCP client for RAG queries
+├── models.py # Pydantic models for evaluation
+├── ragas_utils.py # Ragas metrics utilities
├── evals.py # Evaluation workflow
├── __init__.py # Makes this a Python package
└── evals/ # Evaluation-related data
├── datasets/ # Test datasets
├── experiments/ # Experiment results
└── logs/ # Evaluation logs and traces
-```
+```📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.21.0)[warning] 52-52: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Customization | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Modify the LLM Provider | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| In `evals.py`, update the LLM configuration: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```python | ||||||||||||||||||||||||||
| from ragas.llms import llm_factory | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Use Anthropic Claude | ||||||||||||||||||||||||||
| llm = llm_factory("claude-3-5-sonnet-20241022", provider="anthropic") | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Use Google Gemini | ||||||||||||||||||||||||||
| llm = llm_factory("gemini-1.5-pro", provider="google") | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Use local Ollama | ||||||||||||||||||||||||||
| llm = llm_factory("mistral", provider="ollama", base_url="http://localhost:11434") | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Customize Test Cases | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Edit the `load_dataset()` function in `evals.py` to add or modify test cases. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Change Evaluation Metrics | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Update the `my_metric` definition in `evals.py` to use different grading criteria. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Documentation | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Visit https://docs.ragas.io for more information. | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||||||||||
| """RAG evaluation package for Earthdata MCP server.""" | ||||||||||||||
|
|
||||||||||||||
| __version__ = "1.0.0" | ||||||||||||||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Version mismatch: These should be consistent. Since this is a new package, Suggested fix-__version__ = "1.0.0"
+__version__ = "0.1.0"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evaluation-only dependencies added to the main project's runtime dependencies.
ragasandlitellmare only used by therag_eval/evaluation package, not by the MCP server itself. Adding them as top-level runtime dependencies unnecessarily increases the install footprint for all deployments (including production Lambda/container).Move these to an optional dependency group:
Suggested fix
"instructor>=1.13.0", "jsonschema>=4.17.3", - "ragas>=0.4.3", - "litellm>=1.81.12", ] [project.optional-dependencies] +eval = [ + "ragas>=0.4.3", + "litellm>=1.81.12", +] dev = [🤖 Prompt for AI Agents