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
Copy file name to clipboardExpand all lines: posts/2026-03-10-26.0.0.3-beta.adoc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ See also link:{url-prefix}/blog/?search=beta&key=tag[previous Open Liberty beta
38
38
39
39
When a client calls a tool, the object that is returned by the tool method is converted to a `ToolResponse`, which usually contains one or more `Content` objects. The `ToolResponse` maps directly to the result returned in the response.
40
40
41
-
If you need more control over the response from your tool, you can return a `ToolResponse` or `Content` object directly. Now it is also possible to register encoders to control how other objects are converted into a response.
41
+
If you need more control over the response from your tool, you can return a `ToolResponse` or `Content` object directly. Now, it is also possible to register encoders to control how other objects are converted into a response.
42
42
43
43
* Use `ToolResponseEncoder` to convert an object into a `ToolResponse`, which gives you complete control over the whole response.
44
44
* Use `ContentEncoder` when you only need to convert an object into a `Content` that is included in the response. You can also return a list of objects, and each object is individually converted into a `Content` and included in the response.
@@ -47,7 +47,7 @@ If a tool method returns an object for which no encoder is provided, JSON-B enco
47
47
48
48
=== Example
49
49
50
-
Consider a tool which does a search over some datastore:
50
+
Consider a tool that does a search over some datastore:
51
51
52
52
[source,java]
53
53
----
@@ -60,12 +60,12 @@ public SearchResult search(@ToolArg(name="query", description="the query to run"
60
60
61
61
In this scenario, the `SearchResult` object encapsulates a list of individual results. Each entry contains a summary, associated metadata, and a relevance score that indicates its relationship to the query.
62
62
63
-
By default, the `SearchResult` object that is returned is encoded as JSON by using JSON-B and placed into a `TextContent`. However, to return each search result summary as an individual `TextContent` and map the relevance score to a priority annotation, a `ToolResponseEncoder` is to be used
63
+
By default, the `SearchResult` object that is returned is encoded as JSON by using JSON-B and placed into a `TextContent`. However, to return each search result summary as an individual `TextContent` and map the relevance score to a priority annotation, a `ToolResponseEncoder` is to be used.
64
64
65
65
Create a CDI bean that implements the `ToolResponseEncoder` interface and implement:
66
66
67
67
* the `encode` method to create a `ToolResponse` from a `SearchResult`
68
-
* the `supports` method to indicate that your encoder can be used for any `SearchResult`.
68
+
* the `supports` method to indicate that your encoder can be used for any `SearchResult`
* Output schemas were not generated correctly for asynchronous tool methods which have `structuredContent = true`
130
-
* Omitting the `arguments` object when calling a tool would result in an error. The `arguments` object is optional if the tool does not require any arguments.
130
+
* Omitting the `arguments` object when calling a tool would result in an error. The `arguments` object is optional if the tool does not require any arguments
0 commit comments