这是indexloc提供的服务,不要输入任何密码
Skip to content

Max num results #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@
* @date 2024年04月18 13:36
**/

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

@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileSearchTool implements Tool {
final String type = "file_search";

/**
* The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive.
*/
@JsonProperty("max_num_results")
Integer maxNumResults;
}
3 changes: 2 additions & 1 deletion api/src/test/resources/assistants/Assistant.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
"tools": [
{
"type": "file_search"
"type": "file_search",
"max_num_results": 10
}
],
"tool_resources": {
Expand Down
3 changes: 2 additions & 1 deletion api/src/test/resources/assistants/AssistantRequest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "Math Tutor",
"tools": [
{
"type": "file_search"
"type": "file_search",
"max_num_results": 1
}
],
"tool_resources": {
Expand Down
2 changes: 1 addition & 1 deletion example/src/main/java/example/AssistantExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static void fileSearchExample() throws UnsupportedEncodingException {
.name("file search assistant")
.instructions("你是一个中国传统音乐教授,负责根据用户的需求解答问题")
//add file search tool to assistant
.tools(Collections.singletonList(new FileSearchTool()))
.tools(Collections.singletonList(new FileSearchTool(1)))
.temperature(0D)
.build();
Assistant assistant = service.createAssistant(assistantRequest);
Expand Down