Skip to content

Commit f4c8115

Browse files
committed
Fix typing for lower python versions
1 parent 95dbb2b commit f4c8115

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/evals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,13 +768,13 @@ _(This example is complete, it can be run "as is" — you'll need to add `asynci
768768

769769
### Generating from an Existing Agent
770770

771-
If you already have an agent, you can use [`generate_evals_from_agent`][pydantic_evals.generation.generate_evals_from_agent] to automatically extract types from the agent and generate test cases. This is simpler than `generate_dataset` because you don't need to manually specify the dataset type or generic parameters.
771+
If you already have an agent, you can use [`generate_dataset_for_agent`][pydantic_evals.generation.generate_dataset_for_agent] to automatically extract types from the agent and generate test cases. This is simpler than `generate_dataset` because you don't need to manually specify the dataset type or generic parameters.
772772

773773
```python {title="generate_from_agent_example.py"}
774774
from pydantic import BaseModel
775775
from pydantic_ai import Agent
776776

777-
from pydantic_evals.generation import generate_evals_from_agent
777+
from pydantic_evals.generation import generate_dataset_for_agent
778778

779779

780780
class AnswerOutput(BaseModel):
@@ -792,7 +792,7 @@ agent = Agent( # (1)!
792792

793793

794794
async def main():
795-
dataset = await generate_evals_from_agent( # (2)!
795+
dataset = await generate_dataset_for_agent( # (2)!
796796
agent=agent,
797797
n_examples=3,
798798
model='openai:gpt-4o',

pydantic_evals/pydantic_evals/generation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
import re
1111
from collections.abc import Sequence
1212
from pathlib import Path
13-
from typing import Any, TypeVar
13+
from typing import Any
1414

1515
from pydantic import BaseModel, ValidationError
16+
from typing_extensions import TypeVar
1617

1718
from pydantic_ai import Agent, models
1819
from pydantic_ai._utils import strip_markdown_fences
@@ -39,6 +40,7 @@ async def generate_dataset(
3940
extra_instructions: str | None = None,
4041
) -> Dataset[InputsT, OutputT, MetadataT]:
4142
"""Use an LLM to generate a dataset of test cases, each consisting of input, expected output, and metadata.
43+
4244
This function creates a properly structured dataset with the specified input, output, and metadata types.
4345
It uses an LLM to attempt to generate realistic test cases that conform to the types' schemas.
4446

0 commit comments

Comments
 (0)