Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

fix(assistant-run): run ans run-step #408

Merged
merged 1 commit into from
Nov 16, 2023
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
24 changes: 24 additions & 0 deletions api/src/main/java/com/theokanning/openai/common/LastError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.theokanning.openai.common;

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

/**
* @description:
* @author: vacuity
* @create: 2023-11-16 22:27
**/


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LastError {

private String code;

private String message;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.theokanning.openai.runs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.theokanning.openai.assistants.Tool;
import com.theokanning.openai.threads.ThreadRequest;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
* @description:
* @author: vacuity
* @create: 2023-11-16 23:08
**/


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateThreadAndRunRequest {

@JsonProperty("assistant_id")
private String assistantId;

private ThreadRequest thread;

private String model;

private String instructions;

private List<Tool> tools;

private Map<String, String> metadata;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class MessageCreation {

@JsonProperty("message_id")
String messageId;
}
26 changes: 26 additions & 0 deletions api/src/main/java/com/theokanning/openai/runs/RequiredAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.theokanning.openai.runs;

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

/**
* @description:
* @author: vacuity
* @create: 2023-11-16 22:44
**/


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RequiredAction {

private String type;

@JsonProperty("submit_tool_outputs")
private SubmitToolOutputs submitToolOutputs;
}
69 changes: 45 additions & 24 deletions api/src/main/java/com/theokanning/openai/runs/Run.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.theokanning.openai.runs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.theokanning.openai.assistants.Tool;
import com.theokanning.openai.common.LastError;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -9,37 +11,56 @@
import java.util.List;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Run {

@JsonProperty("assistant_id")
String assistantId;
@JsonProperty("cancelled_at")
Long cancelledAt;
@JsonProperty("completed_at")
Long completedAt;
private String id;

private String object;

@JsonProperty("created_at")
Long createdAt;
private Integer createdAt;

@JsonProperty("thread_id")
private String threadId;

@JsonProperty("assistant_id")
private String assistantId;

private String status;

@JsonProperty("required_action")
private RequiredAction requiredAction;

@JsonProperty("last_error")
private LastError lastError;

@JsonProperty("expires_at")
Long expiresAt;
private Integer expiresAt;

@JsonProperty("started_at")
private Integer startedAt;

@JsonProperty("cancelled_at")
private Integer cancelledAt;

@JsonProperty("failed_at")
Long failedAt;
private Integer failedAt;

@JsonProperty("completed_at")
private Integer completedAt;

private String model;

private String instructions;

private List<Tool> tools;

@JsonProperty("file_ids")
List<String> fileIds;
String id;
String instructions;
@JsonProperty("last_error")
String lastError;
Map<String, String> metadata;
String model;
String object;
@JsonProperty("started_at")
Long startedAt;
String status;
@JsonProperty("thread_id")
String threadId;
List<Tool> tools;
private List<String> fileIds;

private Map<String, String> metadata;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.theokanning.openai.runs;

import com.theokanning.openai.assistants.Tool;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -17,7 +18,10 @@ public class RunCreateRequest {

// Optional
String model;

String instructions;

List<Tool> tools;

Map<String, String> metadata;
}
24 changes: 24 additions & 0 deletions api/src/main/java/com/theokanning/openai/runs/RunImage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.theokanning.openai.runs;

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

/**
* @description:
* @author: vacuity
* @create: 2023-11-16 22:33
**/


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RunImage {

@JsonProperty("file_id")
private String fileId;
}
61 changes: 40 additions & 21 deletions api/src/main/java/com/theokanning/openai/runs/RunStep.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,58 @@
package com.theokanning.openai.runs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.theokanning.openai.common.LastError;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class RunStep {

@JsonProperty("assistant_id")
String assistantId;
@JsonProperty("canelled_at")
Long cancelledAt;
@JsonProperty("completed_at")
Long completedAt;
private String id;

private String object;

@JsonProperty("created_at")
Long createdAt;
@JsonProperty("expired_at")
Long expiredAt;
@JsonProperty("failed_at")
Long failedAt;
String id;
@JsonProperty("last_error")
String lastError;
String object;
private Integer createdAt;

@JsonProperty("assistant_id")
private String assistantId;

@JsonProperty("thread_id")
private String threadId;

@JsonProperty("run_id")
String runId;
String status;
private String runId;

private String type;

private String status;

@JsonProperty("step_details")
StepDetails stepDetails;
@JsonProperty("thread_id")
String threadId;
String type;
private StepDetails stepDetails;

@JsonProperty("last_error")
private LastError lastError;

@JsonProperty("expired_at")
private Integer expiredAt;

@JsonProperty("cancelled_at")
private Integer cancelledAt;

@JsonProperty("failed_at")
private Integer failedAt;

@JsonProperty("completed_at")
private Integer completedAt;

private Map<String, String> metadata;

}
17 changes: 0 additions & 17 deletions api/src/main/java/com/theokanning/openai/runs/RunSteps.java

This file was deleted.

17 changes: 0 additions & 17 deletions api/src/main/java/com/theokanning/openai/runs/Runs.java

This file was deleted.

13 changes: 10 additions & 3 deletions api/src/main/java/com/theokanning/openai/runs/StepDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class StepDetails {


private String type;

@JsonProperty("message_creation")
MessageCreation messageCreation;
String type;
private MessageCreation messageCreation;

@JsonProperty("tool_calls")
private List<ToolCall> toolCalls;
}
Loading