|
1 | | -///* |
2 | | -// * MIT License |
3 | | -// * |
4 | | -// * Copyright (c) 2023. Artyom Nefedov |
5 | | -// * |
6 | | -// * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | -// * of this software and associated documentation files (the "Software"), to deal |
8 | | -// * in the Software without restriction, including without limitation the rights |
9 | | -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | -// * copies of the Software, and to permit persons to whom the Software is |
11 | | -// * furnished to do so, subject to the following conditions: |
12 | | -// * |
13 | | -// * The above copyright notice and this permission notice shall be included in all |
14 | | -// * copies or substantial portions of the Software. |
15 | | -// * |
16 | | -// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | | -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | | -// * SOFTWARE. |
23 | | -// */ |
24 | | -// |
25 | | -//package io.github.artemnefedov.javaai.service; |
26 | | -// |
27 | | -//import io.github.artemnefedov.javaai.dto.ChatMessage; |
28 | | -//import io.github.artemnefedov.javaai.dto.Chat; |
29 | | -//import io.github.artemnefedov.javaai.dto.Completions; |
30 | | -// |
31 | | -//import java.util.List; |
32 | | -// |
33 | | -///** |
34 | | -// * The main class for interacting with JavaAI implements the {@link JavaAI} interface. |
35 | | -// */ |
36 | | -//public interface JavaAI { |
37 | | -// |
38 | | -// /** |
39 | | -// * The method that generates the text interacts with the |
40 | | -// * <a href="https://platform.openai.com/docs/api-reference/completions">Completions</a>. |
41 | | -// * |
42 | | -// * @param prompt parameters for text generation. |
43 | | -// * @return the response from the API as a string |
44 | | -// */ |
45 | | -// String generateText(String prompt); |
46 | | -// |
47 | | -// /** |
48 | | -// * The method that generates the image interacts with the |
49 | | -// * <a href="https://platform.openai.com/docs/api-reference/images/create">Create image</a>. |
50 | | -// * |
51 | | -// * @param prompt parameters for image generation. |
52 | | -// * @return the response from the API as a string(url) |
53 | | -// */ |
54 | | -// String generateImage(String prompt); |
55 | | -// |
56 | | -// /** |
57 | | -// * The method that generates text, taking into account chat messages, |
58 | | -// * uses a <a href="https://platform.openai.com/docs/api-reference/chat">Chat</a>. |
59 | | -// * |
60 | | -// * @param messages List of {@link ChatMessage} containing your chat by role. |
61 | | -// * @return the response from the API as a string |
62 | | -// */ |
63 | | -// String chat(List<ChatMessage> messages); |
64 | | -// |
65 | | -// /** |
66 | | -// * The method that generates text, taking into account chat messages, |
67 | | -// * uses a <a href="https://platform.openai.com/docs/api-reference/chat">Chat</a>. |
68 | | -// * |
69 | | -// * @param userMessage your message with the user role. |
70 | | -// * @return the response from the API as a string |
71 | | -// */ |
72 | | -// String chat(String userMessage); |
73 | | -// |
74 | | -// /** |
75 | | -// * Sets your dto to work with the API |
76 | | -// * @param completions dto with your options. |
77 | | -// */ |
78 | | -// void setCompletions(Completions completions); |
79 | | -// |
80 | | -// /** |
81 | | -// * Sets your dto to work with the API |
82 | | -// * |
83 | | -// * @param chat dto with your options. |
84 | | -// */ |
85 | | -// void setChat(Chat chat); |
86 | | -// |
87 | | -// /** |
88 | | -// * Sets default options for dto, usually this should be enough to get the job done. |
89 | | -// */ |
90 | | -// void defaultCompetitionsConfig(); |
91 | | -// |
92 | | -// /** |
93 | | -// * Sets default options for dto, usually this should be enough to get the job done. |
94 | | -// */ |
95 | | -// void defaultChatConfig(); |
96 | | -//} |
| 1 | +/* |
| 2 | + * MIT License |
| 3 | + * |
| 4 | + * Copyright (c) 2023. Artyom Nefedov |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in all |
| 14 | + * copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | + * SOFTWARE. |
| 23 | + */ |
| 24 | + |
| 25 | +package io.github.artemnefedov.javaai.service; |
| 26 | + |
| 27 | +import io.github.artemnefedov.javaai.dto.ChatMessage; |
| 28 | +import io.github.artemnefedov.javaai.dto.Chat; |
| 29 | +import io.github.artemnefedov.javaai.dto.Completions; |
| 30 | + |
| 31 | +import java.util.List; |
| 32 | + |
| 33 | +/** |
| 34 | + * The main class for interacting with JavaAI implements the {@link JavaAI} interface. |
| 35 | + */ |
| 36 | +public interface JavaAI { |
| 37 | + |
| 38 | + /** |
| 39 | + * The method that generates the text interacts with the |
| 40 | + * <a href="https://platform.openai.com/docs/api-reference/completions">Completions</a>. |
| 41 | + * |
| 42 | + * @param prompt parameters for text generation. |
| 43 | + * @return the response from the API as a string |
| 44 | + */ |
| 45 | + String generateText(String prompt); |
| 46 | + |
| 47 | + /** |
| 48 | + * The method that generates the image interacts with the |
| 49 | + * <a href="https://platform.openai.com/docs/api-reference/images/create">Create image</a>. |
| 50 | + * |
| 51 | + * @param prompt parameters for image generation. |
| 52 | + * @return the response from the API as a string(url) |
| 53 | + */ |
| 54 | + String generateImage(String prompt); |
| 55 | + |
| 56 | + /** |
| 57 | + * The method that generates text, taking into account chat messages, |
| 58 | + * uses a <a href="https://platform.openai.com/docs/api-reference/chat">Chat</a>. |
| 59 | + * |
| 60 | + * @param messages List of {@link ChatMessage} containing your chat by role. |
| 61 | + * @return the response from the API as a string |
| 62 | + */ |
| 63 | + String chat(List<ChatMessage> messages); |
| 64 | + |
| 65 | + /** |
| 66 | + * The method that generates text, taking into account chat messages, |
| 67 | + * uses a <a href="https://platform.openai.com/docs/api-reference/chat">Chat</a>. |
| 68 | + * |
| 69 | + * @param userMessage your message with the user role. |
| 70 | + * @return the response from the API as a string |
| 71 | + */ |
| 72 | + String chat(String userMessage); |
| 73 | + |
| 74 | + /** |
| 75 | + * Sets your dto to work with the API |
| 76 | + * @param completions dto with your options. |
| 77 | + */ |
| 78 | + void setCompletions(Completions completions); |
| 79 | + |
| 80 | + /** |
| 81 | + * Sets your dto to work with the API |
| 82 | + * |
| 83 | + * @param chat dto with your options. |
| 84 | + */ |
| 85 | + void setChat(Chat chat); |
| 86 | + |
| 87 | + /** |
| 88 | + * Sets default options for dto, usually this should be enough to get the job done. |
| 89 | + */ |
| 90 | + void defaultCompetitionsConfig(); |
| 91 | + |
| 92 | + /** |
| 93 | + * Sets default options for dto, usually this should be enough to get the job done. |
| 94 | + */ |
| 95 | + void defaultChatConfig(); |
| 96 | +} |
0 commit comments