Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -255,7 +257,7 @@ class ConversationalGolden(BaseModel):

</Tabs>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,59 @@ const multiturnGolden = new ConversationalGolden({

</Tabs>

## Add Tags

You can include tags when pushing goldens. Tags allow you to categorize and filter goldens within a dataset.

<Tabs>

<Tab title="Python" language="python">

```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"]
)
```

</Tab>

<Tab title="Typescript" language="typescript">

```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"],
});
```

</Tab>

<Tab title="curl" language="curl">

<EndpointRequestSnippet
endpoint="POST /v1/datasets/{alias}"
example="Tags"
/>

</Tab>

</Tabs>

## Delete Dataset

Delete a dataset programmatically via the Evals API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,63 @@ for (const golden of dataset.goldens as Golden[]) {

</Tabs>

## Using Tags

If your dataset has tags, you can access them via the `tags` field on each golden:

<Tabs>

<Tab title="Python" language="python">

```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)
```

</Tab>

<Tab title="Typescript" language="typescript">

```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);
}
}
```

</Tab>

</Tabs>

## 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.
Expand Down
28 changes: 28 additions & 0 deletions fern/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
Loading