Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-learning-dynamo committed Nov 24, 2023
1 parent c671ebe commit f98c040
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.langchain4j.model.bedrock.internal;

import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.data.message.ChatMessageType;
Expand Down Expand Up @@ -82,16 +81,6 @@ public Response<AiMessage> generate(List<ChatMessage> messages) {
result.getFinishReason());
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) {
throw new IllegalArgumentException("Tools are currently not supported for Bedrock models");
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification) {
throw new IllegalArgumentException("Tools are currently not supported for Bedrock models");
}

/**
* Convert chat message to string
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ default Response<AiMessage> generate(ChatMessage... messages) {
* @return The response generated by the model.
* {@link AiMessage} can contain either a textual response or a request to execute one of the tools.
*/
Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications);
default Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) {
throw new IllegalArgumentException("Tools are currently not supported by this model");
}

/**
* Generates a response from the model based on a list of messages and a single tool specification.
Expand All @@ -75,5 +77,7 @@ default Response<AiMessage> generate(ChatMessage... messages) {
* @return The response generated by the model.
* {@link AiMessage} contains a request to execute the specified tool.
*/
Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification);
default Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification) {
throw new IllegalArgumentException("Tools are currently not supported by this model");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ default void generate(String userMessage, StreamingResponseHandler<AiMessage> ha
* @param handler The handler for streaming the response.
* {@link AiMessage} can contain either a textual response or a request to execute one of the tools.
*/
void generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler);
default void generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) {
throw new IllegalArgumentException("Tools are currently not supported by this model");
}

void generate(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler);
default void generate(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) {
throw new IllegalArgumentException("Tools are currently not supported by this model");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.alibaba.dashscope.aigc.generation.models.QwenParam;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.internal.Utils;
Expand Down Expand Up @@ -66,16 +65,6 @@ public Response<AiMessage> generate(List<ChatMessage> messages) {
}
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) {
throw new IllegalArgumentException("Tools are currently not supported for qwen models");
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification) {
throw new IllegalArgumentException("Tools are currently not supported for qwen models");
}

public static Builder builder() {
return new Builder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.alibaba.dashscope.common.ResultCallback;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.StreamingResponseHandler;
Expand Down Expand Up @@ -67,20 +66,6 @@ public void onError(Exception e) {
}
}

@Override
public void generate(List<ChatMessage> messages,
List<ToolSpecification> toolSpecifications,
StreamingResponseHandler<AiMessage> handler) {
throw new IllegalArgumentException("Tools are currently not supported for qwen models");
}

@Override
public void generate(List<ChatMessage> messages,
ToolSpecification toolSpecification,
StreamingResponseHandler<AiMessage> handler) {
throw new IllegalArgumentException("Tools are currently not supported for qwen models");
}

public static Builder builder() {
return new Builder();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.langchain4j.model.huggingface;

import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.chat.ChatLanguageModel;
Expand Down Expand Up @@ -89,16 +88,6 @@ public Response<AiMessage> generate(List<ChatMessage> messages) {
return Response.from(AiMessage.from(textGenerationResponse.generatedText()));
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) {
throw new IllegalArgumentException("Tools are currently not supported for HuggingFace models");
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification) {
throw new IllegalArgumentException("Tools are currently not supported for HuggingFace models");
}

public static Builder builder() {
return new Builder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.google.cloud.aiplatform.v1.PredictionServiceSettings;
import com.google.protobuf.Value;
import com.google.protobuf.util.JsonFormat;
import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.chat.ChatLanguageModel;
Expand Down Expand Up @@ -137,16 +136,6 @@ private static String toContext(List<ChatMessage> messages) {
.collect(joining("\n"));
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) {
throw new IllegalArgumentException("Tools are currently not supported for Vertex AI models");
}

@Override
public Response<AiMessage> generate(List<ChatMessage> messages, ToolSpecification toolSpecification) {
throw new IllegalArgumentException("Tools are currently not supported for Vertex AI models");
}

public static Builder builder() {
return new Builder();
}
Expand Down

0 comments on commit f98c040

Please sign in to comment.