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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {
|
| 6 |
+
"vscode": {
|
| 7 |
+
"languageId": "plaintext"
|
| 8 |
+
}
|
| 9 |
+
},
|
| 10 |
+
"source": [
|
| 11 |
+
"# Create a golden dataset using RAGAS"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "code",
|
| 16 |
+
"execution_count": 127,
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"outputs": [],
|
| 19 |
+
"source": [
|
| 20 |
+
"import os\n",
|
| 21 |
+
"import getpass\n",
|
| 22 |
+
"from dotenv import load_dotenv\n",
|
| 23 |
+
"import getpass\n"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"cell_type": "code",
|
| 28 |
+
"execution_count": 128,
|
| 29 |
+
"metadata": {},
|
| 30 |
+
"outputs": [],
|
| 31 |
+
"source": [
|
| 32 |
+
"\n",
|
| 33 |
+
"load_dotenv()\n",
|
| 34 |
+
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
|
| 35 |
+
"\n",
|
| 36 |
+
"def set_api_key_if_not_present(key_name, prompt_message):\n",
|
| 37 |
+
" if key_name not in os.environ or not os.environ[key_name]:\n",
|
| 38 |
+
" os.environ[key_name] = getpass.getpass(prompt_message)\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"set_api_key_if_not_present(\"OPENAI_API_KEY\", \"OpenAI API Key:\")\n",
|
| 41 |
+
"set_api_key_if_not_present(\"TAVILY_API_KEY\", \"TAVILY_API_KEY:\")\n",
|
| 42 |
+
"set_api_key_if_not_present(\"LANGCHAIN_API_KEY\", \"LANGCHAIN_API_KEY:\")"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"cell_type": "markdown",
|
| 47 |
+
"metadata": {},
|
| 48 |
+
"source": [
|
| 49 |
+
"## Data loading"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"cell_type": "markdown",
|
| 54 |
+
"metadata": {},
|
| 55 |
+
"source": [
|
| 56 |
+
"First, we're going to load all of our transcripts in."
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"cell_type": "code",
|
| 61 |
+
"execution_count": 145,
|
| 62 |
+
"metadata": {},
|
| 63 |
+
"outputs": [
|
| 64 |
+
{
|
| 65 |
+
"name": "stdout",
|
| 66 |
+
"output_type": "stream",
|
| 67 |
+
"text": [
|
| 68 |
+
"pstuts_transcripts_test_dev\n"
|
| 69 |
+
]
|
| 70 |
+
}
|
| 71 |
+
],
|
| 72 |
+
"source": [
|
| 73 |
+
"from ast import Dict\n",
|
| 74 |
+
"import json\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"from pstuts_rag.loader import load_json_files\n",
|
| 77 |
+
"filenames = [\"../data/test.json\",\"../data/dev.json\", \"../data/train.json\"]\n",
|
| 78 |
+
"filenames = [\"../data/test.json\",\"../data/dev.json\"]\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"from typing import List, Dict, Any\n",
|
| 81 |
+
"data:List[Dict[str,Any]] = await load_json_files(filenames)\n",
|
| 82 |
+
"\n",
|
| 83 |
+
"from pathlib import Path\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"data_name = \"pstuts_transcripts_\"+\"_\".join(Path(path).stem for path in filenames )\n",
|
| 86 |
+
" \n",
|
| 87 |
+
"print(data_name)\n",
|
| 88 |
+
"\n"
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"cell_type": "markdown",
|
| 93 |
+
"metadata": {},
|
| 94 |
+
"source": [
|
| 95 |
+
"The following are all data keys. `group` indicates the filename the transcript was loaded from.\n"
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"cell_type": "code",
|
| 100 |
+
"execution_count": 146,
|
| 101 |
+
"metadata": {},
|
| 102 |
+
"outputs": [
|
| 103 |
+
{
|
| 104 |
+
"name": "stdout",
|
| 105 |
+
"output_type": "stream",
|
| 106 |
+
"text": [
|
| 107 |
+
"Number of files: 22\n",
|
| 108 |
+
"File data fields: dict_keys(['video_id', 'title', 'desc', 'length', 'url', 'transcripts', 'qa', 'group'])\n"
|
| 109 |
+
]
|
| 110 |
+
}
|
| 111 |
+
],
|
| 112 |
+
"source": [
|
| 113 |
+
"print(f\"Number of files: {len(data)}\")\n",
|
| 114 |
+
"print(f\"File data fields: {data[0].keys()}\" )\n"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"cell_type": "markdown",
|
| 119 |
+
"metadata": {},
|
| 120 |
+
"source": [
|
| 121 |
+
"In each file, `transcripts` field is a list of transcript chunks"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "code",
|
| 126 |
+
"execution_count": 147,
|
| 127 |
+
"metadata": {},
|
| 128 |
+
"outputs": [
|
| 129 |
+
{
|
| 130 |
+
"name": "stdout",
|
| 131 |
+
"output_type": "stream",
|
| 132 |
+
"text": [
|
| 133 |
+
"Transcripts in first file: 58\n",
|
| 134 |
+
"Transcript keys: dict_keys(['sent_id', 'sent', 'begin', 'end'])\n"
|
| 135 |
+
]
|
| 136 |
+
}
|
| 137 |
+
],
|
| 138 |
+
"source": [
|
| 139 |
+
"print(f\"Transcripts in first file: {len(data[0][\"transcripts\"])}\")\n",
|
| 140 |
+
"print(f\"Transcript keys: {data[0][\"transcripts\"][0].keys()}\" )"
|
| 141 |
+
]
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"cell_type": "markdown",
|
| 145 |
+
"metadata": {},
|
| 146 |
+
"source": [
|
| 147 |
+
"Now, we will load the documents from transcripts.\n",
|
| 148 |
+
"\n",
|
| 149 |
+
"In this case, we are going to use the loader that loads 1 document per video.\n",
|
| 150 |
+
"(As opposed to the `VideoTranscriptChunkLoader` that loads 1 doc per chunk)"
|
| 151 |
+
]
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"cell_type": "code",
|
| 155 |
+
"execution_count": 148,
|
| 156 |
+
"metadata": {},
|
| 157 |
+
"outputs": [
|
| 158 |
+
{
|
| 159 |
+
"name": "stdout",
|
| 160 |
+
"output_type": "stream",
|
| 161 |
+
"text": [
|
| 162 |
+
"# of documents: 22. # of videos: 22\n"
|
| 163 |
+
]
|
| 164 |
+
}
|
| 165 |
+
],
|
| 166 |
+
"source": [
|
| 167 |
+
"from pstuts_rag.loader import VideoTranscriptBulkLoader\n",
|
| 168 |
+
"\n",
|
| 169 |
+
"\n",
|
| 170 |
+
"loader = VideoTranscriptBulkLoader(json_payload=data)\n",
|
| 171 |
+
"docs = loader.load()\n",
|
| 172 |
+
"\n",
|
| 173 |
+
"print(f\"# of documents: {len(docs)}. # of videos: {len(data)}\")"
|
| 174 |
+
]
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"cell_type": "markdown",
|
| 178 |
+
"metadata": {},
|
| 179 |
+
"source": [
|
| 180 |
+
"## Building the knowledge graph"
|
| 181 |
+
]
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"cell_type": "code",
|
| 185 |
+
"execution_count": 149,
|
| 186 |
+
"metadata": {},
|
| 187 |
+
"outputs": [],
|
| 188 |
+
"source": [
|
| 189 |
+
"from ragas.llms import LangchainLLMWrapper\n",
|
| 190 |
+
"from ragas.embeddings import LangchainEmbeddingsWrapper\n",
|
| 191 |
+
"from langchain_openai import ChatOpenAI\n",
|
| 192 |
+
"from langchain_openai import OpenAIEmbeddings\n",
|
| 193 |
+
"from ragas.testset.graph import KnowledgeGraph\n",
|
| 194 |
+
"from ragas.testset.graph import Node, NodeType\n",
|
| 195 |
+
"from ragas.testset.transforms import default_transforms, apply_transforms\n"
|
| 196 |
+
]
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"cell_type": "code",
|
| 200 |
+
"execution_count": 150,
|
| 201 |
+
"metadata": {},
|
| 202 |
+
"outputs": [],
|
| 203 |
+
"source": [
|
| 204 |
+
"generator_llm = LangchainLLMWrapper(ChatOpenAI(model=\"gpt-4.1-mini\"))\n",
|
| 205 |
+
"generator_embeddings = LangchainEmbeddingsWrapper(OpenAIEmbeddings())\n",
|
| 206 |
+
"\n",
|
| 207 |
+
"transformer_llm = generator_llm\n",
|
| 208 |
+
"embedding_model = generator_embeddings\n"
|
| 209 |
+
]
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"cell_type": "code",
|
| 213 |
+
"execution_count": 151,
|
| 214 |
+
"metadata": {},
|
| 215 |
+
"outputs": [],
|
| 216 |
+
"source": [
|
| 217 |
+
"root = Path(\"../data\")\n",
|
| 218 |
+
"kg_filename = Path(f\"kg_{data_name}.json\")\n",
|
| 219 |
+
"kg_path = root.joinpath(kg_filename)"
|
| 220 |
+
]
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"cell_type": "code",
|
| 224 |
+
"execution_count": 152,
|
| 225 |
+
"metadata": {},
|
| 226 |
+
"outputs": [
|
| 227 |
+
{
|
| 228 |
+
"name": "stdout",
|
| 229 |
+
"output_type": "stream",
|
| 230 |
+
"text": [
|
| 231 |
+
"../data/kg_pstuts_transcripts_test_dev.json does not contain a knowledge graph. Generating.\n",
|
| 232 |
+
"Initial size KnowledgeGraph(nodes: 22, relationships: 0)\n"
|
| 233 |
+
]
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"data": {
|
| 237 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 238 |
+
"model_id": "a3a03e8639fb4148add8bd1997bb7e71",
|
| 239 |
+
"version_major": 2,
|
| 240 |
+
"version_minor": 0
|
| 241 |
+
},
|
| 242 |
+
"text/plain": [
|
| 243 |
+
"Applying HeadlinesExtractor: 0%| | 0/21 [00:00<?, ?it/s]"
|
| 244 |
+
]
|
| 245 |
+
},
|
| 246 |
+
"metadata": {},
|
| 247 |
+
"output_type": "display_data"
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"data": {
|
| 251 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 252 |
+
"model_id": "cd4c56f29d35411f9d8980bb2d1eda2d",
|
| 253 |
+
"version_major": 2,
|
| 254 |
+
"version_minor": 0
|
| 255 |
+
},
|
| 256 |
+
"text/plain": [
|
| 257 |
+
"Applying HeadlineSplitter: 0%| | 0/22 [00:00<?, ?it/s]"
|
| 258 |
+
]
|
| 259 |
+
},
|
| 260 |
+
"metadata": {},
|
| 261 |
+
"output_type": "display_data"
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"name": "stderr",
|
| 265 |
+
"output_type": "stream",
|
| 266 |
+
"text": [
|
| 267 |
+
"unable to apply transformation: 'headlines' property not found in this node\n"
|
| 268 |
+
]
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"data": {
|
| 272 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 273 |
+
"model_id": "30b9923358a7484ba10ebc29c4416f9c",
|
| 274 |
+
"version_major": 2,
|
| 275 |
+
"version_minor": 0
|
| 276 |
+
},
|
| 277 |
+
"text/plain": [
|
| 278 |
+
"Applying SummaryExtractor: 0%| | 0/37 [00:00<?, ?it/s]"
|
| 279 |
+
]
|
| 280 |
+
},
|
| 281 |
+
"metadata": {},
|
| 282 |
+
"output_type": "display_data"
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"name": "stderr",
|
| 286 |
+
"output_type": "stream",
|
| 287 |
+
"text": [
|
| 288 |
+
"Property 'summary' already exists in node '9c97f4'. Skipping!\n",
|
| 289 |
+
"Property 'summary' already exists in node '8a8e28'. Skipping!\n",
|
| 290 |
+
"Property 'summary' already exists in node 'dcd67c'. Skipping!\n",
|
| 291 |
+
"Property 'summary' already exists in node '876b13'. Skipping!\n",
|
| 292 |
+
"Property 'summary' already exists in node '8898c4'. Skipping!\n",
|
| 293 |
+
"Property 'summary' already exists in node '3f46e3'. Skipping!\n",
|
| 294 |
+
"Property 'summary' already exists in node '118e6c'. Skipping!\n",
|
| 295 |
+
"Property 'summary' already exists in node '9c28dd'. Skipping!\n",
|
| 296 |
+
"Property 'summary' already exists in node 'd9cbc0'. Skipping!\n",
|
| 297 |
+
"Property 'summary' already exists in node 'a0f2e0'. Skipping!\n",
|
| 298 |
+
"Property 'summary' already exists in node '8679a1'. Skipping!\n",
|
| 299 |
+
"Property 'summary' already exists in node '5403e1'. Skipping!\n",
|
| 300 |
+
"Property 'summary' already exists in node 'a71e28'. Skipping!\n",
|
| 301 |
+
"Property 'summary' already exists in node '767485'. Skipping!\n",
|
| 302 |
+
"Property 'summary' already exists in node '2b676d'. Skipping!\n",
|
| 303 |
+
"Property 'summary' already exists in node '4dd9a1'. Skipping!\n"
|
| 304 |
+
]
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"data": {
|
| 308 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 309 |
+
"model_id": "cff631ccbbb9417ea47c879f39573e5a",
|
| 310 |
+
"version_major": 2,
|
| 311 |
+
"version_minor": 0
|
| 312 |
+
},
|
| 313 |
+
"text/plain": [
|
| 314 |
+
"Applying CustomNodeFilter: 0%| | 0/12 [00:00<?, ?it/s]"
|
| 315 |
+
]
|
| 316 |
+
},
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"output_type": "display_data"
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"data": {
|
| 322 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 323 |
+
"model_id": "8c8dbe1d10054d8ea12c52eefc3ca12e",
|
| 324 |
+
"version_major": 2,
|
| 325 |
+
"version_minor": 0
|
| 326 |
+
},
|
| 327 |
+
"text/plain": [
|
| 328 |
+
"Applying [EmbeddingExtractor, ThemesExtractor, NERExtractor]: 0%| | 0/57 [00:00<?, ?it/s]"
|
| 329 |
+
]
|
| 330 |
+
},
|
| 331 |
+
"metadata": {},
|
| 332 |
+
"output_type": "display_data"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"name": "stderr",
|
| 336 |
+
"output_type": "stream",
|
| 337 |
+
"text": [
|
| 338 |
+
"Property 'summary_embedding' already exists in node '9c97f4'. Skipping!\n",
|
| 339 |
+
"Property 'summary_embedding' already exists in node 'dcd67c'. Skipping!\n",
|
| 340 |
+
"Property 'summary_embedding' already exists in node '876b13'. Skipping!\n",
|
| 341 |
+
"Property 'summary_embedding' already exists in node 'a0f2e0'. Skipping!\n",
|
| 342 |
+
"Property 'summary_embedding' already exists in node 'd9cbc0'. Skipping!\n",
|
| 343 |
+
"Property 'summary_embedding' already exists in node '118e6c'. Skipping!\n",
|
| 344 |
+
"Property 'summary_embedding' already exists in node '8898c4'. Skipping!\n",
|
| 345 |
+
"Property 'summary_embedding' already exists in node '8679a1'. Skipping!\n",
|
| 346 |
+
"Property 'summary_embedding' already exists in node '8a8e28'. Skipping!\n",
|
| 347 |
+
"Property 'summary_embedding' already exists in node '3f46e3'. Skipping!\n",
|
| 348 |
+
"Property 'summary_embedding' already exists in node '9c28dd'. Skipping!\n",
|
| 349 |
+
"Property 'summary_embedding' already exists in node '5403e1'. Skipping!\n",
|
| 350 |
+
"Property 'summary_embedding' already exists in node 'a71e28'. Skipping!\n",
|
| 351 |
+
"Property 'summary_embedding' already exists in node '767485'. Skipping!\n",
|
| 352 |
+
"Property 'summary_embedding' already exists in node '2b676d'. Skipping!\n",
|
| 353 |
+
"Property 'summary_embedding' already exists in node '4dd9a1'. Skipping!\n"
|
| 354 |
+
]
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"data": {
|
| 358 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 359 |
+
"model_id": "f97f574c4fb047d99e37531c6a97c4c5",
|
| 360 |
+
"version_major": 2,
|
| 361 |
+
"version_minor": 0
|
| 362 |
+
},
|
| 363 |
+
"text/plain": [
|
| 364 |
+
"Applying [CosineSimilarityBuilder, OverlapScoreBuilder]: 0%| | 0/2 [00:00<?, ?it/s]"
|
| 365 |
+
]
|
| 366 |
+
},
|
| 367 |
+
"metadata": {},
|
| 368 |
+
"output_type": "display_data"
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"name": "stdout",
|
| 372 |
+
"output_type": "stream",
|
| 373 |
+
"text": [
|
| 374 |
+
"After transformations size KnowledgeGraph(nodes: 48, relationships: 695)\n",
|
| 375 |
+
"Saved to ../data/kg_pstuts_transcripts_test_dev.json.\n"
|
| 376 |
+
]
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"data": {
|
| 380 |
+
"text/plain": [
|
| 381 |
+
"KnowledgeGraph(nodes: 48, relationships: 695)"
|
| 382 |
+
]
|
| 383 |
+
},
|
| 384 |
+
"execution_count": 152,
|
| 385 |
+
"metadata": {},
|
| 386 |
+
"output_type": "execute_result"
|
| 387 |
+
}
|
| 388 |
+
],
|
| 389 |
+
"source": [
|
| 390 |
+
"kg = KnowledgeGraph()\n",
|
| 391 |
+
"\n",
|
| 392 |
+
"try:\n",
|
| 393 |
+
" kg = kg.load(kg_path)\n",
|
| 394 |
+
" print(f\"Loaded from {kg_path}.\")\n",
|
| 395 |
+
"except:\n",
|
| 396 |
+
" print(f\"{kg_path} does not contain a knowledge graph. Generating.\")\n",
|
| 397 |
+
" for doc in docs:\n",
|
| 398 |
+
" kg.nodes.append(\n",
|
| 399 |
+
" Node(\n",
|
| 400 |
+
" type=NodeType.DOCUMENT,\n",
|
| 401 |
+
" properties={\"page_content\": doc.page_content, \n",
|
| 402 |
+
" \"document_metadata\": doc.metadata}\n",
|
| 403 |
+
" )\n",
|
| 404 |
+
" )\n",
|
| 405 |
+
" print(f\"Initial size {str(kg)}\")\n",
|
| 406 |
+
" default_transforms = default_transforms(documents=docs, \n",
|
| 407 |
+
" llm=transformer_llm, \n",
|
| 408 |
+
" embedding_model=embedding_model)\n",
|
| 409 |
+
" apply_transforms(kg, default_transforms)\n",
|
| 410 |
+
" print(f\"After transformations size {str(kg)}\")\n",
|
| 411 |
+
" kg.save(kg_path)\n",
|
| 412 |
+
" print(f\"Saved to {kg_path}.\")\n",
|
| 413 |
+
" \n",
|
| 414 |
+
"kg"
|
| 415 |
+
]
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"cell_type": "markdown",
|
| 419 |
+
"metadata": {},
|
| 420 |
+
"source": [
|
| 421 |
+
"## Test set generator"
|
| 422 |
+
]
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"cell_type": "code",
|
| 426 |
+
"execution_count": 153,
|
| 427 |
+
"metadata": {},
|
| 428 |
+
"outputs": [],
|
| 429 |
+
"source": [
|
| 430 |
+
"from ragas.testset import TestsetGenerator\n",
|
| 431 |
+
"\n",
|
| 432 |
+
"personas = [\n",
|
| 433 |
+
" Persona(\n",
|
| 434 |
+
" name=\"Beginner Photoshop User\",\n",
|
| 435 |
+
" role_description=(\"Beginner Photoshop user, learning to complete \"\n",
|
| 436 |
+
" \"simple tasks, use the tools in Photoshop \"\n",
|
| 437 |
+
" \"and navigate the graphical user interface\"),\n",
|
| 438 |
+
"),\n",
|
| 439 |
+
" Persona(\n",
|
| 440 |
+
" name=\"Photoshop trainer\",\n",
|
| 441 |
+
" role_description=(\"Experienced trainer in Photoshop. Looking to develop\"\n",
|
| 442 |
+
" \"step-by-step guides for Photoshop beginners\"),\n",
|
| 443 |
+
")\n",
|
| 444 |
+
"]\n",
|
| 445 |
+
"\n",
|
| 446 |
+
"generator = TestsetGenerator(llm=generator_llm, \n",
|
| 447 |
+
" embedding_model=embedding_model, \n",
|
| 448 |
+
" persona_list=personas,\n",
|
| 449 |
+
" knowledge_graph=kg)"
|
| 450 |
+
]
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"cell_type": "code",
|
| 454 |
+
"execution_count": 154,
|
| 455 |
+
"metadata": {},
|
| 456 |
+
"outputs": [],
|
| 457 |
+
"source": [
|
| 458 |
+
"from ragas.testset.synthesizers import default_query_distribution, SingleHopSpecificQuerySynthesizer, MultiHopAbstractQuerySynthesizer, MultiHopSpecificQuerySynthesizer\n",
|
| 459 |
+
"from ragas.testset.persona import Persona\n",
|
| 460 |
+
"query_distribution = [\n",
|
| 461 |
+
" (SingleHopSpecificQuerySynthesizer(llm=generator_llm), 0.8),\n",
|
| 462 |
+
" (MultiHopAbstractQuerySynthesizer(llm=generator_llm), 0.1),\n",
|
| 463 |
+
" (MultiHopSpecificQuerySynthesizer(llm=generator_llm), 0.1),\n",
|
| 464 |
+
"]\n"
|
| 465 |
+
]
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"cell_type": "markdown",
|
| 469 |
+
"metadata": {},
|
| 470 |
+
"source": []
|
| 471 |
+
},
|
| 472 |
+
{
|
| 473 |
+
"cell_type": "code",
|
| 474 |
+
"execution_count": 159,
|
| 475 |
+
"metadata": {},
|
| 476 |
+
"outputs": [
|
| 477 |
+
{
|
| 478 |
+
"data": {
|
| 479 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 480 |
+
"model_id": "655a6981a810458bb5f84e8df4d4da77",
|
| 481 |
+
"version_major": 2,
|
| 482 |
+
"version_minor": 0
|
| 483 |
+
},
|
| 484 |
+
"text/plain": [
|
| 485 |
+
"Generating Scenarios: 0%| | 0/3 [00:00<?, ?it/s]"
|
| 486 |
+
]
|
| 487 |
+
},
|
| 488 |
+
"metadata": {},
|
| 489 |
+
"output_type": "display_data"
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"data": {
|
| 493 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 494 |
+
"model_id": "a7007c4af6b641da889e286e03d51415",
|
| 495 |
+
"version_major": 2,
|
| 496 |
+
"version_minor": 0
|
| 497 |
+
},
|
| 498 |
+
"text/plain": [
|
| 499 |
+
"Batch 1/1: 0%| | 0/3 [00:00<?, ?it/s]"
|
| 500 |
+
]
|
| 501 |
+
},
|
| 502 |
+
"metadata": {},
|
| 503 |
+
"output_type": "display_data"
|
| 504 |
+
},
|
| 505 |
+
{
|
| 506 |
+
"data": {
|
| 507 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 508 |
+
"model_id": "37b7421994104b0ebfbf593d16778425",
|
| 509 |
+
"version_major": 2,
|
| 510 |
+
"version_minor": 0
|
| 511 |
+
},
|
| 512 |
+
"text/plain": [
|
| 513 |
+
"Generating Samples: 0%| | 0/100 [00:00<?, ?it/s]"
|
| 514 |
+
]
|
| 515 |
+
},
|
| 516 |
+
"metadata": {},
|
| 517 |
+
"output_type": "display_data"
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"data": {
|
| 521 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 522 |
+
"model_id": "e118cb7a6eae4ba784738a5b076b16fd",
|
| 523 |
+
"version_major": 2,
|
| 524 |
+
"version_minor": 0
|
| 525 |
+
},
|
| 526 |
+
"text/plain": [
|
| 527 |
+
"Batch 1/13: 0%| | 0/8 [00:00<?, ?it/s]"
|
| 528 |
+
]
|
| 529 |
+
},
|
| 530 |
+
"metadata": {},
|
| 531 |
+
"output_type": "display_data"
|
| 532 |
+
}
|
| 533 |
+
],
|
| 534 |
+
"source": [
|
| 535 |
+
"\n",
|
| 536 |
+
"testset = generator.generate(\n",
|
| 537 |
+
" testset_size=100, \n",
|
| 538 |
+
" batch_size=8,\n",
|
| 539 |
+
" num_personas=len(personas),\n",
|
| 540 |
+
" query_distribution=query_distribution)\n"
|
| 541 |
+
]
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"cell_type": "code",
|
| 545 |
+
"execution_count": 160,
|
| 546 |
+
"metadata": {},
|
| 547 |
+
"outputs": [
|
| 548 |
+
{
|
| 549 |
+
"data": {
|
| 550 |
+
"text/html": [
|
| 551 |
+
"<div>\n",
|
| 552 |
+
"<style scoped>\n",
|
| 553 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 554 |
+
" vertical-align: middle;\n",
|
| 555 |
+
" }\n",
|
| 556 |
+
"\n",
|
| 557 |
+
" .dataframe tbody tr th {\n",
|
| 558 |
+
" vertical-align: top;\n",
|
| 559 |
+
" }\n",
|
| 560 |
+
"\n",
|
| 561 |
+
" .dataframe thead th {\n",
|
| 562 |
+
" text-align: right;\n",
|
| 563 |
+
" }\n",
|
| 564 |
+
"</style>\n",
|
| 565 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 566 |
+
" <thead>\n",
|
| 567 |
+
" <tr style=\"text-align: right;\">\n",
|
| 568 |
+
" <th></th>\n",
|
| 569 |
+
" <th>user_input</th>\n",
|
| 570 |
+
" <th>reference</th>\n",
|
| 571 |
+
" </tr>\n",
|
| 572 |
+
" </thead>\n",
|
| 573 |
+
" <tbody>\n",
|
| 574 |
+
" <tr>\n",
|
| 575 |
+
" <th>0</th>\n",
|
| 576 |
+
" <td>How I can use Move tool to move many layers at...</td>\n",
|
| 577 |
+
" <td>If you have the Move tool selected in Photosho...</td>\n",
|
| 578 |
+
" </tr>\n",
|
| 579 |
+
" <tr>\n",
|
| 580 |
+
" <th>1</th>\n",
|
| 581 |
+
" <td>How I can use Windows key for select layers in...</td>\n",
|
| 582 |
+
" <td>In Photoshop, when selecting layers to put int...</td>\n",
|
| 583 |
+
" </tr>\n",
|
| 584 |
+
" <tr>\n",
|
| 585 |
+
" <th>2</th>\n",
|
| 586 |
+
" <td>How I select layers in Windows for group in Ph...</td>\n",
|
| 587 |
+
" <td>In Windows, to select layers for grouping in P...</td>\n",
|
| 588 |
+
" </tr>\n",
|
| 589 |
+
" <tr>\n",
|
| 590 |
+
" <th>3</th>\n",
|
| 591 |
+
" <td>how i make group in adobe photoshop to reduce ...</td>\n",
|
| 592 |
+
" <td>In Adobe Photoshop, you can reduce clutter in ...</td>\n",
|
| 593 |
+
" </tr>\n",
|
| 594 |
+
" <tr>\n",
|
| 595 |
+
" <th>4</th>\n",
|
| 596 |
+
" <td>Wut is Group 1 in Photoshop and how do I use it?</td>\n",
|
| 597 |
+
" <td>Group 1 in Photoshop is a folder created by cl...</td>\n",
|
| 598 |
+
" </tr>\n",
|
| 599 |
+
" <tr>\n",
|
| 600 |
+
" <th>...</th>\n",
|
| 601 |
+
" <td>...</td>\n",
|
| 602 |
+
" <td>...</td>\n",
|
| 603 |
+
" </tr>\n",
|
| 604 |
+
" <tr>\n",
|
| 605 |
+
" <th>95</th>\n",
|
| 606 |
+
" <td>How do you use the Rectangular Marquee tool to...</td>\n",
|
| 607 |
+
" <td>To use the Rectangular Marquee tool to make a ...</td>\n",
|
| 608 |
+
" </tr>\n",
|
| 609 |
+
" <tr>\n",
|
| 610 |
+
" <th>96</th>\n",
|
| 611 |
+
" <td>How do you use the Select menu to deselect a s...</td>\n",
|
| 612 |
+
" <td>After making a selection with the Rectangular ...</td>\n",
|
| 613 |
+
" </tr>\n",
|
| 614 |
+
" <tr>\n",
|
| 615 |
+
" <th>97</th>\n",
|
| 616 |
+
" <td>In Photoshop CC, how can a beginner add extra ...</td>\n",
|
| 617 |
+
" <td>In Photoshop CC, to add extra canvas space to ...</td>\n",
|
| 618 |
+
" </tr>\n",
|
| 619 |
+
" <tr>\n",
|
| 620 |
+
" <th>98</th>\n",
|
| 621 |
+
" <td>How can I add extra pixels to just one side of...</td>\n",
|
| 622 |
+
" <td>To add extra pixels to just one side of an ima...</td>\n",
|
| 623 |
+
" </tr>\n",
|
| 624 |
+
" <tr>\n",
|
| 625 |
+
" <th>99</th>\n",
|
| 626 |
+
" <td>How can a beginner Photoshop user use the Comm...</td>\n",
|
| 627 |
+
" <td>A beginner Photoshop user can use the Command ...</td>\n",
|
| 628 |
+
" </tr>\n",
|
| 629 |
+
" </tbody>\n",
|
| 630 |
+
"</table>\n",
|
| 631 |
+
"<p>100 rows × 2 columns</p>\n",
|
| 632 |
+
"</div>"
|
| 633 |
+
],
|
| 634 |
+
"text/plain": [
|
| 635 |
+
" user_input \\\n",
|
| 636 |
+
"0 How I can use Move tool to move many layers at... \n",
|
| 637 |
+
"1 How I can use Windows key for select layers in... \n",
|
| 638 |
+
"2 How I select layers in Windows for group in Ph... \n",
|
| 639 |
+
"3 how i make group in adobe photoshop to reduce ... \n",
|
| 640 |
+
"4 Wut is Group 1 in Photoshop and how do I use it? \n",
|
| 641 |
+
".. ... \n",
|
| 642 |
+
"95 How do you use the Rectangular Marquee tool to... \n",
|
| 643 |
+
"96 How do you use the Select menu to deselect a s... \n",
|
| 644 |
+
"97 In Photoshop CC, how can a beginner add extra ... \n",
|
| 645 |
+
"98 How can I add extra pixels to just one side of... \n",
|
| 646 |
+
"99 How can a beginner Photoshop user use the Comm... \n",
|
| 647 |
+
"\n",
|
| 648 |
+
" reference \n",
|
| 649 |
+
"0 If you have the Move tool selected in Photosho... \n",
|
| 650 |
+
"1 In Photoshop, when selecting layers to put int... \n",
|
| 651 |
+
"2 In Windows, to select layers for grouping in P... \n",
|
| 652 |
+
"3 In Adobe Photoshop, you can reduce clutter in ... \n",
|
| 653 |
+
"4 Group 1 in Photoshop is a folder created by cl... \n",
|
| 654 |
+
".. ... \n",
|
| 655 |
+
"95 To use the Rectangular Marquee tool to make a ... \n",
|
| 656 |
+
"96 After making a selection with the Rectangular ... \n",
|
| 657 |
+
"97 In Photoshop CC, to add extra canvas space to ... \n",
|
| 658 |
+
"98 To add extra pixels to just one side of an ima... \n",
|
| 659 |
+
"99 A beginner Photoshop user can use the Command ... \n",
|
| 660 |
+
"\n",
|
| 661 |
+
"[100 rows x 2 columns]"
|
| 662 |
+
]
|
| 663 |
+
},
|
| 664 |
+
"execution_count": 160,
|
| 665 |
+
"metadata": {},
|
| 666 |
+
"output_type": "execute_result"
|
| 667 |
+
}
|
| 668 |
+
],
|
| 669 |
+
"source": [
|
| 670 |
+
"testset.to_pandas()[[\"user_input\", \"reference\"]]"
|
| 671 |
+
]
|
| 672 |
+
},
|
| 673 |
+
{
|
| 674 |
+
"cell_type": "code",
|
| 675 |
+
"execution_count": 161,
|
| 676 |
+
"metadata": {},
|
| 677 |
+
"outputs": [
|
| 678 |
+
{
|
| 679 |
+
"name": "stdout",
|
| 680 |
+
"output_type": "stream",
|
| 681 |
+
"text": [
|
| 682 |
+
"Testset uploaded! View at https://app.ragas.io/dashboard/alignment/testset/94d276d0-95aa-4305-839c-c846af514e2e\n"
|
| 683 |
+
]
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"data": {
|
| 687 |
+
"text/plain": [
|
| 688 |
+
"'https://app.ragas.io/dashboard/alignment/testset/94d276d0-95aa-4305-839c-c846af514e2e'"
|
| 689 |
+
]
|
| 690 |
+
},
|
| 691 |
+
"execution_count": 161,
|
| 692 |
+
"metadata": {},
|
| 693 |
+
"output_type": "execute_result"
|
| 694 |
+
}
|
| 695 |
+
],
|
| 696 |
+
"source": [
|
| 697 |
+
"testset.upload()"
|
| 698 |
+
]
|
| 699 |
+
},
|
| 700 |
+
{
|
| 701 |
+
"cell_type": "code",
|
| 702 |
+
"execution_count": 162,
|
| 703 |
+
"metadata": {},
|
| 704 |
+
"outputs": [
|
| 705 |
+
{
|
| 706 |
+
"data": {
|
| 707 |
+
"text/plain": [
|
| 708 |
+
"KnowledgeGraph(nodes: 48, relationships: 695)"
|
| 709 |
+
]
|
| 710 |
+
},
|
| 711 |
+
"execution_count": 162,
|
| 712 |
+
"metadata": {},
|
| 713 |
+
"output_type": "execute_result"
|
| 714 |
+
}
|
| 715 |
+
],
|
| 716 |
+
"source": [
|
| 717 |
+
"kg"
|
| 718 |
+
]
|
| 719 |
+
},
|
| 720 |
+
{
|
| 721 |
+
"cell_type": "code",
|
| 722 |
+
"execution_count": null,
|
| 723 |
+
"metadata": {},
|
| 724 |
+
"outputs": [],
|
| 725 |
+
"source": []
|
| 726 |
+
}
|
| 727 |
+
],
|
| 728 |
+
"metadata": {
|
| 729 |
+
"kernelspec": {
|
| 730 |
+
"display_name": ".venv",
|
| 731 |
+
"language": "python",
|
| 732 |
+
"name": "python3"
|
| 733 |
+
},
|
| 734 |
+
"language_info": {
|
| 735 |
+
"codemirror_mode": {
|
| 736 |
+
"name": "ipython",
|
| 737 |
+
"version": 3
|
| 738 |
+
},
|
| 739 |
+
"file_extension": ".py",
|
| 740 |
+
"mimetype": "text/x-python",
|
| 741 |
+
"name": "python",
|
| 742 |
+
"nbconvert_exporter": "python",
|
| 743 |
+
"pygments_lexer": "ipython3",
|
| 744 |
+
"version": "3.13.2"
|
| 745 |
+
}
|
| 746 |
+
},
|
| 747 |
+
"nbformat": 4,
|
| 748 |
+
"nbformat_minor": 2
|
| 749 |
+
}
|
pyproject.toml
CHANGED
|
@@ -38,6 +38,7 @@ dependencies = [
|
|
| 38 |
"pylint-venv>=3.0.4",
|
| 39 |
"pyppeteer>=0.0.25",
|
| 40 |
"grandalf>=0.8",
|
|
|
|
| 41 |
]
|
| 42 |
authors = [{ name = "Marko Budisic", email = "[email protected]" }]
|
| 43 |
license = "MIT"
|
|
|
|
| 38 |
"pylint-venv>=3.0.4",
|
| 39 |
"pyppeteer>=0.0.25",
|
| 40 |
"grandalf>=0.8",
|
| 41 |
+
"jupyter-contrib-nbextensions>=0.7.0",
|
| 42 |
]
|
| 43 |
authors = [{ name = "Marko Budisic", email = "[email protected]" }]
|
| 44 |
license = "MIT"
|