Skip to content

Commit

Permalink
Merge pull request #68 from nobodyiam/fix-tool-call-file-search-issue
Browse files Browse the repository at this point in the history
add ToolCallFileSearch class to hold the file search results
  • Loading branch information
Lambdua authored Oct 8, 2024
2 parents efbba5d + dc5ec51 commit 1ac8826
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ToolCall {
* For now, this is always going to be an empty object.
*/
@JsonProperty("file_search")
Map<String, String> fileSearch;
ToolCallFileSearch fileSearch;

ToolCallFunction function;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.theokanning.openai.assistants.run;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.theokanning.openai.assistants.assistant.FileSearchRankingOptions;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ToolCallFileSearch {
/**
* The ranking options for the file search.
*/
@JsonProperty("ranking_options")
private FileSearchRankingOptions rankingOptions;

/**
* The results of the file search.
*/
private List<ToolCallFileSearchResult> results;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.theokanning.openai.assistants.run;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ToolCallFileSearchResult {
/**
* The ID of the file that result was found in.
*/
@JsonProperty("file_id")
private String fileId;

/**
* The name of the file that result was found in.
*/
@JsonProperty("file_name")
private String fileName;

/**
* The score of the result. All values must be a floating point number between 0 and 1.
*/
private Double score;

/**
* The content of the result that was found. The content is only included if requested via the include query parameter.
*/
private List<ToolCallFileSearchResultContent> content;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.theokanning.openai.assistants.run;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ToolCallFileSearchResultContent {
/**
* The type of the content.
*/
private String type;

/**
* The text content of the file.
*/
private String text;
}

0 comments on commit 1ac8826

Please sign in to comment.