|
15 | 15 | import java.util.List; |
16 | 16 | import java.util.function.Function; |
17 | 17 |
|
| 18 | +import org.springframework.ai.tool.annotation.ToolParam; |
| 19 | + |
18 | 20 | import com.fasterxml.jackson.annotation.JsonClassDescription; |
19 | 21 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
20 | 22 | import com.fasterxml.jackson.annotation.JsonInclude; |
|
24 | 26 |
|
25 | 27 | public interface OpenLibraryClient extends Function<OpenLibraryClient.Request, OpenLibraryClient.Response> { |
26 | 28 | @JsonIgnoreProperties(ignoreUnknown = true) |
27 | | - record Book(@JsonProperty(value= "author_name", required = false) List<String> authorName, |
28 | | - @JsonProperty(value= "language", required = false) List<String> languages, |
29 | | - @JsonProperty(value= "publish_date", required = false) List<String> publishDates, |
30 | | - @JsonProperty(value= "publisher", required = false) List<String> publishers, |
31 | | - String title, String type, |
32 | | - @JsonProperty(value= "subject", required = false) List<String> subjects, |
33 | | - @JsonProperty(value= "place", required = false) List<String> places, |
34 | | - @JsonProperty(value= "time", required = false) List<String> times, |
35 | | - @JsonProperty(value= "person", required = false) List<String> persons, |
36 | | - @JsonProperty(value= "ratings_average", required = false) Double ratingsAverage) {} |
| 29 | + record Book(@JsonProperty(value = "author_name", required = false) List<String> authorName, |
| 30 | + @JsonProperty(value = "language", required = false) List<String> languages, |
| 31 | + @JsonProperty(value = "publish_date", required = false) List<String> publishDates, |
| 32 | + @JsonProperty(value = "publisher", required = false) List<String> publishers, String title, String type, |
| 33 | + @JsonProperty(value = "subject", required = false) List<String> subjects, |
| 34 | + @JsonProperty(value = "place", required = false) List<String> places, |
| 35 | + @JsonProperty(value = "time", required = false) List<String> times, |
| 36 | + @JsonProperty(value = "person", required = false) List<String> persons, |
| 37 | + @JsonProperty(value = "ratings_average", required = false) Double ratingsAverage) { |
| 38 | + } |
| 39 | + |
37 | 40 | @JsonInclude(Include.NON_NULL) |
38 | 41 | @JsonClassDescription("OpenLibrary API request") |
39 | | - record Request(@JsonProperty(required=false, value="author") @JsonPropertyDescription("The book author") String author, |
40 | | - @JsonProperty(required=false, value="title") @JsonPropertyDescription("The book title") String title, |
41 | | - @JsonProperty(required=false, value="subject") @JsonPropertyDescription("The book subject") String subject) {} |
| 42 | + record Request( |
| 43 | + @JsonProperty(required = false, value = "author") @ToolParam(description = "The book authors name") |
| 44 | + @JsonPropertyDescription("The book authors name") String author, |
| 45 | + @JsonProperty(required = false, value = "title") @ToolParam(description = "The book title") |
| 46 | + @JsonPropertyDescription("The book title") String title, |
| 47 | + @JsonProperty(required = false, value = "subject") @ToolParam(description = "The book subject") |
| 48 | + @JsonPropertyDescription("The book subject") String subject) { |
| 49 | + } |
| 50 | + |
42 | 51 | @JsonIgnoreProperties(ignoreUnknown = true) |
43 | | - record Response(Long numFound, Long start, Boolean numFoundExact, List<Book> docs) {} |
| 52 | + record Response(Long numFound, Long start, Boolean numFoundExact, List<Book> docs) { |
| 53 | + } |
44 | 54 | } |
0 commit comments