Skip to content

Commit fd6656d

Browse files
committed
Cache the model serde
1 parent 0d7e419 commit fd6656d

File tree

1 file changed

+3
-1
lines changed
  • pydantic_ai_slim/pydantic_ai/durable_exec/restate

1 file changed

+3
-1
lines changed

pydantic_ai_slim/pydantic_ai/durable_exec/restate/_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
from pydantic_ai.models import Model
88
from pydantic_ai.models.wrapper import WrapperModel
99

10+
MODEL_RESPONSE_SERDE = PydanticTypeAdapter(ModelResponse)
11+
1012

1113
class RestateModelWrapper(WrapperModel):
1214
def __init__(self, wrapped: Model, context: Context, max_attempts: int | None = None):
1315
super().__init__(wrapped)
14-
self.options = RunOptions[ModelResponse](serde=PydanticTypeAdapter(ModelResponse), max_attempts=max_attempts)
16+
self.options = RunOptions(serde=MODEL_RESPONSE_SERDE, max_attempts=max_attempts)
1517
self.context = context
1618

1719
async def request(self, *args: Any, **kwargs: Any) -> ModelResponse:

0 commit comments

Comments
 (0)