<!-- .github/pull_request_template.md --> ## Description - Enable custom tasks in corpus building ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a configurable option to specify the task retrieval strategy during corpus building. - Enhanced the workflow with integrated task fetching, featuring a default retrieval mechanism. - Updated evaluation configuration to support customizable task selection for more flexible operations. - Added a new abstract base class for defining various task retrieval strategies. - Introduced a new enumeration to map task getter types to their corresponding classes. - **Dependencies** - Added a new dependency for downloading files from Google Drive. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
58 lines
2 KiB
Python
58 lines
2 KiB
Python
from functools import lru_cache
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from typing import List
|
|
|
|
|
|
class EvalConfig(BaseSettings):
|
|
# Corpus builder params
|
|
building_corpus_from_scratch: bool = True
|
|
number_of_samples_in_corpus: int = 1
|
|
benchmark: str = "Dummy" # Options: 'HotPotQA', 'Dummy', 'TwoWikiMultiHop'
|
|
task_getter_type: str = "Default"
|
|
|
|
# Question answering params
|
|
answering_questions: bool = True
|
|
qa_engine: str = (
|
|
"cognee_completion" # Options: 'cognee_completion' or 'cognee_graph_completion'
|
|
)
|
|
|
|
# Evaluation params
|
|
evaluating_answers: bool = True
|
|
evaluation_engine: str = "DeepEval"
|
|
evaluation_metrics: List[str] = ["correctness", "EM", "f1"]
|
|
deepeval_model: str = "gpt-4o-mini"
|
|
|
|
# Visualization
|
|
dashboard: bool = True
|
|
|
|
# file paths
|
|
questions_path: str = "questions_output.json"
|
|
answers_path: str = "answers_output.json"
|
|
metrics_path: str = "metrics_output.json"
|
|
dashboard_path: str = "dashboard.html"
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="allow")
|
|
|
|
def to_dict(self) -> dict:
|
|
return {
|
|
"building_corpus_from_scratch": self.building_corpus_from_scratch,
|
|
"number_of_samples_in_corpus": self.number_of_samples_in_corpus,
|
|
"benchmark": self.benchmark,
|
|
"answering_questions": self.answering_questions,
|
|
"qa_engine": self.qa_engine,
|
|
"evaluating_answers": self.evaluating_answers,
|
|
"evaluation_engine": self.evaluation_engine,
|
|
"evaluation_metrics": self.evaluation_metrics,
|
|
"dashboard": self.dashboard,
|
|
"questions_path": self.questions_path,
|
|
"answers_path": self.answers_path,
|
|
"metrics_path": self.metrics_path,
|
|
"dashboard_path": self.dashboard_path,
|
|
"deepeval_model": self.deepeval_model,
|
|
"task_getter_type": self.task_getter_type,
|
|
}
|
|
|
|
|
|
@lru_cache
|
|
def get_llm_config():
|
|
return EvalConfig()
|