From 62794e13e9d7274ebf3ef89c4616ac64c97b8481 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Tue, 24 Sep 2024 15:53:32 +0200 Subject: [PATCH] Deprecated withApiKey() static factories --- .../langchain4j/model/anthropic/AnthropicChatModel.java | 2 +- .../model/anthropic/AnthropicStreamingChatModel.java | 2 +- .../langchain4j/model/cohere/CohereEmbeddingModel.java | 9 ++++----- .../dev/langchain4j/model/cohere/CohereScoringModel.java | 4 ++-- .../dev/langchain4j/model/jina/JinaEmbeddingModel.java | 2 +- .../dev/langchain4j/model/jina/JinaScoringModel.java | 2 +- .../langchain4j/model/mistralai/MistralAiChatModel.java | 2 +- .../model/mistralai/MistralAiEmbeddingModel.java | 2 +- .../dev/langchain4j/model/mistralai/MistralAiModels.java | 2 +- .../model/mistralai/MistralAiStreamingChatModel.java | 2 +- .../dev/langchain4j/model/nomic/NomicEmbeddingModel.java | 2 +- .../dev/langchain4j/model/openai/OpenAiChatModel.java | 2 +- .../langchain4j/model/openai/OpenAiEmbeddingModel.java | 2 +- .../dev/langchain4j/model/openai/OpenAiImageModel.java | 2 +- .../langchain4j/model/openai/OpenAiLanguageModel.java | 2 +- .../langchain4j/model/openai/OpenAiModerationModel.java | 2 +- .../model/openai/OpenAiStreamingChatModel.java | 2 +- .../model/openai/OpenAiStreamingLanguageModel.java | 2 +- .../dev/langchain4j/model/ovhai/OvhAiEmbeddingModel.java | 2 +- 19 files changed, 23 insertions(+), 24 deletions(-) diff --git a/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicChatModel.java b/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicChatModel.java index e3530d334..be0c6150e 100644 --- a/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicChatModel.java +++ b/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicChatModel.java @@ -134,7 +134,7 @@ public class AnthropicChatModel implements ChatLanguageModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static AnthropicChatModel withApiKey(String apiKey) { diff --git a/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicStreamingChatModel.java b/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicStreamingChatModel.java index b7f864b66..67600a6a2 100644 --- a/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicStreamingChatModel.java +++ b/langchain4j-anthropic/src/main/java/dev/langchain4j/model/anthropic/AnthropicStreamingChatModel.java @@ -136,7 +136,7 @@ public class AnthropicStreamingChatModel implements StreamingChatLanguageModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static AnthropicStreamingChatModel withApiKey(String apiKey) { diff --git a/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereEmbeddingModel.java b/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereEmbeddingModel.java index 6c2a13df3..e7d10547c 100644 --- a/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereEmbeddingModel.java +++ b/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereEmbeddingModel.java @@ -54,11 +54,11 @@ public class CohereEmbeddingModel extends DimensionAwareEmbeddingModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static CohereEmbeddingModel withApiKey(String apiKey) { - return CohereEmbeddingModel.builder().apiKey(apiKey).build(); + return builder().apiKey(apiKey).build(); } @Override @@ -69,7 +69,6 @@ public class CohereEmbeddingModel extends DimensionAwareEmbeddingModel { .collect(toList()); return embedTexts(texts); - } @@ -89,14 +88,14 @@ public class CohereEmbeddingModel extends DimensionAwareEmbeddingModel { .build(); EmbedResponse response = this.client.embed(request); - + embeddings.addAll(getEmbeddings(response)); totalTokenUsage += getTokenUsage(response); } return Response.from( embeddings, - new TokenUsage(totalTokenUsage,0) + new TokenUsage(totalTokenUsage, 0) ); } diff --git a/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereScoringModel.java b/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereScoringModel.java index 442e2ae0d..e9e28257a 100644 --- a/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereScoringModel.java +++ b/langchain4j-cohere/src/main/java/dev/langchain4j/model/cohere/CohereScoringModel.java @@ -53,11 +53,11 @@ public class CohereScoringModel implements ScoringModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static CohereScoringModel withApiKey(String apiKey) { - return CohereScoringModel.builder().apiKey(apiKey).build(); + return builder().apiKey(apiKey).build(); } @Override diff --git a/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaEmbeddingModel.java b/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaEmbeddingModel.java index 771b7ca75..df05a1c08 100644 --- a/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaEmbeddingModel.java +++ b/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaEmbeddingModel.java @@ -52,7 +52,7 @@ public class JinaEmbeddingModel extends DimensionAwareEmbeddingModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static JinaEmbeddingModel withApiKey(String apiKey) { diff --git a/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaScoringModel.java b/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaScoringModel.java index da8b23187..08274b2e5 100644 --- a/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaScoringModel.java +++ b/langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaScoringModel.java @@ -52,7 +52,7 @@ public class JinaScoringModel implements ScoringModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static JinaScoringModel withApiKey(String apiKey) { diff --git a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiChatModel.java b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiChatModel.java index 9c74611a2..4cf6ebdbe 100644 --- a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiChatModel.java +++ b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiChatModel.java @@ -96,7 +96,7 @@ public class MistralAiChatModel implements ChatLanguageModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static MistralAiChatModel withApiKey(String apiKey) { diff --git a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiEmbeddingModel.java b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiEmbeddingModel.java index 75c237e34..74149186c 100644 --- a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiEmbeddingModel.java +++ b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiEmbeddingModel.java @@ -63,7 +63,7 @@ public class MistralAiEmbeddingModel extends DimensionAwareEmbeddingModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static MistralAiEmbeddingModel withApiKey(String apiKey) { diff --git a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiModels.java b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiModels.java index 767fa00e3..6f7fa396c 100644 --- a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiModels.java +++ b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiModels.java @@ -51,7 +51,7 @@ public class MistralAiModels { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static MistralAiModels withApiKey(String apiKey) { diff --git a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiStreamingChatModel.java b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiStreamingChatModel.java index b7066a92e..97b8c6457 100644 --- a/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiStreamingChatModel.java +++ b/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/MistralAiStreamingChatModel.java @@ -87,7 +87,7 @@ public class MistralAiStreamingChatModel implements StreamingChatLanguageModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static MistralAiStreamingChatModel withApiKey(String apiKey) { diff --git a/langchain4j-nomic/src/main/java/dev/langchain4j/model/nomic/NomicEmbeddingModel.java b/langchain4j-nomic/src/main/java/dev/langchain4j/model/nomic/NomicEmbeddingModel.java index 26a651a44..ac2cda13b 100644 --- a/langchain4j-nomic/src/main/java/dev/langchain4j/model/nomic/NomicEmbeddingModel.java +++ b/langchain4j-nomic/src/main/java/dev/langchain4j/model/nomic/NomicEmbeddingModel.java @@ -53,7 +53,7 @@ public class NomicEmbeddingModel extends DimensionAwareEmbeddingModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static NomicEmbeddingModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiChatModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiChatModel.java index 623ff2a12..185c78cde 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiChatModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiChatModel.java @@ -308,7 +308,7 @@ public class OpenAiChatModel implements ChatLanguageModel, TokenCountEstimator { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiChatModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiEmbeddingModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiEmbeddingModel.java index 843813647..fb8c8b9e7 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiEmbeddingModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiEmbeddingModel.java @@ -130,7 +130,7 @@ public class OpenAiEmbeddingModel extends DimensionAwareEmbeddingModel implement } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiEmbeddingModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiImageModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiImageModel.java index 77117b84a..60c6cdd48 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiImageModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiImageModel.java @@ -165,7 +165,7 @@ public class OpenAiImageModel implements ImageModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiImageModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiLanguageModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiLanguageModel.java index 6d5fa1b8b..abfe7d304 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiLanguageModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiLanguageModel.java @@ -100,7 +100,7 @@ public class OpenAiLanguageModel implements LanguageModel, TokenCountEstimator { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiLanguageModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiModerationModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiModerationModel.java index e14343e6d..d7b2f92a4 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiModerationModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiModerationModel.java @@ -111,7 +111,7 @@ public class OpenAiModerationModel implements ModerationModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiModerationModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingChatModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingChatModel.java index bd5b3efd2..f90625a76 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingChatModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingChatModel.java @@ -290,7 +290,7 @@ public class OpenAiStreamingChatModel implements StreamingChatLanguageModel, Tok } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiStreamingChatModel withApiKey(String apiKey) { diff --git a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingLanguageModel.java b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingLanguageModel.java index 2c9f4cf32..a4dc1f921 100644 --- a/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingLanguageModel.java +++ b/langchain4j-open-ai/src/main/java/dev/langchain4j/model/openai/OpenAiStreamingLanguageModel.java @@ -119,7 +119,7 @@ public class OpenAiStreamingLanguageModel implements StreamingLanguageModel, Tok } /** - * @deprecated use {@link #builder()} instead and explicitly set the model name and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the model name and, if required, other parameters. */ @Deprecated public static OpenAiStreamingLanguageModel withApiKey(String apiKey) { diff --git a/langchain4j-ovh-ai/src/main/java/dev/langchain4j/model/ovhai/OvhAiEmbeddingModel.java b/langchain4j-ovh-ai/src/main/java/dev/langchain4j/model/ovhai/OvhAiEmbeddingModel.java index c9c448c01..28c6d34bb 100644 --- a/langchain4j-ovh-ai/src/main/java/dev/langchain4j/model/ovhai/OvhAiEmbeddingModel.java +++ b/langchain4j-ovh-ai/src/main/java/dev/langchain4j/model/ovhai/OvhAiEmbeddingModel.java @@ -58,7 +58,7 @@ public class OvhAiEmbeddingModel implements EmbeddingModel { } /** - * @deprecated use {@link #builder()} instead and explicitly set the base URL and, if required, other parameters. + * @deprecated use {@code builder()} instead and explicitly set the base URL and, if required, other parameters. */ @Deprecated public static OvhAiEmbeddingModel withApiKey(String apiKey) {