diff --git a/fern/docs/pages/llm-evaluation/core-concepts/test-cases-goldens-datasets.mdx b/fern/docs/pages/llm-evaluation/core-concepts/test-cases-goldens-datasets.mdx index 5e7ab88b..ae0af27f 100644 --- a/fern/docs/pages/llm-evaluation/core-concepts/test-cases-goldens-datasets.mdx +++ b/fern/docs/pages/llm-evaluation/core-concepts/test-cases-goldens-datasets.mdx @@ -208,6 +208,7 @@ class Golden(BaseModel): additional_metadata: Optional[Dict] = None comments: Optional[str] = None custom_column_key_values: Optional[Dict[str, str]] = None + tags: Optional[List[str]] = None # Fields that you should ideally not populate actual_output: Optional[str] = None @@ -240,6 +241,7 @@ class ConversationalGolden(BaseModel): additional_metadata: Optional[Dict] = None comments: Optional[str] = None custom_column_key_values: Optional[Dict[str, str]] = None + tags: Optional[List[str]] = None # Fields that you should ideally not populate turns: Optional[Turn] = None @@ -255,7 +257,7 @@ class ConversationalGolden(BaseModel): -You'll notice that goldens are more opinionated and contains a `custom_column_key_values` field that you can edit either on the platform or via code. +You'll notice that goldens are more opinionated and contains `custom_column_key_values` and `tags` fields that you can edit either on the platform or via code. ## Datasets diff --git a/fern/docs/pages/llm-evaluation/dataset-management/automate-dataset-management.mdx b/fern/docs/pages/llm-evaluation/dataset-management/automate-dataset-management.mdx index 19e78911..cadc3b56 100644 --- a/fern/docs/pages/llm-evaluation/dataset-management/automate-dataset-management.mdx +++ b/fern/docs/pages/llm-evaluation/dataset-management/automate-dataset-management.mdx @@ -207,6 +207,59 @@ const multiturnGolden = new ConversationalGolden({ +## Add Tags + +You can include tags when pushing goldens. Tags allow you to categorize and filter goldens within a dataset. + + + + + +```python main.py +from deepeval.dataset import Golden, ConversationalGolden + +golden = Golden( + input="How tall is Mt. Everest?", + tags=["geography", "factual"] +) + +multiturn_golden = ConversationalGolden( + scenario="User asking for a refund.", + tags=["support", "refund"] +) +``` + + + + + +```ts index.ts +import { Golden, ConversationalGolden } from "deepeval"; + +const golden = new Golden({ + input: "How tall is Mt. Everest?", + tags: ["geography", "factual"], +}); + +const multiturnGolden = new ConversationalGolden({ + scenario: "User asking for a refund.", + tags: ["support", "refund"], +}); +``` + + + + + + + + + + + ## Delete Dataset Delete a dataset programmatically via the Evals API. diff --git a/fern/docs/pages/llm-evaluation/dataset-management/using-datasets.mdx b/fern/docs/pages/llm-evaluation/dataset-management/using-datasets.mdx index 6d37c2da..df5965b0 100644 --- a/fern/docs/pages/llm-evaluation/dataset-management/using-datasets.mdx +++ b/fern/docs/pages/llm-evaluation/dataset-management/using-datasets.mdx @@ -384,6 +384,63 @@ for (const golden of dataset.goldens as Golden[]) { +## Using Tags + +If your dataset has tags, you can access them via the `tags` field on each golden: + + + + + +```python main.py +from deepeval.dataset import EvaluationDataset +from deepeval.test_case import LLMTestCase + +dataset = EvaluationDataset() +dataset.pull(alias="YOUR-DATASET-ALIAS") + +for golden in dataset.goldens: + # Access tags + tags = golden.tags + + # Filter or use tags in your evaluation logic + if "factual" in tags: + test_case = LLMTestCase( + input=golden.input, + actual_output=llm_app(golden.input), + ) + dataset.add_test_case(test_case) +``` + + + + + +```ts index.ts +import { EvaluationDataset, Golden, LLMTestCase } from "deepeval"; + +const dataset = new EvaluationDataset(); +await dataset.pull({ alias: "YOUR-DATASET-ALIAS" }); + +for (const golden of dataset.goldens as Golden[]) { + // Access tags + const tags = golden.tags ?? []; + + // Filter or use tags in your evaluation logic + if (tags.includes("factual")) { + const testCase = new LLMTestCase({ + input: golden.input, + actualOutput: await llmApp(golden.input), + }); + dataset.addTestCase(testCase); + } +} +``` + + + + + ## Using Images Any (list of) golden text fields (such as input, scenario, etc.) that contains an image will be in the format of `[DEEPEVAL:IMAGE:url]`. The `url` inside the `[DEEPEVAL:IMAGE:url]` format is a public url that can be accessed by anyone. diff --git a/fern/openapi.yaml b/fern/openapi.yaml index f399390b..ef164a94 100644 --- a/fern/openapi.yaml +++ b/fern/openapi.yaml @@ -435,6 +435,14 @@ paths: - input: "What is 2 + 2?" customColumnKeyValues: key: "value" + Tags: + finalized: true + goldens: + - input: "How is the weather like in NYC?" + expectedOutput: "No idea" + tags: + - "weather" + - "geography" responses: "200": description: "" @@ -3247,6 +3255,11 @@ components: type: object additionalProperties: true description: "This is the custom column key values of the LLM application." + tags: + type: array + items: + type: string + description: "A list of tags associated with this golden." required: - input @@ -3286,6 +3299,11 @@ components: type: object additionalProperties: true description: "This is the custom column key values of the LLM application." + tags: + type: array + items: + type: string + description: "A list of tags associated with this golden." required: - scenario @@ -3338,6 +3356,11 @@ components: type: object additionalProperties: true description: "Key-value pairs representing custom table column data for this golden. Keys correspond to the custom column keys defined in the dataset." + tags: + type: array + items: + type: string + description: "A list of tags to associate with this golden." required: - input @@ -3380,6 +3403,11 @@ components: type: object additionalProperties: true description: "Key-value pairs representing custom table column data for this golden. Keys correspond to the custom column keys defined in the dataset." + tags: + type: array + items: + type: string + description: "A list of tags to associate with this golden." required: - scenario