Skip to content

Mistral models do not work in Temporal workers using PydanticAIPlugin #3117

@slumbi

Description

@slumbi

Initial Checks

Description

When using Mistral models, which internally imports httpcore module, we have errors inside the Ttemporal worker, PydanticAIPlugin does not allow httpcore package to pass through and we have a strange exception.

I am trying to run this example repo

Resolution

Adding Either httpcore or anyio to the runner.restrictions.with_passthrough_modules method call arguments in PydanticAIPlugin class solves the problem. I am not sure what is the best fix for this .

Example Code

Python, Pydantic AI & LLM client version

mistralai                                1.9.10

pydantic                                 2.11.7
pydantic-ai                              1.0.2
pydantic-ai-slim                         1.0.2
pydantic-core                            2.33.2
pydantic-evals                           1.0.2
pydantic-graph                           1.0.2
pydantic-settings                        2.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions