|
1 | 1 | package dev.ai4j.openai4j; |
2 | 2 |
|
3 | | -import java.net.InetSocketAddress; |
4 | | -import java.net.Proxy; |
5 | | -import java.nio.file.Path; |
6 | | -import java.nio.file.Paths; |
7 | | -import java.time.Duration; |
8 | | -import java.util.HashMap; |
9 | | -import java.util.List; |
| 3 | +import static dev.ai4j.openai4j.LogLevel.DEBUG; |
10 | 4 |
|
11 | 5 | import dev.ai4j.openai4j.chat.ChatCompletionRequest; |
12 | 6 | import dev.ai4j.openai4j.chat.ChatCompletionResponse; |
|
21 | 15 | import dev.ai4j.openai4j.moderation.ModerationResult; |
22 | 16 | import dev.ai4j.openai4j.spi.OpenAiClientBuilderFactory; |
23 | 17 | import dev.ai4j.openai4j.spi.ServiceHelper; |
| 18 | +import java.net.InetSocketAddress; |
| 19 | +import java.net.Proxy; |
| 20 | +import java.nio.file.Path; |
| 21 | +import java.nio.file.Paths; |
| 22 | +import java.time.Duration; |
| 23 | +import java.util.HashMap; |
| 24 | +import java.util.List; |
24 | 25 | import java.util.Map; |
25 | 26 |
|
26 | | -import static dev.ai4j.openai4j.LogLevel.DEBUG; |
27 | | - |
28 | 27 | public abstract class OpenAiClient { |
29 | 28 |
|
30 | | - public abstract SyncOrAsyncOrStreaming<CompletionResponse> completion( |
31 | | - OpenAiClientContext clientContext, CompletionRequest request); |
32 | | - |
33 | | - public abstract SyncOrAsyncOrStreaming<String> completion(OpenAiClientContext clientContext, |
34 | | - String prompt); |
35 | | - |
36 | 29 | public SyncOrAsyncOrStreaming<CompletionResponse> completion(CompletionRequest request) { |
37 | 30 | return completion(new OpenAiClientContext(), request); |
38 | 31 | } |
39 | 32 |
|
| 33 | + public SyncOrAsyncOrStreaming<CompletionResponse> completion( |
| 34 | + OpenAiClientContext clientContext, CompletionRequest request) { |
| 35 | + throw new UnsupportedOperationException(); |
| 36 | + } |
| 37 | + |
40 | 38 | public SyncOrAsyncOrStreaming<String> completion(String prompt) { |
41 | 39 | return completion(new OpenAiClientContext(), prompt); |
42 | 40 | } |
43 | 41 |
|
| 42 | + public SyncOrAsyncOrStreaming<String> completion(OpenAiClientContext clientContext, |
| 43 | + String prompt) { |
| 44 | + throw new UnsupportedOperationException(); |
| 45 | + } |
| 46 | + |
44 | 47 | public SyncOrAsyncOrStreaming<ChatCompletionResponse> chatCompletion( |
45 | 48 | ChatCompletionRequest request) { |
46 | 49 | return chatCompletion(new OpenAiClientContext(), request); |
47 | 50 | } |
48 | 51 |
|
49 | | - public abstract SyncOrAsyncOrStreaming<ChatCompletionResponse> chatCompletion( |
| 52 | + public SyncOrAsyncOrStreaming<ChatCompletionResponse> chatCompletion( |
50 | 53 | OpenAiClientContext clientContext, |
51 | | - ChatCompletionRequest request); |
| 54 | + ChatCompletionRequest request) { |
| 55 | + throw new UnsupportedOperationException(); |
| 56 | + } |
52 | 57 |
|
53 | 58 | public SyncOrAsyncOrStreaming<String> chatCompletion(String userMessage) { |
54 | 59 | return chatCompletion(new OpenAiClientContext(), userMessage); |
55 | 60 | } |
56 | 61 |
|
57 | | - public abstract SyncOrAsyncOrStreaming<String> chatCompletion( |
| 62 | + public SyncOrAsyncOrStreaming<String> chatCompletion( |
58 | 63 | OpenAiClientContext clientContext, |
59 | | - String userMessage); |
| 64 | + String userMessage) { |
| 65 | + throw new UnsupportedOperationException(); |
| 66 | + } |
60 | 67 |
|
61 | 68 | public SyncOrAsync<EmbeddingResponse> embedding(EmbeddingRequest request) { |
62 | 69 | return embedding(new OpenAiClientContext(), request); |
63 | 70 | } |
64 | 71 |
|
65 | | - public abstract SyncOrAsync<EmbeddingResponse> embedding(OpenAiClientContext clientContext, |
66 | | - EmbeddingRequest request); |
| 72 | + public SyncOrAsync<EmbeddingResponse> embedding(OpenAiClientContext clientContext, |
| 73 | + EmbeddingRequest request) { |
| 74 | + throw new UnsupportedOperationException(); |
| 75 | + } |
67 | 76 |
|
68 | 77 | public SyncOrAsync<List<Float>> embedding(String input) { |
69 | 78 | return embedding(new OpenAiClientContext(), input); |
70 | 79 | } |
71 | 80 |
|
72 | | - public abstract SyncOrAsync<List<Float>> embedding(OpenAiClientContext clientContext, |
73 | | - String input); |
| 81 | + public SyncOrAsync<List<Float>> embedding(OpenAiClientContext clientContext, |
| 82 | + String input) { |
| 83 | + throw new UnsupportedOperationException(); |
| 84 | + } |
74 | 85 |
|
75 | 86 | public SyncOrAsync<ModerationResponse> moderation(ModerationRequest request) { |
76 | 87 | return moderation(new OpenAiClientContext(), request); |
77 | 88 | } |
78 | 89 |
|
79 | | - public abstract SyncOrAsync<ModerationResponse> moderation(OpenAiClientContext clientContext, |
80 | | - ModerationRequest request); |
| 90 | + public SyncOrAsync<ModerationResponse> moderation(OpenAiClientContext clientContext, |
| 91 | + ModerationRequest request) { |
| 92 | + throw new UnsupportedOperationException(); |
| 93 | + } |
81 | 94 |
|
82 | 95 | public SyncOrAsync<ModerationResult> moderation(String input) { |
83 | 96 | return moderation(new OpenAiClientContext(), input); |
84 | 97 | } |
85 | 98 |
|
86 | | - public abstract SyncOrAsync<ModerationResult> moderation(OpenAiClientContext clientContext, |
87 | | - String input); |
| 99 | + public SyncOrAsync<ModerationResult> moderation(OpenAiClientContext clientContext, |
| 100 | + String input) { |
| 101 | + throw new UnsupportedOperationException(); |
| 102 | + } |
88 | 103 |
|
89 | 104 | public SyncOrAsync<GenerateImagesResponse> imagesGeneration(GenerateImagesRequest request) { |
90 | 105 | return imagesGeneration(new OpenAiClientContext(), request); |
91 | 106 | } |
92 | 107 |
|
93 | | - public abstract SyncOrAsync<GenerateImagesResponse> imagesGeneration( |
| 108 | + public SyncOrAsync<GenerateImagesResponse> imagesGeneration( |
94 | 109 | OpenAiClientContext clientContext, |
95 | | - GenerateImagesRequest request); |
| 110 | + GenerateImagesRequest request) { |
| 111 | + throw new UnsupportedOperationException(); |
| 112 | + } |
96 | 113 |
|
97 | 114 | public abstract void shutdown(); |
98 | 115 |
|
|
0 commit comments