Description
In the latest updates of SpringAI the tools approach has been changed and now I can define context dependent tools (tools with context available only on invocation) as a default tools during chat client creation. To provide context on a call I can use toolContext
method:
ChatResponse response = chatClient.prompt(new Prompt(message))
.toolContext(Map.of("foo", foo))
.call().chatResponse();
But we doesn't have the same for the advisors. In case of advisor is a context dependent we have no choice but to create it on a per call basis passing the context via the constructor:
ChatResponse response = chatClient.prompt(new Prompt(message))
.advisors(new FooAdvisor(foo))
.call().chatResponse();
That would be nice to provide a method advisorContext
similar to toolContext
to be able to pass some context related data to the advisors as well. This method can be used to prepopulate context of the ChatClientRequest
to make this data available in the advisor, or alternatively can be passed as an additional external context parameter to the advisors methods.