sdg-hub 0.6.1__tar.gz → 0.7.1__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.
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/integration-test.yml +1 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/packer.yml +1 -1
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/PKG-INFO +15 -14
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/concepts.md +3 -5
- sdg_hub-0.7.1/examples/rag_evaluation/ibm-annual-report-2024.pdf +0 -0
- sdg_hub-0.7.1/examples/rag_evaluation/rag_evaluation_dataset_generation.ipynb +505 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/pyproject.toml +23 -16
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/_version.py +3 -3
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/answer_generation.yaml +21 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/conceptual_qa_generation.yaml +25 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/context_extraction.yaml +23 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/flow.yaml +201 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/groundedness_critic.yaml +24 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/question_evolution.yaml +18 -0
- sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag/topic_generation.yaml +12 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub.egg-info/PKG-INFO +15 -14
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub.egg-info/SOURCES.txt +10 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub.egg-info/requires.txt +3 -1
- sdg_hub-0.7.1/tests/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tox.ini +6 -4
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/actionlint.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/actions/free-disk-space/action.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/dependabot.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/mergify.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/actionlint.dockerfile +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/actionlint.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/docs.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/lint.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/matchers/actionlint.json +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/matchers/pylint.json +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/pypi.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.github/workflows/test.yml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.gitignore +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.isort.cfg +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.markdownlint-cli2.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.pre-commit-config.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/.pylintrc +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/CLAUDE.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/CONTRIBUTING.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/LICENSE +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/Makefile +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/.nojekyll +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/_coverpage.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/_navbar.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/_sidebar.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/api-reference.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/assets/logo.png +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/assets/sdg-hub-cover.png +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/blocks/custom-blocks.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/blocks/filtering-blocks.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/blocks/llm-blocks.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/blocks/overview.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/blocks/transform-blocks.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/development.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/flows/available-flows.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/flows/custom-flows.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/flows/discovery.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/flows/overview.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/index.html +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/installation.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/docs/quick-start.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/.env.example +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/document_pre_processing.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/knowledge_generation.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/knowledge_mixing.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/knowledge_mixing_utils.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/enhanced_summary_knowledge_tuning/raft_builder.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/.gitignore +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/assets/imgs/instructlab-banner.png +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/docling_v2_config.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/docparser.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/docparser_v2.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/document_collection/ibm-annual-report/ibm-annual-report-2024.json +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/document_collection/ibm-annual-report/ibm-annual-report-2024.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/document_collection/ibm-annual-report/ibm-annual-report-2024.pdf +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/document_collection/ibm-annual-report/qna.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/document_pre_processing.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/knowledge_generation_and_mixing.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/knowledge_generation_ja.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/instructlab/logger_config.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/knowledge_tuning/knowledge_utils.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/text_analysis/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/text_analysis/extract_stock_tickers.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/examples/text_analysis/structured_insights_demo.ipynb +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/scripts/packer/centos.pkr.hcl +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/scripts/packer/setup-centos.sh +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/scripts/ruff.sh +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/scripts/snyk_notebook_scan.sh +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/setup.cfg +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/base.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/filtering/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/filtering/column_value_filter.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/error_handler.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/llm_chat_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/llm_parser_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/prompt_builder_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/llm/text_parser_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/registry.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/duplicate_columns.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/index_based_mapper.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/json_structure_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/melt_columns.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/rename_columns.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/text_concat.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/blocks/transform/uniform_col_val_setter.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/base.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/checkpointer.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/metadata.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/registry.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/flow/validation.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/datautils.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/error_handling.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/flow_id_words.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/flow_identifier.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/flow_metrics.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/logger_config.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/path_resolution.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/time_estimator.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/core/utils/yaml_utils.py +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa → sdg_hub-0.7.1/src/sdg_hub/flows/evaluation/rag}/__init__.py +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/detailed_summary → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa}/__init__.py +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/doc_direct_qa → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/detailed_summary}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/detailed_summary/detailed_summary.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/detailed_summary/flow.yaml +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/extractive_summary → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/doc_direct_qa}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/doc_direct_qa/flow.yaml +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/extractive_summary}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/extractive_summary/extractive_summary.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/extractive_summary/flow.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/generate_answers.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/generate_multiple_qa.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/generate_question_list.yaml +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts/flow.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts/key_facts_summary.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/README.md +0 -0
- {sdg_hub-0.6.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/atomic_facts.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/detailed_summary.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_faithfulness.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_question.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_relevancy.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/extractive_summary.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/flow.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/generate_questions_responses.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/README.md +0 -0
- {sdg_hub-0.6.1/tests → sdg_hub-0.7.1/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese}/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/atomic_facts_ja.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/detailed_summary_ja.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/extractive_summary_ja.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/flow.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/generate_questions_responses_ja.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/analyze_sentiment.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/extract_entities.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/extract_keywords.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/flow.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/flows/text_analysis/structured_insights/summarize.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub/py.typed +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub.egg-info/dependency_links.txt +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/src/sdg_hub.egg-info/top_level.txt +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/filtering/test_columnvaluefilter.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/llm/test_llm_chat_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/llm/test_llm_parser_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/llm/test_promptbuilderblock.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/llm/test_textparserblock.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/test_base_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/test_registry.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_config.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_prompt_format_config.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_prompt_format_no_system.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_prompt_format_strict.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_prompt_invalid_final_role.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/testdata/test_prompt_no_user_messages.yaml +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_index_based_mapper.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_json_structure_block.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_melt_columns.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_rename_columns.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_text_concat.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/blocks/transform/test_uniform_col_val_setter.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/conftest.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_base.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_checkpointer.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_dataset_requirements.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_integration.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_metadata.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_registry.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_time_estimation.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/flow/test_validation.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/knowledge_tuning/enhanced_summary_knowledge_tuning/README.md +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/knowledge_tuning/enhanced_summary_knowledge_tuning/__init__.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/knowledge_tuning/enhanced_summary_knowledge_tuning/conftest.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/knowledge_tuning/enhanced_summary_knowledge_tuning/test_data/test_seed_data.jsonl +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/integration/knowledge_tuning/enhanced_summary_knowledge_tuning/test_functional.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/utils/test_datautils.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/utils/test_error_handling.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/utils/test_flow_metrics.py +0 -0
- {sdg_hub-0.6.1 → sdg_hub-0.7.1}/tests/utils/test_path_resolution.py +0 -0
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
uses: actions/checkout@v4
|
|
16
16
|
|
|
17
17
|
- name: Configure AWS Credentials
|
|
18
|
-
uses: aws-actions/configure-aws-credentials@
|
|
18
|
+
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708
|
|
19
19
|
with:
|
|
20
20
|
role-to-assume: arn:aws:iam::851725220677:role/github-actions-packer-role
|
|
21
21
|
aws-region: us-east-2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdg_hub
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Synthetic Data Generation
|
|
5
5
|
Author-email: Red Hat AI Innovation <abhandwa@redhat.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -33,6 +33,20 @@ Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
|
33
33
|
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
|
|
34
34
|
Requires-Dist: tenacity!=8.4.0,>=8.3.0
|
|
35
35
|
Requires-Dist: tqdm<5.0.0,>=4.66.2
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pre-commit<4.0,>=3.0.4; extra == "dev"
|
|
38
|
+
Requires-Dist: pylint<4.0,>=2.16.2; extra == "dev"
|
|
39
|
+
Requires-Dist: pylint-pydantic; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest-html; extra == "dev"
|
|
44
|
+
Requires-Dist: tox<5,>=4.4.2; extra == "dev"
|
|
45
|
+
Requires-Dist: ruff; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-env; extra == "dev"
|
|
47
|
+
Requires-Dist: nbconvert>=7.0.0; extra == "dev"
|
|
48
|
+
Provides-Extra: integration
|
|
49
|
+
Requires-Dist: nest-asyncio; extra == "integration"
|
|
36
50
|
Provides-Extra: examples
|
|
37
51
|
Requires-Dist: tabulate>=0.9.0; extra == "examples"
|
|
38
52
|
Requires-Dist: transformers>=4.37.0; extra == "examples"
|
|
@@ -46,20 +60,7 @@ Requires-Dist: nltk; extra == "examples"
|
|
|
46
60
|
Requires-Dist: sentence-transformers; extra == "examples"
|
|
47
61
|
Requires-Dist: instructor; extra == "examples"
|
|
48
62
|
Requires-Dist: fastapi; extra == "examples"
|
|
49
|
-
Requires-Dist: nest-asyncio; extra == "examples"
|
|
50
63
|
Requires-Dist: ipykernel; extra == "examples"
|
|
51
|
-
Provides-Extra: dev
|
|
52
|
-
Requires-Dist: pre-commit<4.0,>=3.0.4; extra == "dev"
|
|
53
|
-
Requires-Dist: pylint<4.0,>=2.16.2; extra == "dev"
|
|
54
|
-
Requires-Dist: pylint-pydantic; extra == "dev"
|
|
55
|
-
Requires-Dist: pytest; extra == "dev"
|
|
56
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
57
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
58
|
-
Requires-Dist: pytest-html; extra == "dev"
|
|
59
|
-
Requires-Dist: tox<5,>=4.4.2; extra == "dev"
|
|
60
|
-
Requires-Dist: ruff; extra == "dev"
|
|
61
|
-
Requires-Dist: pytest-env; extra == "dev"
|
|
62
|
-
Requires-Dist: nbconvert>=7.0.0; extra == "dev"
|
|
63
64
|
Dynamic: license-file
|
|
64
65
|
|
|
65
66
|
# `sdg_hub`: Synthetic Data Generation Toolkit
|
|
@@ -26,16 +26,12 @@ SDG Hub organizes blocks into logical categories:
|
|
|
26
26
|
| **Filtering** | Quality control | Value-based filtering, threshold checks |
|
|
27
27
|
| **Evaluation** | Quality assessment | Faithfulness scoring, relevancy evaluation |
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
#TODO: Add block example
|
|
29
|
+
For detailed block examples and usage patterns, see [Block System Overview](blocks/overview.md).
|
|
31
30
|
|
|
32
31
|
## 🌊 Flows: Orchestrating Pipelines
|
|
33
32
|
|
|
34
33
|
**Flows** are YAML-defined pipelines that orchestrate multiple blocks into complete data processing workflows.
|
|
35
34
|
|
|
36
|
-
### Flow Structure
|
|
37
|
-
#TODO: Add flow structure
|
|
38
|
-
|
|
39
35
|
### Flow Execution Model
|
|
40
36
|
|
|
41
37
|
Flows execute blocks sequentially:
|
|
@@ -58,6 +54,8 @@ Each block:
|
|
|
58
54
|
- **🛡️ Validation** - Built-in checks for configuration and data compatibility
|
|
59
55
|
- **📊 Monitoring** - Execution tracking and performance metrics
|
|
60
56
|
|
|
57
|
+
For detailed flow structure and YAML configuration examples, see [Flow System Overview](flows/overview.md).
|
|
58
|
+
|
|
61
59
|
## 🔍 Auto-Discovery System
|
|
62
60
|
|
|
63
61
|
SDG Hub automatically discovers and registers components with zero configuration.
|
|
Binary file
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# RAG Evaluation Dataset Generation\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"## Overview\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"This notebook demonstrates how to generate high-quality RAG (Retrieval-Augmented Generation) evaluation datasets using the SDG Hub framework. It creates question-answer pairs with ground truth context that can be used to evaluate RAG systems.\n",
|
|
12
|
+
"\n",
|
|
13
|
+
"## What This Notebook Does\n",
|
|
14
|
+
"\n",
|
|
15
|
+
"This notebook will:\n",
|
|
16
|
+
"\n",
|
|
17
|
+
"1. **Construct Input Dataset**: Show how to prepare documents with outlines for the RAG evaluation flow\n",
|
|
18
|
+
"2. **Generate RAG Evaluation Dataset**: Run the RAG Evaluation flow to create question-answer pairs with:\n",
|
|
19
|
+
" - Topic extraction from documents\n",
|
|
20
|
+
" - Conceptual question generation\n",
|
|
21
|
+
" - Question evolution for better quality\n",
|
|
22
|
+
" - Answer generation with grounding\n",
|
|
23
|
+
" - Groundedness scoring and filtering\n",
|
|
24
|
+
" - Ground truth context extraction\n",
|
|
25
|
+
"3. **Visualize Results**: Display sample generated responses\n",
|
|
26
|
+
"4. **Post-process for Evaluation**: Convert the output to evaluation-ready formats (e.g., for RAGAS)\n",
|
|
27
|
+
"\n",
|
|
28
|
+
"## Prerequisites\n",
|
|
29
|
+
"\n",
|
|
30
|
+
"- SDG Hub installed and configured\n",
|
|
31
|
+
"- Model endpoint configured via environment variables (see Environment Variables Setup section below)\n",
|
|
32
|
+
"\n",
|
|
33
|
+
"```bash \n",
|
|
34
|
+
"git clone https://github.com/Red-Hat-AI-Innovation-Team/sdg_hub.git\n",
|
|
35
|
+
"cd sdg_hub\n",
|
|
36
|
+
"pip install .[examples]\n",
|
|
37
|
+
"```"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"cell_type": "code",
|
|
42
|
+
"execution_count": null,
|
|
43
|
+
"metadata": {},
|
|
44
|
+
"outputs": [],
|
|
45
|
+
"source": [
|
|
46
|
+
"from datasets import Dataset\n",
|
|
47
|
+
"import pandas as pd\n",
|
|
48
|
+
"import json\n",
|
|
49
|
+
"import os\n",
|
|
50
|
+
"\n",
|
|
51
|
+
"from sdg_hub import Flow, FlowRegistry"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"cell_type": "code",
|
|
56
|
+
"execution_count": null,
|
|
57
|
+
"metadata": {},
|
|
58
|
+
"outputs": [],
|
|
59
|
+
"source": [
|
|
60
|
+
"# Required to run the flow with async mode\n",
|
|
61
|
+
"import nest_asyncio\n",
|
|
62
|
+
"\n",
|
|
63
|
+
"nest_asyncio.apply()"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"cell_type": "markdown",
|
|
68
|
+
"metadata": {},
|
|
69
|
+
"source": [
|
|
70
|
+
"## Step 1: Prepare Input Dataset\n",
|
|
71
|
+
"\n",
|
|
72
|
+
"The RAG Evaluation flow requires:\n",
|
|
73
|
+
"- **document**: The full text content of the document\n",
|
|
74
|
+
"- **document_outline**: A concise title or summary that represents the document\n",
|
|
75
|
+
"\n",
|
|
76
|
+
"You can prepare this from various sources:\n",
|
|
77
|
+
"- PDF documents (extract text and create outlines)\n",
|
|
78
|
+
"- Text files\n",
|
|
79
|
+
"- Existing datasets\n",
|
|
80
|
+
"- Web content\n",
|
|
81
|
+
"\n",
|
|
82
|
+
"Below are example functions to help construct the input dataset.\n"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cell_type": "code",
|
|
87
|
+
"execution_count": null,
|
|
88
|
+
"metadata": {},
|
|
89
|
+
"outputs": [],
|
|
90
|
+
"source": [
|
|
91
|
+
"def prepare_dataset_from_text(text: str, document_outline: str, chunk_size: int = 3000, overlap: int = 500):\n",
|
|
92
|
+
" \"\"\"\n",
|
|
93
|
+
" Prepare dataset from a single text document by chunking it.\n",
|
|
94
|
+
" \n",
|
|
95
|
+
" Args:\n",
|
|
96
|
+
" text: Full document text\n",
|
|
97
|
+
" document_outline: Title or summary of the document\n",
|
|
98
|
+
" chunk_size: Maximum characters per chunk\n",
|
|
99
|
+
" overlap: Overlap between chunks to maintain context (must be < chunk_size)\n",
|
|
100
|
+
" \n",
|
|
101
|
+
" Returns:\n",
|
|
102
|
+
" Dataset with document and document_outline columns\n",
|
|
103
|
+
" \"\"\"\n",
|
|
104
|
+
" # Validate parameters\n",
|
|
105
|
+
" if overlap >= chunk_size:\n",
|
|
106
|
+
" raise ValueError(f\"overlap ({overlap}) must be less than chunk_size ({chunk_size})\")\n",
|
|
107
|
+
" \n",
|
|
108
|
+
" if chunk_size <= 0:\n",
|
|
109
|
+
" raise ValueError(f\"chunk_size must be positive, got {chunk_size}\")\n",
|
|
110
|
+
" \n",
|
|
111
|
+
" # Simple chunking by character count with overlap\n",
|
|
112
|
+
" chunks = []\n",
|
|
113
|
+
" step_size = chunk_size - overlap\n",
|
|
114
|
+
" \n",
|
|
115
|
+
" for i in range(0, len(text), step_size):\n",
|
|
116
|
+
" chunk = text[i:i + chunk_size]\n",
|
|
117
|
+
" if chunk.strip():\n",
|
|
118
|
+
" chunks.append(chunk)\n",
|
|
119
|
+
" \n",
|
|
120
|
+
" # Create dataset\n",
|
|
121
|
+
" dataset = Dataset.from_dict({\n",
|
|
122
|
+
" \"document\": chunks,\n",
|
|
123
|
+
" \"document_outline\": [document_outline] * len(chunks)\n",
|
|
124
|
+
" })\n",
|
|
125
|
+
" \n",
|
|
126
|
+
" print(f\"Created {len(chunks)} chunks from document\")\n",
|
|
127
|
+
" return dataset\n",
|
|
128
|
+
"\n",
|
|
129
|
+
"\n",
|
|
130
|
+
"def prepare_dataset_from_pdf(pdf_path: str, document_outline: str, max_pages: int = None):\n",
|
|
131
|
+
" \"\"\"\n",
|
|
132
|
+
" Prepare dataset from a PDF file.\n",
|
|
133
|
+
" \n",
|
|
134
|
+
" Args:\n",
|
|
135
|
+
" pdf_path: Path to PDF file\n",
|
|
136
|
+
" document_outline: Title or summary of the document\n",
|
|
137
|
+
" max_pages: Maximum number of pages to process (None for all)\n",
|
|
138
|
+
" \n",
|
|
139
|
+
" Returns:\n",
|
|
140
|
+
" Dataset with document and document_outline columns\n",
|
|
141
|
+
" \"\"\"\n",
|
|
142
|
+
" try:\n",
|
|
143
|
+
" from PyPDF2 import PdfReader\n",
|
|
144
|
+
" except ImportError:\n",
|
|
145
|
+
" raise ImportError(\"PyPDF2 is required. Install with: pip install PyPDF2\")\n",
|
|
146
|
+
" \n",
|
|
147
|
+
" reader = PdfReader(pdf_path)\n",
|
|
148
|
+
" text = \"\"\n",
|
|
149
|
+
" \n",
|
|
150
|
+
" pages_to_read = reader.pages[:max_pages] if max_pages else reader.pages\n",
|
|
151
|
+
" for page in pages_to_read:\n",
|
|
152
|
+
" text += page.extract_text() + \"\\n\"\n",
|
|
153
|
+
" \n",
|
|
154
|
+
" return prepare_dataset_from_text(text, document_outline)"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"cell_type": "markdown",
|
|
159
|
+
"metadata": {},
|
|
160
|
+
"source": [
|
|
161
|
+
"### Example: Create Dataset from IBM Annual Report\n",
|
|
162
|
+
"\n",
|
|
163
|
+
"Here's an example using the IBM 2024 Annual Report. It will extract text from the first 20 pages and create chunks for processing."
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"cell_type": "code",
|
|
168
|
+
"execution_count": null,
|
|
169
|
+
"metadata": {},
|
|
170
|
+
"outputs": [],
|
|
171
|
+
"source": [
|
|
172
|
+
"pdf_path = \"ibm-annual-report-2024.pdf\"\n",
|
|
173
|
+
"\n",
|
|
174
|
+
"if not os.path.exists(pdf_path):\n",
|
|
175
|
+
" raise FileNotFoundError(\n",
|
|
176
|
+
" f\"PDF file not found: {pdf_path}\\n\"\n",
|
|
177
|
+
" )\n",
|
|
178
|
+
"\n",
|
|
179
|
+
"input_dataset = prepare_dataset_from_pdf(pdf_path, \"IBM 2024 Annual Report Summary\", max_pages=20)\n",
|
|
180
|
+
"print(f\"\\nInput dataset columns: {input_dataset.column_names}\")\n",
|
|
181
|
+
"print(f\"Number of samples: {len(input_dataset)}\")\n"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"cell_type": "markdown",
|
|
186
|
+
"metadata": {},
|
|
187
|
+
"source": [
|
|
188
|
+
"## Step 2: Discover and Load the RAG Evaluation Flow\n"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"cell_type": "code",
|
|
193
|
+
"execution_count": null,
|
|
194
|
+
"metadata": {},
|
|
195
|
+
"outputs": [],
|
|
196
|
+
"source": [
|
|
197
|
+
"# Get the RAG Evaluation flow\n",
|
|
198
|
+
"flow_name = \"RAG Evaluation Dataset Flow\"\n",
|
|
199
|
+
"flow_path = FlowRegistry.get_flow_path(flow_name)\n",
|
|
200
|
+
"\n",
|
|
201
|
+
"flow = Flow.from_yaml(flow_path)"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"cell_type": "markdown",
|
|
206
|
+
"metadata": {},
|
|
207
|
+
"source": [
|
|
208
|
+
"## Step 3: Configure Model\n",
|
|
209
|
+
"\n",
|
|
210
|
+
"Set up the model configuration for the flow. This uses environment variables for configuration.\n",
|
|
211
|
+
"\n",
|
|
212
|
+
"**IMPORTANT:** Before running the cells below, make sure to set the following environment variables:\n",
|
|
213
|
+
"\n",
|
|
214
|
+
"```bash\n",
|
|
215
|
+
"export INFERENCE_MODEL=\"your-model-name\"\n",
|
|
216
|
+
"export URL=\"your-api-endpoint\"\n",
|
|
217
|
+
"export API_KEY=\"your-api-key\"\n",
|
|
218
|
+
"```"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"cell_type": "code",
|
|
223
|
+
"execution_count": null,
|
|
224
|
+
"metadata": {},
|
|
225
|
+
"outputs": [],
|
|
226
|
+
"source": [
|
|
227
|
+
"def set_model_config(flow_object):\n",
|
|
228
|
+
" \"\"\"Configure the model for the flow based on environment variables.\"\"\"\n",
|
|
229
|
+
" model = os.getenv(\"INFERENCE_MODEL\", \"\")\n",
|
|
230
|
+
" api_base = os.getenv(\"URL\", \"\")\n",
|
|
231
|
+
" api_key = os.getenv(\"API_KEY\", \"\")\n",
|
|
232
|
+
" \n",
|
|
233
|
+
" if model and not model.startswith(\"openai/\") and not model.startswith(\"ollama/\"):\n",
|
|
234
|
+
" model = \"openai/\" + model\n",
|
|
235
|
+
" \n",
|
|
236
|
+
" if not model:\n",
|
|
237
|
+
" raise ValueError(\"INFERENCE_MODEL environment variable must be set\")\n",
|
|
238
|
+
" \n",
|
|
239
|
+
" print(f\"Configuring model: {model}\")\n",
|
|
240
|
+
" \n",
|
|
241
|
+
" flow_object.set_model_config(\n",
|
|
242
|
+
" model=model,\n",
|
|
243
|
+
" api_base=api_base if api_base else None,\n",
|
|
244
|
+
" api_key=api_key if api_key else None,\n",
|
|
245
|
+
" )\n",
|
|
246
|
+
" \n",
|
|
247
|
+
" return flow_object\n",
|
|
248
|
+
"\n",
|
|
249
|
+
"# Configure the model\n",
|
|
250
|
+
"flow = set_model_config(flow)"
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"cell_type": "markdown",
|
|
255
|
+
"metadata": {},
|
|
256
|
+
"source": [
|
|
257
|
+
"## Step 4: Generate RAG Evaluation Dataset\n",
|
|
258
|
+
"\n",
|
|
259
|
+
"Run the flow to generate question-answer pairs with ground truth context. The flow will:\n",
|
|
260
|
+
"1. Extract topics from documents\n",
|
|
261
|
+
"2. Generate conceptual questions\n",
|
|
262
|
+
"3. Evolve questions for better quality\n",
|
|
263
|
+
"4. Generate answers with grounding\n",
|
|
264
|
+
"5. Score groundedness and filter low-quality pairs\n",
|
|
265
|
+
"6. Extract ground truth context\n"
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"cell_type": "code",
|
|
270
|
+
"execution_count": null,
|
|
271
|
+
"metadata": {},
|
|
272
|
+
"outputs": [],
|
|
273
|
+
"source": [
|
|
274
|
+
"# Get runtime parameters\n",
|
|
275
|
+
"max_concurrency = int(os.getenv(\"MAX_CONCURRENCY\", \"10\"))\n",
|
|
276
|
+
"\n",
|
|
277
|
+
"# Optional: Configure runtime parameters for specific blocks\n",
|
|
278
|
+
"runtime_params = {}\n",
|
|
279
|
+
"\n",
|
|
280
|
+
"print(\"This may take several minutes depending on dataset size and model speed...\\n\")\n",
|
|
281
|
+
"\n",
|
|
282
|
+
"# Generate the dataset\n",
|
|
283
|
+
"generated_data = flow.generate(\n",
|
|
284
|
+
" input_dataset, \n",
|
|
285
|
+
" runtime_params=runtime_params, \n",
|
|
286
|
+
" max_concurrency=max_concurrency\n",
|
|
287
|
+
")"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"cell_type": "markdown",
|
|
292
|
+
"metadata": {},
|
|
293
|
+
"source": [
|
|
294
|
+
"## Step 5: Visualize Generated Results\n",
|
|
295
|
+
"\n",
|
|
296
|
+
"Let's examine some of the generated question-answer pairs to assess quality.\n"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"cell_type": "code",
|
|
301
|
+
"execution_count": null,
|
|
302
|
+
"metadata": {},
|
|
303
|
+
"outputs": [],
|
|
304
|
+
"source": [
|
|
305
|
+
"df = generated_data.to_pandas()\n",
|
|
306
|
+
"\n",
|
|
307
|
+
"print(f\"Total records: {len(df)}\")\n",
|
|
308
|
+
"print(\"\\nColumns:\", list(df.columns))\n",
|
|
309
|
+
"\n",
|
|
310
|
+
"print(\"\\nSAMPLE GENERATED RECORDS\")\n",
|
|
311
|
+
"\n",
|
|
312
|
+
"sample_cols = [\"topic\", \"question\", \"response\", \"ground_truth_context\"]\n",
|
|
313
|
+
"\n",
|
|
314
|
+
"for i, row in df.head(3).iterrows():\n",
|
|
315
|
+
" print(\"\\n\")\n",
|
|
316
|
+
" for col in sample_cols:\n",
|
|
317
|
+
" if col in df:\n",
|
|
318
|
+
" val = row[col]\n",
|
|
319
|
+
" text = str(val)\n",
|
|
320
|
+
" if len(text) > 200:\n",
|
|
321
|
+
" text = text[:200] + \"...\"\n",
|
|
322
|
+
" print(f\"{col.title()}: {text}\")"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"cell_type": "code",
|
|
327
|
+
"execution_count": null,
|
|
328
|
+
"metadata": {},
|
|
329
|
+
"outputs": [],
|
|
330
|
+
"source": [
|
|
331
|
+
"display_columns = ['question', 'response', 'ground_truth_context']\n",
|
|
332
|
+
"\n",
|
|
333
|
+
"print(\"DETAILED VIEW (First Record)\")\n",
|
|
334
|
+
"\n",
|
|
335
|
+
"first = df.iloc[0]\n",
|
|
336
|
+
"\n",
|
|
337
|
+
"for col in display_columns:\n",
|
|
338
|
+
" if col in df and pd.notna(first[col]):\n",
|
|
339
|
+
" print(f\"\\n{col.upper()}:\")\n",
|
|
340
|
+
" print(first[col], \"\\n\")"
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"cell_type": "markdown",
|
|
345
|
+
"metadata": {},
|
|
346
|
+
"source": [
|
|
347
|
+
"## Step 6: Post-process for Evaluation\n",
|
|
348
|
+
"\n",
|
|
349
|
+
"Convert the generated dataset to evaluation-ready formats. This prepares the data for use with evaluation frameworks like RAGAS.\n"
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"cell_type": "code",
|
|
354
|
+
"execution_count": null,
|
|
355
|
+
"metadata": {},
|
|
356
|
+
"outputs": [],
|
|
357
|
+
"source": [
|
|
358
|
+
"from pathlib import Path\n",
|
|
359
|
+
"\n",
|
|
360
|
+
"def prepare_for_ragas_evaluation(generated_df: pd.DataFrame, output_file: str = None):\n",
|
|
361
|
+
" \"\"\"\n",
|
|
362
|
+
" Convert generated dataset to RAGAS evaluation format.\n",
|
|
363
|
+
" \n",
|
|
364
|
+
" RAGAS expects:\n",
|
|
365
|
+
" - question: The question\n",
|
|
366
|
+
" - answer: The generated answer\n",
|
|
367
|
+
" - contexts: List of context strings (usually one)\n",
|
|
368
|
+
" - ground_truth: The ground truth answer (can be same as answer or use ground_truth_context)\n",
|
|
369
|
+
" \n",
|
|
370
|
+
" Args:\n",
|
|
371
|
+
" generated_df: DataFrame from flow generation\n",
|
|
372
|
+
" output_file: Optional path to save JSONL file\n",
|
|
373
|
+
" \n",
|
|
374
|
+
" Returns:\n",
|
|
375
|
+
" List of dictionaries in RAGAS format\n",
|
|
376
|
+
" \"\"\"\n",
|
|
377
|
+
" ragas_data = []\n",
|
|
378
|
+
" \n",
|
|
379
|
+
" for _, row in generated_df.iterrows():\n",
|
|
380
|
+
" question = row.get('question', '')\n",
|
|
381
|
+
" answer = row.get('response', '')\n",
|
|
382
|
+
" context = row.get('document', row.get('context', ''))\n",
|
|
383
|
+
" ground_truth = row.get('ground_truth_context', answer)\n",
|
|
384
|
+
" \n",
|
|
385
|
+
" ragas_record = {\n",
|
|
386
|
+
" \"question\": str(question),\n",
|
|
387
|
+
" \"answer\": str(answer),\n",
|
|
388
|
+
" \"contexts\": [str(context)] if context else [\"\"],\n",
|
|
389
|
+
" \"ground_truth\": str(ground_truth)\n",
|
|
390
|
+
" }\n",
|
|
391
|
+
" \n",
|
|
392
|
+
" ragas_data.append(ragas_record)\n",
|
|
393
|
+
" \n",
|
|
394
|
+
" if output_file:\n",
|
|
395
|
+
" output_file = Path(output_file)\n",
|
|
396
|
+
" output_file.parent.mkdir(parents=True, exist_ok=True)\n",
|
|
397
|
+
"\n",
|
|
398
|
+
" with output_file.open(\"w\") as f:\n",
|
|
399
|
+
" for record in ragas_data:\n",
|
|
400
|
+
" f.write(json.dumps(record, ensure_ascii=False) + \"\\n\")\n",
|
|
401
|
+
"\n",
|
|
402
|
+
" return ragas_data\n",
|
|
403
|
+
"\n",
|
|
404
|
+
"ragas_data = prepare_for_ragas_evaluation(df, output_file=\"rag_evaluation_dataset.jsonl\")\n",
|
|
405
|
+
"\n",
|
|
406
|
+
"print(f\"\\n✅ Prepared {len(ragas_data)} records for evaluation\")"
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"cell_type": "code",
|
|
411
|
+
"execution_count": null,
|
|
412
|
+
"metadata": {},
|
|
413
|
+
"outputs": [],
|
|
414
|
+
"source": [
|
|
415
|
+
"# Save the full generated dataset\n",
|
|
416
|
+
"output_csv = \"rag_evaluation_full_results.csv\"\n",
|
|
417
|
+
"generated_data.to_csv(output_csv, index=False)\n",
|
|
418
|
+
"print(f\"Saved full results to {output_csv}\")"
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"cell_type": "markdown",
|
|
423
|
+
"metadata": {},
|
|
424
|
+
"source": [
|
|
425
|
+
"## Summary\n",
|
|
426
|
+
"\n",
|
|
427
|
+
"🎉 You have successfully:\n",
|
|
428
|
+
"\n",
|
|
429
|
+
"1. ✅ Prepared input dataset with documents and outlines\n",
|
|
430
|
+
"2. ✅ Generated RAG evaluation dataset with question-answer pairs\n",
|
|
431
|
+
"3. ✅ Visualized generated results\n",
|
|
432
|
+
"4. ✅ Post-processed data for evaluation frameworks\n",
|
|
433
|
+
"\n",
|
|
434
|
+
"### Next Steps\n",
|
|
435
|
+
"\n",
|
|
436
|
+
"- Use the generated `rag_evaluation_dataset.jsonl` file with RAGAS or other evaluation frameworks\n",
|
|
437
|
+
"- Analyze the quality of generated questions and answers\n",
|
|
438
|
+
"- Fine-tune the flow parameters or prompts if needed\n",
|
|
439
|
+
"- Scale up to larger datasets for comprehensive evaluation\n",
|
|
440
|
+
"\n",
|
|
441
|
+
"> **Note:** \n",
|
|
442
|
+
"> In a real RAG system, the model-generated answer comes from retrieved context, \n",
|
|
443
|
+
"> so it will often differ from the ground truth.\n",
|
|
444
|
+
"\n",
|
|
445
|
+
"### Example: Using with RAGAS\n",
|
|
446
|
+
"\n",
|
|
447
|
+
"```python\n",
|
|
448
|
+
"from ragas import evaluate\n",
|
|
449
|
+
"from ragas.metrics import faithfulness, answer_relevancy, context_precision, context_recall\n",
|
|
450
|
+
"from datasets import load_dataset\n",
|
|
451
|
+
"from langchain_openai import ChatOpenAI\n",
|
|
452
|
+
"from langchain_huggingface import HuggingFaceEmbeddings\n",
|
|
453
|
+
"import os\n",
|
|
454
|
+
"\n",
|
|
455
|
+
"# Load the prepared dataset\n",
|
|
456
|
+
"dataset = load_dataset(\"json\", data_files=\"rag_evaluation_dataset.jsonl\", split=\"train\")\n",
|
|
457
|
+
"\n",
|
|
458
|
+
"llm = ChatOpenAI(\n",
|
|
459
|
+
" model=os.getenv(\"INFERENCE_MODEL\", \"\"),\n",
|
|
460
|
+
" temperature=0,\n",
|
|
461
|
+
" base_url=os.getenv(\"URL\", \"\"),\n",
|
|
462
|
+
" api_key=os.getenv(\"API_KEY\", \"\")\n",
|
|
463
|
+
")\n",
|
|
464
|
+
"\n",
|
|
465
|
+
"embeddings = HuggingFaceEmbeddings(\n",
|
|
466
|
+
" model_name=\"nomic-ai/nomic-embed-text-v1.5\",\n",
|
|
467
|
+
" model_kwargs={'device': 'cpu', \"trust_remote_code\": True},\n",
|
|
468
|
+
" encode_kwargs={'normalize_embeddings': True}\n",
|
|
469
|
+
")\n",
|
|
470
|
+
"\n",
|
|
471
|
+
"# Run RAGAS evaluation\n",
|
|
472
|
+
"results = evaluate(\n",
|
|
473
|
+
" dataset=dataset,\n",
|
|
474
|
+
" metrics=[faithfulness, answer_relevancy, context_precision, context_recall],\n",
|
|
475
|
+
" llm=llm,\n",
|
|
476
|
+
" embeddings=embeddings\n",
|
|
477
|
+
")\n",
|
|
478
|
+
"\n",
|
|
479
|
+
"print(f\"\\n{results}\")\n",
|
|
480
|
+
"```"
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
"metadata": {
|
|
485
|
+
"kernelspec": {
|
|
486
|
+
"display_name": ".venv",
|
|
487
|
+
"language": "python",
|
|
488
|
+
"name": "python3"
|
|
489
|
+
},
|
|
490
|
+
"language_info": {
|
|
491
|
+
"codemirror_mode": {
|
|
492
|
+
"name": "ipython",
|
|
493
|
+
"version": 3
|
|
494
|
+
},
|
|
495
|
+
"file_extension": ".py",
|
|
496
|
+
"mimetype": "text/x-python",
|
|
497
|
+
"name": "python",
|
|
498
|
+
"nbconvert_exporter": "python",
|
|
499
|
+
"pygments_lexer": "ipython3",
|
|
500
|
+
"version": "3.12.12"
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
"nbformat": 4,
|
|
504
|
+
"nbformat_minor": 4
|
|
505
|
+
}
|
|
@@ -51,22 +51,7 @@ source = "https://github.com/Red-Hat-AI-Innovation-Team/sdg_hub"
|
|
|
51
51
|
issues = "https://github.com/Red-Hat-AI-Innovation-Team/sdg_hub/issues"
|
|
52
52
|
|
|
53
53
|
[project.optional-dependencies]
|
|
54
|
-
|
|
55
|
-
"tabulate>=0.9.0",
|
|
56
|
-
"transformers>=4.37.0",
|
|
57
|
-
"langchain-text-splitters",
|
|
58
|
-
"docling>=2.3.0",
|
|
59
|
-
"scikit-learn",
|
|
60
|
-
"polars",
|
|
61
|
-
"matplotlib",
|
|
62
|
-
"spacy",
|
|
63
|
-
"nltk",
|
|
64
|
-
"sentence-transformers",
|
|
65
|
-
"instructor",
|
|
66
|
-
"fastapi",
|
|
67
|
-
"nest-asyncio",
|
|
68
|
-
"ipykernel",
|
|
69
|
-
]
|
|
54
|
+
# Development and testing dependencies (lightweight, no ML libraries)
|
|
70
55
|
dev = [
|
|
71
56
|
"pre-commit>=3.0.4,<4.0",
|
|
72
57
|
"pylint>=2.16.2,<4.0",
|
|
@@ -81,6 +66,28 @@ dev = [
|
|
|
81
66
|
# Integration testing dependencies
|
|
82
67
|
"nbconvert>=7.0.0",
|
|
83
68
|
]
|
|
69
|
+
# Minimal dependencies for integration testing only
|
|
70
|
+
# Integration tests run knowledge_generation.ipynb which only needs nest-asyncio
|
|
71
|
+
integration = [
|
|
72
|
+
"nest-asyncio",
|
|
73
|
+
]
|
|
74
|
+
# Heavy dependencies for example notebooks (knowledge_mixing.ipynb, etc.)
|
|
75
|
+
# NOT required for core functionality testing or integration tests
|
|
76
|
+
examples = [
|
|
77
|
+
"tabulate>=0.9.0",
|
|
78
|
+
"transformers>=4.37.0", # For knowledge_mixing.ipynb, NOT integration tests
|
|
79
|
+
"langchain-text-splitters",
|
|
80
|
+
"docling>=2.3.0", # For document parsing examples
|
|
81
|
+
"scikit-learn", # For raft_builder.py utility
|
|
82
|
+
"polars", # For knowledge_mixing_utils.py
|
|
83
|
+
"matplotlib",
|
|
84
|
+
"spacy",
|
|
85
|
+
"nltk",
|
|
86
|
+
"sentence-transformers",
|
|
87
|
+
"instructor",
|
|
88
|
+
"fastapi",
|
|
89
|
+
"ipykernel",
|
|
90
|
+
]
|
|
84
91
|
|
|
85
92
|
[tool.setuptools_scm]
|
|
86
93
|
version_file = "src/sdg_hub/_version.py"
|
|
@@ -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.7.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 7, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g884bce940'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
- role: system
|
|
2
|
+
content: |
|
|
3
|
+
You are an extractive question-answering system. Your answers must be FULLY GROUNDED in the provided context.
|
|
4
|
+
|
|
5
|
+
Strict Rules:
|
|
6
|
+
1. Use ONLY information explicitly stated in the context
|
|
7
|
+
2. Do NOT make inferences, assumptions, or add general knowledge
|
|
8
|
+
3. Do NOT elaborate beyond what the context says
|
|
9
|
+
4. Quote or paraphrase the context directly
|
|
10
|
+
5. If information is missing, acknowledge it
|
|
11
|
+
|
|
12
|
+
- role: user
|
|
13
|
+
content: |
|
|
14
|
+
Context:
|
|
15
|
+
{{context}}
|
|
16
|
+
|
|
17
|
+
Question:
|
|
18
|
+
{{question}}
|
|
19
|
+
|
|
20
|
+
Provide a direct, extractive answer using ONLY the information stated above.
|
|
21
|
+
|