Skip to content

Commit

Permalink
Upgrade to DALL-3 API
Browse files Browse the repository at this point in the history
  • Loading branch information
jschm42 committed Nov 7, 2023
1 parent e4af01f commit 18ef7d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public PersonaImageUploadResponse uploadImage(MultipartFile file) {
}

public GenerateImageResponse generateImage(String prompt) throws IOException {
OpenAIImageRequest request = new OpenAIImageRequest(prompt, 1, "256x256");
OpenAIImageRequest request = new OpenAIImageRequest(prompt, 1, "1024x1024");
OpenAIImageResponse response = openAIImageService.submit(request);

return new GenerateImageResponse(downloadImage(response.data().get(0).url()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@

package com.talkforgeai.service.openai.dto;

public record OpenAIImageRequest(String prompt, int n, String size) {
public record OpenAIImageRequest(String prompt, int n, String size, String model) {
public OpenAIImageRequest(String prompt, int n, String size) {
this(prompt, n, size, "dall-e-3");
}

public OpenAIImageRequest(String prompt) {
this(prompt, 2, "512x512");
this(prompt, 1, "1024x1024", "dall-e-3");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
public record OpenAIImageResponse(Date created, List<ImageData> data) {

public record ImageData(String url,
@JsonProperty("revised_prompt")
String revisedPrompt,
@JsonProperty("b64_json") String b64Json) {
}
}

0 comments on commit 18ef7d0

Please sign in to comment.