Skip to content

Commit

Permalink
Deprecated withApiKey() static factories
Browse files Browse the repository at this point in the history
  • Loading branch information
langchain4j committed Sep 24, 2024
1 parent 8c625c3 commit 62794e1
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public AnthropicChatModelBuilder modelName(AnthropicChatModelName modelName) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public AnthropicStreamingChatModelBuilder modelName(AnthropicChatModelName model
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public CohereEmbeddingModel(String baseUrl,
}

/**
* @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
Expand All @@ -69,7 +69,6 @@ public Response<List<Embedding>> embedAll(List<TextSegment> textSegments) {
.collect(toList());

return embedTexts(texts);

}


Expand All @@ -89,14 +88,14 @@ private Response<List<Embedding>> embedTexts(List<String> texts) {
.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)
);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public CohereScoringModel(
}

/**
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public JinaEmbeddingModel(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public JinaScoringModel(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public MistralAiChatModel(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public MistralAiEmbeddingModel(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public MistralAiModels(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public MistralAiStreamingChatModel(String baseUrl,
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public NomicEmbeddingModel(
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public int estimateTokenCount(List<ChatMessage> messages) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public int estimateTokenCount(String text) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public OpenAiImageModelBuilder withPersisting(Boolean withPersisting) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public int estimateTokenCount(String prompt) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Response<Moderation> moderate(List<ChatMessage> messages) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public int estimateTokenCount(List<ChatMessage> messages) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public int estimateTokenCount(String prompt) {
}

/**
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private OvhAiEmbeddingModel(
}

/**
* @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) {
Expand Down

0 comments on commit 62794e1

Please sign in to comment.