Skip to content

Update _pydantic_helper.py#218

Closed
LenenaIker wants to merge 1 commit intomistralai:mainfrom
LenenaIker:patch-1
Closed

Update _pydantic_helper.py#218
LenenaIker wants to merge 1 commit intomistralai:mainfrom
LenenaIker:patch-1

Conversation

@LenenaIker
Copy link

This function was giving me an error when using Pydantic objects with Mistral.

Now is working properly.

This function was giving me an error when using Pydantic objects with Mistral.

Now is working properly.
@amenasria
Copy link
Contributor

Hey @LenenaIker, thanks for opening a PR !

Could you please provide us the code that gave you the error ?

Your fix makes sense but it would be nice for us to be able to understand what happened !

@LenenaIker
Copy link
Author

Hello Amenasria,
Here you have:
MistralGitHub.json
MistralGitHub.txt

I can't send all the code, but I hope this helps.
I'm generating the objects dynamically so I can change the context descriptions based on the input language.

I do this because if the input is short or is in a language similar but not the same as the context, the AI ​​usually fails, writing the response in the language of the context. For example it happens to me with Spanish, Italian and Portuguese.

Have a nice day!
Iker Leñena.

@amenasria
Copy link
Contributor

Hey Iker, I was able to understand the issue thanks to your example, nice catch !

I went for a slightly different solution since the rec_strict_json_schema is recursively re-building the schema (so I need to return the node, not just pass), see #219.

Thanks again for reporting, have a nice day !
Alex.

@LenenaIker
Copy link
Author

Okay, great!

Have a nice day!

@LenenaIker LenenaIker closed this May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants