spring-projects / spring-ai

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

Create an AbstractChatModel class that adds logging of request and response. #909

Open markpollack opened 1 week ago

markpollack commented 1 week ago

debug log level should be sufficient. This needs to occur in a few places, in particular in the case of Flux, see DefaultCallPromptResponseSpec.doGetChatResponse and DefaultStreamPromptResponseSpec.doGetFluxChatResponse for implementation hints.

Change OpenAiChatModel to inherit from this abstract base class. Once that is reviewed and discussed, we can have a separate PR that would change all the other implementations of ChatModel to extend AbstractChatModel

ThomasVitale commented 1 week ago

I shared a few thoughts about this in https://github.com/spring-projects/spring-ai/issues/512#issuecomment-2185096414