@Test
public void test(){
AssistantResponse assistant = openAiClient.assistant(Assistant.builder()
.model("gpt-4-1106-preview")
.name("Math Tutor")
.instructions("You are a personal math tutor. Write and run code to answer math questions.")
.tools(Arrays.asList(
Tool.builder().type("code_interpreter").build()
)).build());
ThreadResponse thread = openAiClient.thread(Thread.builder().messages(Arrays.asList(
ThreadMessage.builder().role(ThreadMessage.Role.USER.getName())
.content("I need to solve the equation 3(x-1) + 11+x = 14. Can you help me?").build()
)).build());
String threadId = thread.getId();
RunResponse run = openAiClient.run(threadId, Run.builder().assistantId(assistant.getId()).build());
@Test public void test(){ AssistantResponse assistant = openAiClient.assistant(Assistant.builder() .model("gpt-4-1106-preview") .name("Math Tutor") .instructions("You are a personal math tutor. Write and run code to answer math questions.") .tools(Arrays.asList( Tool.builder().type("code_interpreter").build() )).build()); ThreadResponse thread = openAiClient.thread(Thread.builder().messages(Arrays.asList( ThreadMessage.builder().role(ThreadMessage.Role.USER.getName()) .content("I need to solve the equation
3(x-1) + 11+x = 14
. Can you help me?").build() )).build()); String threadId = thread.getId(); RunResponse run = openAiClient.run(threadId, Run.builder().assistantId(assistant.getId()).build());