You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: improve documentation for function callback and tool context
- Add cross-references to tool context documentation section
- Enhance BiFunction section title and description
- Improve readability and consistency of function callback documentation
==== BiFunction<I, ToolContext, O> with ToolContext
42
+
==== BiFunction<I, ToolContext, O>
43
+
44
+
Using Function with input type <I> and additional xref:api/functions.adoc#Tool-Context[ToolContext] parameter:
43
45
44
46
[source,java]
45
47
----
@@ -113,7 +115,7 @@ The method invoking implements the `FunctionCallback` interface and provides:
113
115
- Support for both static and instance methods
114
116
- Any number of parameters (including none) and return values (including void)
115
117
- Any parameter/return types (primitives, objects, collections)
116
-
- Special handling for `ToolContext` parameters
118
+
- Special handling for xref:api/functions.adoc#Tool-Context[ToolContext] parameters
117
119
118
120
==== Static Method Invocation
119
121
@@ -231,7 +233,7 @@ FunctionCallback.builder()
231
233
232
234
=== Tool Context Usage
233
235
234
-
* Use ToolContext when additional state or context is required that is provided from the User and not part of the function input generated by the AI model.
236
+
* Use xref:api/functions.adoc#Tool-Context[ToolContext] when additional state or context is required that is provided from the User and not part of the function input generated by the AI model.
235
237
* Use `BiFunction<I, ToolContext, O>` to access the ToolContext in the function invocation approach and add `ToolContext` parameter in the method invoking approach.
The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/client/OpenAiChatClientMethodInvokingFunctionCallbackIT.java[OpenAiChatClientMethodInvokingFunctionCallbackIT]
379
379
integration test provides additional examples of how to use the FunctionCallback.Builder to create method invocation FunctionCallbacks.
380
380
381
+
[[Tool-Context]]
381
382
== Tool Context
382
383
383
384
Spring AI now supports passing additional contextual information to function callbacks through a tool context.
0 commit comments