From 5f05d43c3e0ca7249c63fcf292a50e887f89673c Mon Sep 17 00:00:00 2001 From: Thomas Vitale Date: Tue, 14 May 2024 07:46:27 +0200 Subject: [PATCH] Cleanup Signed-off-by: Thomas Vitale --- .../com/thomasvitale/ai/spring/ChatController.java | 5 ----- .../java/com/thomasvitale/ai/spring/ChatService.java | 12 +----------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatController.java b/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatController.java index 56d013a..b71932f 100644 --- a/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatController.java +++ b/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatController.java @@ -25,9 +25,4 @@ String chatFromImageUrl(@RequestParam(defaultValue = "What do you see in this pi return chatService.chatFromImageUrl(message); } - @GetMapping("/chat/audio/file") - String chatFromAudioFile(@RequestParam(defaultValue = "Who's the artist who sang this song? Give a short answer") String message) throws IOException { - return chatService.chatFromAudioFile(message); - } - } diff --git a/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatService.java b/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatService.java index 82e9d54..7c0625d 100644 --- a/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatService.java +++ b/02-prompts/prompts-multimodality-openai/src/main/java/com/thomasvitale/ai/spring/ChatService.java @@ -18,12 +18,9 @@ class ChatService { private final Resource image; - private final Resource audio; - - ChatService(ChatClient chatClient, @Value("classpath:tabby-cat.png") Resource image, @Value("classpath:speech.mp3") Resource audio) { + ChatService(ChatClient chatClient, @Value("classpath:tabby-cat.png") Resource image) { this.chatClient = chatClient; this.image = image; - this.audio = audio; } String chatFromImageFile(String message) throws IOException { @@ -40,11 +37,4 @@ String chatFromImageUrl(String message) { return chatClient.call(userMessage); } - String chatFromAudioFile(String message) throws IOException { - var audioData = audio.getContentAsByteArray(); - var userMessage = new UserMessage(message, - List.of(new Media(MimeTypeUtils.parseMimeType("audio/mpeg"), audioData))); - return chatClient.call(userMessage); - } - }