File tree Expand file tree Collapse file tree 6 files changed +20
-9
lines changed
src/main/java/com/theokanning/openai Expand file tree Collapse file tree 6 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 66 <parent >
77 <groupId >top.bella</groupId >
88 <artifactId >openai-java</artifactId >
9- <version >0.23.57 </version >
9+ <version >0.23.58 </version >
1010 </parent >
1111 <packaging >jar</packaging >
1212 <artifactId >openai-api</artifactId >
Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ class Retrieval implements Tool {
8888 @ JsonInclude (JsonInclude .Include .NON_NULL )
8989 private Boolean inherit ;
9090
91+ @ JsonInclude (JsonInclude .Include .NON_NULL )
92+ @ JsonProperty ("file_ids" )
93+ private List <String > fileIds ;
94+
9195 public Retrieval () {
9296
9397 }
@@ -105,7 +109,9 @@ public String getType() {
105109 @ Override
106110 public ToolDefinition definition () {
107111 com .theokanning .openai .response .tool .definition .FileSearchTool fileSearchTool = new com .theokanning .openai .response .tool .definition .FileSearchTool ();
108- fileSearchTool .setDefaultMetadata (defaultMetadata );
112+ fileSearchTool .setVectorStoreIds (fileIds );
113+ fileSearchTool .setRankingOptions (new com .theokanning .openai .response .tool .definition .FileSearchTool .RankingOptions (null , defaultMetadata .getScore ()));
114+ fileSearchTool .setMaxNumResults (defaultMetadata .getTopK ());
109115 return fileSearchTool ;
110116 }
111117
Original file line number Diff line number Diff line change @@ -25,9 +25,6 @@ public class FileSearchTool implements ToolDefinition {
2525 */
2626 private String type = "file_search" ;
2727
28- @ JsonProperty ("default_metadata" )
29- private Tool .DefaultMetadata defaultMetadata = new Tool .DefaultMetadata ();
30-
3128 /**
3229 * Vector store IDs to search.
3330 */
@@ -54,7 +51,15 @@ public class FileSearchTool implements ToolDefinition {
5451 @ Override
5552 public Tool getRealTool () {
5653 Tool .Retrieval retrieval = new Tool .Retrieval ();
57- retrieval .setDefaultMetadata (defaultMetadata );
54+ Tool .DefaultMetadata metadata = new Tool .DefaultMetadata ();
55+ if (maxNumResults != null ) {
56+ metadata .setTopK (maxNumResults );
57+ }
58+ if (rankingOptions != null && rankingOptions .scoreThreshold != null ) {
59+ metadata .setScore (rankingOptions .scoreThreshold );
60+ }
61+ retrieval .setFileIds (vectorStoreIds );
62+ retrieval .setDefaultMetadata (metadata );
5863 return retrieval ;
5964 }
6065
Original file line number Diff line number Diff line change 66 <parent >
77 <groupId >top.bella</groupId >
88 <artifactId >openai-java</artifactId >
9- <version >0.23.57 </version >
9+ <version >0.23.58 </version >
1010 </parent >
1111 <packaging >jar</packaging >
1212
Original file line number Diff line number Diff line change 55
66 <groupId >top.bella</groupId >
77 <artifactId >openai-java</artifactId >
8- <version >0.23.57 </version >
8+ <version >0.23.58 </version >
99 <packaging >pom</packaging >
1010 <description >openai java 版本</description >
1111 <name >openai-java</name >
Original file line number Diff line number Diff line change 66 <parent >
77 <groupId >top.bella</groupId >
88 <artifactId >openai-java</artifactId >
9- <version >0.23.57 </version >
9+ <version >0.23.58 </version >
1010 </parent >
1111 <packaging >jar</packaging >
1212
You can’t perform that action at this time.
0 commit comments