From 3d3dfe17c1def29bec7cce58db7480a27fe62531 Mon Sep 17 00:00:00 2001 From: Daniel Balcells Date: Wed, 4 Jun 2025 16:28:04 -0400 Subject: [PATCH] Fix Pydantic version error --- src/schemas.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/schemas.py b/src/schemas.py index bb85f2fb..7e8cddb1 100644 --- a/src/schemas.py +++ b/src/schemas.py @@ -1,7 +1,7 @@ import datetime from typing import Annotated -from pydantic import BaseModel, ConfigDict, Field, computed_field, field_validator +from pydantic import BaseModel, ConfigDict, Field, computed_field, field_validator, ValidationInfo class AppBase(BaseModel): @@ -306,9 +306,13 @@ class DialecticOptions(BaseModel): return v @field_validator("include_trace") - def validate_stream_and_trace(cls, v, values): - # Ensure stream is False when include_trace is True - if v and values.get("stream", False): + def validate_stream_and_trace(cls, v, info: ValidationInfo): + """Disallow include_trace together with stream=True. + + Pydantic v2 passes a ValidationInfo object rather than the old *values* dict. + We can access already-validated fields via ``info.data``. + """ + if v and info.data.get("stream", False): raise ValueError("Streaming is not supported when include_trace=True") return v