Deprecated Client#completion and removed redundant question parameter
This commit is contained in:
@@ -5,7 +5,11 @@ import de.extio.lmlib.profile.ModelProfile.ModelProvider;
|
||||
|
||||
public interface Client {
|
||||
|
||||
Completion completion(ModelCategory modelCategory, String system, String question, String fullText);
|
||||
/**
|
||||
* @deprecated use {@link #conversation(ModelCategory, Conversation)} instead. Conversation can be converted from a system and text by Conversation.create(system, text)
|
||||
*/
|
||||
@Deprecated
|
||||
Completion completion(ModelCategory modelCategory, String system, String text);
|
||||
|
||||
Completion conversation(ModelCategory modelCategory, Conversation conversation);
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class ClientService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String question, final String fullText) {
|
||||
return this.client.completion(modelCategory, system, question, fullText);
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String text) {
|
||||
return this.client.completion(modelCategory, system, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,21 +90,7 @@ public final class AzureAiClient implements Client {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String question, final String fullText) {
|
||||
String text = "";
|
||||
if (!question.isEmpty() && !fullText.isEmpty()) {
|
||||
text = question + "\n" + fullText;
|
||||
}
|
||||
else if (!question.isEmpty()) {
|
||||
text = question;
|
||||
}
|
||||
else if (!fullText.isEmpty()) {
|
||||
text = fullText;
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Either question or fullText must be set");
|
||||
}
|
||||
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String text) {
|
||||
return this.conversation(modelCategory, Conversation.create(system, text));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public class CachedClient implements Client {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String question, final String fullText) {
|
||||
return this.getCachedResponse(modelCategory, () -> this.client.completion(modelCategory, system, question, fullText), system, question, fullText);
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String text) {
|
||||
return this.getCachedResponse(modelCategory, () -> this.client.completion(modelCategory, system, text), system, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,21 +68,7 @@ public class TextCompletionClient implements Client, DisposableBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String question, final String fullText) {
|
||||
String text = "";
|
||||
if (!question.isEmpty() && !fullText.isEmpty()) {
|
||||
text = question + "\n" + fullText;
|
||||
}
|
||||
else if (!question.isEmpty()) {
|
||||
text = question;
|
||||
}
|
||||
else if (!fullText.isEmpty()) {
|
||||
text = fullText;
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Either question or fullText must be set");
|
||||
}
|
||||
|
||||
public Completion completion(final ModelCategory modelCategory, final String system, final String text) {
|
||||
return this.conversation(modelCategory, Conversation.create(system, text));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user