Skip to content

Commit

Permalink
Assistant fixed (TheoKanning#414)
Browse files Browse the repository at this point in the history
* fix(assistant-run): run ans run-step

* fix(run and run-step): fix the list method

---------

Co-authored-by: Theo Kanning <TheoKanning@users.noreply.github.com>
  • Loading branch information
vacuityv and TheoKanning authored Nov 21, 2023
1 parent decc9fd commit 2195b2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ public interface OpenAiApi {

@Headers("OpenAI-Beta: assistants=v1")
@GET("/v1/threads/{thread_id}/runs")
Single<OpenAiResponse<Run>> listRuns(@Path("thread_id") String threadId, @Body ListSearchParameters listSearchParameters);
Single<OpenAiResponse<Run>> listRuns(@Path("thread_id") String threadId, @QueryMap Map<String, String> listSearchParameters);


@Headers("OpenAI-Beta: assistants=v1")
@POST("/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputs")
Expand All @@ -319,5 +320,5 @@ public interface OpenAiApi {

@Headers("OpenAI-Beta: assistants=v1")
@GET("/v1/threads/{thread_id}/runs/{run_id}/steps")
Single<OpenAiResponse<RunStep>> listRunSteps(@Path("thread_id") String threadId, @Path("run_id") String runId, @Body ListSearchParameters listSearchParameters);
Single<OpenAiResponse<RunStep>> listRunSteps(@Path("thread_id") String threadId, @Path("run_id") String runId, @QueryMap Map<String, String> listSearchParameters);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -471,7 +472,12 @@ public Run modifyRun(String threadId, String runId, Map<String, String> metadata
}

public OpenAiResponse<Run> listRuns(String threadId, ListSearchParameters listSearchParameters) {
return execute(api.listRuns(threadId, listSearchParameters));
Map<String, String> 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) {
Expand All @@ -491,7 +497,12 @@ public RunStep retrieveRunStep(String threadId, String runId, String stepId) {
}

public OpenAiResponse<RunStep> listRunSteps(String threadId, String runId, ListSearchParameters listSearchParameters) {
return execute(api.listRunSteps(threadId, runId, listSearchParameters));
Map<String, String> search = new HashMap<>();
if (listSearchParameters != null) {
ObjectMapper mapper = defaultObjectMapper();
search = mapper.convertValue(listSearchParameters, Map.class);
}
return execute(api.listRunSteps(threadId, runId, search));
}

/**
Expand Down

0 comments on commit 2195b2a

Please sign in to comment.