Deprecated withApiKey() static factories

This commit is contained in:
LangChain4j 2024-09-24 15:53:32 +02:00
parent 8c625c3caf
commit 62794e13e9
19 changed files with 23 additions and 24 deletions

View File

@ -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 @Deprecated
public static AnthropicChatModel withApiKey(String apiKey) { public static AnthropicChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static AnthropicStreamingChatModel withApiKey(String apiKey) { public static AnthropicStreamingChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static CohereEmbeddingModel withApiKey(String apiKey) { public static CohereEmbeddingModel withApiKey(String apiKey) {
return CohereEmbeddingModel.builder().apiKey(apiKey).build(); return builder().apiKey(apiKey).build();
} }
@Override @Override
@ -69,7 +69,6 @@ public class CohereEmbeddingModel extends DimensionAwareEmbeddingModel {
.collect(toList()); .collect(toList());
return embedTexts(texts); return embedTexts(texts);
} }
@ -89,14 +88,14 @@ public class CohereEmbeddingModel extends DimensionAwareEmbeddingModel {
.build(); .build();
EmbedResponse response = this.client.embed(request); EmbedResponse response = this.client.embed(request);
embeddings.addAll(getEmbeddings(response)); embeddings.addAll(getEmbeddings(response));
totalTokenUsage += getTokenUsage(response); totalTokenUsage += getTokenUsage(response);
} }
return Response.from( return Response.from(
embeddings, embeddings,
new TokenUsage(totalTokenUsage,0) new TokenUsage(totalTokenUsage, 0)
); );
} }

View File

@ -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 @Deprecated
public static CohereScoringModel withApiKey(String apiKey) { public static CohereScoringModel withApiKey(String apiKey) {
return CohereScoringModel.builder().apiKey(apiKey).build(); return builder().apiKey(apiKey).build();
} }
@Override @Override

View File

@ -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 @Deprecated
public static JinaEmbeddingModel withApiKey(String apiKey) { public static JinaEmbeddingModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static JinaScoringModel withApiKey(String apiKey) { public static JinaScoringModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static MistralAiChatModel withApiKey(String apiKey) { public static MistralAiChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static MistralAiEmbeddingModel withApiKey(String apiKey) { public static MistralAiEmbeddingModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static MistralAiModels withApiKey(String apiKey) { public static MistralAiModels withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static MistralAiStreamingChatModel withApiKey(String apiKey) { public static MistralAiStreamingChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static NomicEmbeddingModel withApiKey(String apiKey) { public static NomicEmbeddingModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiChatModel withApiKey(String apiKey) { public static OpenAiChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiEmbeddingModel withApiKey(String apiKey) { public static OpenAiEmbeddingModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiImageModel withApiKey(String apiKey) { public static OpenAiImageModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiLanguageModel withApiKey(String apiKey) { public static OpenAiLanguageModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiModerationModel withApiKey(String apiKey) { public static OpenAiModerationModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiStreamingChatModel withApiKey(String apiKey) { public static OpenAiStreamingChatModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OpenAiStreamingLanguageModel withApiKey(String apiKey) { public static OpenAiStreamingLanguageModel withApiKey(String apiKey) {

View File

@ -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 @Deprecated
public static OvhAiEmbeddingModel withApiKey(String apiKey) { public static OvhAiEmbeddingModel withApiKey(String apiKey) {