ragas-examples 0.3.8__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/LICENSE +1 -1
- {ragas_examples-0.3.8/ragas_examples.egg-info → ragas_examples-0.4.0}/PKG-INFO +4 -4
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/pyproject.toml +3 -3
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/_version.py +3 -3
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/benchmark_llm/evals.py +1 -1
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/improve_rag/evals.py +2 -2
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/improve_rag/rag.py +3 -3
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/rag_eval/evals.py +12 -3
- ragas_examples-0.4.0/ragas_examples/rag_eval/pyproject.toml +26 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0/ragas_examples.egg-info}/PKG-INFO +4 -4
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples.egg-info/SOURCES.txt +1 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/README.md +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/gdrive_append_example.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/gdrive_backend_example.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/datasets/support_triage.csv +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/promptv1.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/promptv2_fewshot.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/iterate_prompt/run_prompt.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/oci_genai_example.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/agent_evals/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/agent_evals/agent.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/agent_evals/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/benchmark_llm/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/benchmark_llm/datasets/discount_benchmark.csv +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/benchmark_llm/prompt.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/improve_rag/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/improve_rag/datasets/hf_doc_qa_eval.csv +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/judge_alignment/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/judge_alignment/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/contexts/ambiguous_removal_request.json +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/contexts/duplicate_addition.json +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/contexts/repeated_removal.json +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/llamaindex_agent.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/prompt_evals/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/prompt_evals/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/prompt_evals/prompt.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/rag_eval/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/rag_eval/rag.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/analyze_errors.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/data_utils.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/datasets/booksql_sample.csv +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/db_utils.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/prompt.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/prompt_v2.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/prompt_v3.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/text2sql_agent.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/validate_sql_dataset.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/workflow_eval/__init__.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/workflow_eval/evals.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/workflow_eval/workflow.py +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples.egg-info/dependency_links.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples.egg-info/entry_points.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples.egg-info/requires.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples.egg-info/top_level.txt +0 -0
- {ragas_examples-0.3.8 → ragas_examples-0.4.0}/setup.cfg +0 -0
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright [2023] [
|
|
189
|
+
Copyright [2023] [Vibrant Labs]
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragas-examples
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Official examples for the ragas project
|
|
5
5
|
Author: Ragas Team
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/
|
|
7
|
+
Project-URL: Homepage, https://github.com/vibrantlabsai/ragas
|
|
8
8
|
Project-URL: Documentation, https://docs.ragas.io
|
|
9
|
-
Project-URL: Code, https://github.com/
|
|
10
|
-
Project-URL: Issues, https://github.com/
|
|
9
|
+
Project-URL: Code, https://github.com/vibrantlabsai/ragas
|
|
10
|
+
Project-URL: Issues, https://github.com/vibrantlabsai/ragas/issues
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -59,10 +59,10 @@ ragas-llamaindex-agent-evals = "ragas_examples.llamaIndex_agent_evals.evals:main
|
|
|
59
59
|
ragas-judge-alignment = "ragas_examples.judge_alignment.evals:main"
|
|
60
60
|
|
|
61
61
|
[project.urls]
|
|
62
|
-
Homepage = "https://github.com/
|
|
62
|
+
Homepage = "https://github.com/vibrantlabsai/ragas"
|
|
63
63
|
Documentation = "https://docs.ragas.io"
|
|
64
|
-
Code = "https://github.com/
|
|
65
|
-
Issues = "https://github.com/
|
|
64
|
+
Code = "https://github.com/vibrantlabsai/ragas"
|
|
65
|
+
Issues = "https://github.com/vibrantlabsai/ragas/issues"
|
|
66
66
|
|
|
67
67
|
[tool.setuptools]
|
|
68
68
|
package-dir = {"" = "."}
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.4.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 4, 0)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g877ed6cb2'
|
|
@@ -74,7 +74,7 @@ def load_dataset():
|
|
|
74
74
|
# Download dataset from GitHub if it doesn't exist locally
|
|
75
75
|
if not os.path.exists(dataset_path):
|
|
76
76
|
os.makedirs(os.path.dirname(dataset_path), exist_ok=True)
|
|
77
|
-
urllib.request.urlretrieve("https://raw.githubusercontent.com/
|
|
77
|
+
urllib.request.urlretrieve("https://raw.githubusercontent.com/vibrantlabsai/ragas/main/examples/ragas_examples/benchmark_llm/datasets/discount_benchmark.csv", dataset_path)
|
|
78
78
|
return Dataset.load(name="discount_benchmark", backend="local/csv", root_dir=current_dir)
|
|
79
79
|
|
|
80
80
|
|
|
@@ -45,7 +45,7 @@ def download_and_save_dataset() -> Path:
|
|
|
45
45
|
return dataset_path
|
|
46
46
|
|
|
47
47
|
logger.info("Downloading HuggingFace doc Q&A evaluation dataset from GitHub...")
|
|
48
|
-
github_url = "https://raw.githubusercontent.com/
|
|
48
|
+
github_url = "https://raw.githubusercontent.com/vibrantlabsai/ragas/main/examples/ragas_examples/improve_rag/datasets/hf_doc_qa_eval.csv"
|
|
49
49
|
|
|
50
50
|
import urllib.request
|
|
51
51
|
|
|
@@ -206,7 +206,7 @@ async def run_experiment(mode: str = "naive", model: str = "gpt-5-mini", name: O
|
|
|
206
206
|
dataset,
|
|
207
207
|
name=name or f"{datetime.now().strftime('%Y%m%d-%H%M%S')}_{'agenticrag' if mode == 'agentic' else 'naiverag'}",
|
|
208
208
|
rag=rag,
|
|
209
|
-
llm=llm_factory("gpt-5-mini", client=openai_client)
|
|
209
|
+
llm=llm_factory("gpt-5-mini", client=openai_client, temperature=1, top_p=None)
|
|
210
210
|
)
|
|
211
211
|
|
|
212
212
|
# Print basic results
|
|
@@ -12,8 +12,8 @@ import logging
|
|
|
12
12
|
from typing import Any, Dict, Optional
|
|
13
13
|
|
|
14
14
|
import mlflow
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from langchain_core.documents import Document
|
|
16
|
+
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
|
17
17
|
from langchain_community.retrievers import BM25Retriever as LangchainBM25Retriever
|
|
18
18
|
from openai import AsyncOpenAI
|
|
19
19
|
|
|
@@ -244,4 +244,4 @@ async def main():
|
|
|
244
244
|
|
|
245
245
|
if __name__ == "__main__":
|
|
246
246
|
import asyncio
|
|
247
|
-
asyncio.run(main())
|
|
247
|
+
asyncio.run(main())
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
2
4
|
|
|
3
5
|
from openai import OpenAI
|
|
4
6
|
|
|
@@ -6,10 +8,12 @@ from ragas import Dataset, experiment
|
|
|
6
8
|
from ragas.llms import llm_factory
|
|
7
9
|
from ragas.metrics import DiscreteMetric
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
# Add the current directory to the path so we can import rag module when run as a script
|
|
12
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
13
|
+
from rag import default_rag_client
|
|
10
14
|
|
|
11
15
|
openai_client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
|
12
|
-
rag_client = default_rag_client(llm_client=openai_client)
|
|
16
|
+
rag_client = default_rag_client(llm_client=openai_client, logdir="evals/logs")
|
|
13
17
|
llm = llm_factory("gpt-4o", client=openai_client)
|
|
14
18
|
|
|
15
19
|
|
|
@@ -17,7 +21,7 @@ def load_dataset():
|
|
|
17
21
|
dataset = Dataset(
|
|
18
22
|
name="test_dataset",
|
|
19
23
|
backend="local/csv",
|
|
20
|
-
root_dir="
|
|
24
|
+
root_dir="evals",
|
|
21
25
|
)
|
|
22
26
|
|
|
23
27
|
data_samples = [
|
|
@@ -77,6 +81,11 @@ async def main():
|
|
|
77
81
|
print("Experiment completed successfully!")
|
|
78
82
|
print("Experiment results:", experiment_results)
|
|
79
83
|
|
|
84
|
+
# Save experiment results to CSV
|
|
85
|
+
experiment_results.save()
|
|
86
|
+
csv_path = Path(".") / "experiments" / f"{experiment_results.name}.csv"
|
|
87
|
+
print(f"\nExperiment results saved to: {csv_path.resolve()}")
|
|
88
|
+
|
|
80
89
|
|
|
81
90
|
if __name__ == "__main__":
|
|
82
91
|
import asyncio
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rag-eval"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "RAG evaluation example using Ragas"
|
|
9
|
+
requires-python = ">=3.9"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"ragas[all]>=0.3.0",
|
|
12
|
+
"openai>=1.0.0",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
dev = [
|
|
17
|
+
"pytest>=7.0",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools]
|
|
21
|
+
py-modules = []
|
|
22
|
+
|
|
23
|
+
[tool.uv]
|
|
24
|
+
managed = true
|
|
25
|
+
# Note: When developing locally, use:
|
|
26
|
+
# uv sync --override ragas@path/to/ragas
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragas-examples
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Official examples for the ragas project
|
|
5
5
|
Author: Ragas Team
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/
|
|
7
|
+
Project-URL: Homepage, https://github.com/vibrantlabsai/ragas
|
|
8
8
|
Project-URL: Documentation, https://docs.ragas.io
|
|
9
|
-
Project-URL: Code, https://github.com/
|
|
10
|
-
Project-URL: Issues, https://github.com/
|
|
9
|
+
Project-URL: Code, https://github.com/vibrantlabsai/ragas
|
|
10
|
+
Project-URL: Issues, https://github.com/vibrantlabsai/ragas/issues
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -79,6 +79,7 @@ ragas_examples/prompt_evals/evals.py
|
|
|
79
79
|
ragas_examples/prompt_evals/prompt.py
|
|
80
80
|
ragas_examples/rag_eval/__init__.py
|
|
81
81
|
ragas_examples/rag_eval/evals.py
|
|
82
|
+
ragas_examples/rag_eval/pyproject.toml
|
|
82
83
|
ragas_examples/rag_eval/rag.py
|
|
83
84
|
ragas_examples/text2sql/__init__.py
|
|
84
85
|
ragas_examples/text2sql/analyze_errors.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/improve_rag/datasets/hf_doc_qa_eval.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/llamaIndex_agent_evals/evals.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/datasets/booksql_sample.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragas_examples-0.3.8 → ragas_examples-0.4.0}/ragas_examples/text2sql/validate_sql_dataset.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|