i-dot-ai / redbox

Bringing Generative AI to the way the Civil Service works
https://i-dot-ai.github.io/redbox/
MIT License
93 stars 31 forks source link

Bugfix/ai settings type validation #907

Closed jamesrichards4 closed 2 months ago

jamesrichards4 commented 2 months ago

Context

We get validation errors when trying to set AISettings in a request to core-api. All responses use the chat prompts so we never use documents.

Changes proposed in this pull request

Drop all use of the pydantic v1 classes (models/chain.py) so we're just using pydantic v2 and all is well Added a switch in the chat_prompt template creation runnable to check what the route is and choose the prompts accordingly. This is pretty ugly and will be improved I'm sure but it fixes the bug for now

Things to check