diff --git a/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java b/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java index 5bf3e732..2a0ea1a6 100644 --- a/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java +++ b/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java @@ -298,7 +298,8 @@ public interface OpenAiApi { @Headers("OpenAI-Beta: assistants=v1") @GET("/v1/threads/{thread_id}/runs") - Single> listRuns(@Path("thread_id") String threadId, @Body ListSearchParameters listSearchParameters); + Single> listRuns(@Path("thread_id") String threadId, @QueryMap Map listSearchParameters); + @Headers("OpenAI-Beta: assistants=v1") @POST("/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputs") @@ -319,5 +320,5 @@ public interface OpenAiApi { @Headers("OpenAI-Beta: assistants=v1") @GET("/v1/threads/{thread_id}/runs/{run_id}/steps") - Single> listRunSteps(@Path("thread_id") String threadId, @Path("run_id") String runId, @Body ListSearchParameters listSearchParameters); + Single> listRunSteps(@Path("thread_id") String threadId, @Path("run_id") String runId, @QueryMap Map listSearchParameters); } diff --git a/service/src/main/java/com/theokanning/openai/service/OpenAiService.java b/service/src/main/java/com/theokanning/openai/service/OpenAiService.java index 09680304..ee63c419 100644 --- a/service/src/main/java/com/theokanning/openai/service/OpenAiService.java +++ b/service/src/main/java/com/theokanning/openai/service/OpenAiService.java @@ -59,6 +59,7 @@ import java.io.IOException; import java.time.Duration; import java.time.LocalDate; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -471,7 +472,12 @@ public Run modifyRun(String threadId, String runId, Map metadata } public OpenAiResponse listRuns(String threadId, ListSearchParameters listSearchParameters) { - return execute(api.listRuns(threadId, listSearchParameters)); + Map search = new HashMap<>(); + if (listSearchParameters != null) { + ObjectMapper mapper = defaultObjectMapper(); + search = mapper.convertValue(listSearchParameters, Map.class); + } + return execute(api.listRuns(threadId, search)); } public Run submitToolOutputs(String threadId, String runId, SubmitToolOutputsRequest submitToolOutputsRequest) { @@ -491,7 +497,12 @@ public RunStep retrieveRunStep(String threadId, String runId, String stepId) { } public OpenAiResponse listRunSteps(String threadId, String runId, ListSearchParameters listSearchParameters) { - return execute(api.listRunSteps(threadId, runId, listSearchParameters)); + Map search = new HashMap<>(); + if (listSearchParameters != null) { + ObjectMapper mapper = defaultObjectMapper(); + search = mapper.convertValue(listSearchParameters, Map.class); + } + return execute(api.listRunSteps(threadId, runId, search)); } /**