mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 08:28:03 +08:00
feat: Adapt EvaluationMetricName.
This commit is contained in:
@ -64,6 +64,12 @@ WORKFLOW_METRIC_NAMES: list[EvaluationMetricName] = [
|
||||
EvaluationMetricName.ANSWER_CORRECTNESS,
|
||||
]
|
||||
|
||||
METRIC_NODE_TYPE_MAPPING: dict[str, str] = {
|
||||
**{m.value: "llm" for m in LLM_METRIC_NAMES},
|
||||
**{m.value: "knowledge-retrieval" for m in RETRIEVAL_METRIC_NAMES},
|
||||
**{m.value: "agent" for m in AGENT_METRIC_NAMES},
|
||||
}
|
||||
|
||||
|
||||
class EvaluationMetric(BaseModel):
|
||||
name: str
|
||||
|
||||
@ -11,12 +11,12 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from configs import dify_config
|
||||
from core.evaluation.entities.evaluation_entity import (
|
||||
EVALUATION_METRICS,
|
||||
METRIC_NODE_TYPE_MAPPING,
|
||||
DefaultMetric,
|
||||
EvaluationCategory,
|
||||
EvaluationConfigData,
|
||||
EvaluationDatasetInput,
|
||||
EvaluationMetricName,
|
||||
EvaluationRunData,
|
||||
EvaluationRunRequest,
|
||||
NodeInfo,
|
||||
@ -429,7 +429,7 @@ class EvaluationService:
|
||||
@staticmethod
|
||||
def get_available_metrics() -> list[str]:
|
||||
"""Return the centrally-defined list of evaluation metrics."""
|
||||
return list(EVALUATION_METRICS)
|
||||
return [m.value for m in EvaluationMetricName]
|
||||
|
||||
@classmethod
|
||||
def get_nodes_for_metrics(
|
||||
|
||||
Reference in New Issue
Block a user