shahshi15
shahshi15

Reputation: 2987

CallAroundAdvisor does not advise (wrap) around recursive, internal model calls

Scenario: I am trying write a request / response logger advisor since SimpleLoggingAdvisor does not log tool invocation and observation. As I implemented the CallAroundAdvisor, I stumbled upon the same problem as I am guessing the SimpleLoggingAdvisor had which is it only advises around the "call" of chatclient and not the ChatModel Line 287 in the screenshot below.

Line 287 is what, I am guessing, does the tool execution

Couple of side effects of this:

  1. the toolCalls object under the AssistantMessage is always empty [Generation[assistantMessage=AssistantMessage [messageType=ASSISTANT, toolCalls=[]
  2. There is no way to debug the actual request / response coming from openAI.
  3. Not exactly sure if there's any other way to add advises that wrap around the ChatModel.

I am porting over from langchain4j and the first difference I realized is how langchain4j logs every request / response, including tool chain calls but by default spring-ai only logs the user message and the final assistant message.

Also the inMemoryChatMemory has a similar problem where tool chain calls are NOT added to the history. Maybe that's a separate problem and potentially the tool chain should have it's own memory for debugging.

Upvotes: 0

Views: 16

Answers (0)

Related Questions