spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.32k stars 850 forks source link

Refactor: Replace instanceof checks and switch expression #1754

Open delvering17 opened 3 days ago

delvering17 commented 3 days ago

I refactored some code to improve readability:

jitokim commented 3 days ago

you could include your name in the "author" field.
also, adding test cases to verify the functionality would make it even better. (its already written. i have checked.) 👍

btw, a similar logic exists in BedrockProxyChatModel

delvering17 commented 2 days ago

Thank you for the feedback!

I also refactored the BedrockProxyChatModel. There was an unnecessary instanceof check, so I removed it. Additionally, I updated the previously refactored OpenAiChatModel to use swtich expression instead of switch-case statement.