Skip to content

Commit f567e3f

Browse files
authored
Emit deprecation warning for default_dimension method (#990)
Based on 16dfeb2, it seems that `default_dimension` is being kept for backward compatibility. Emitting a warning when `default_dimension` is used would help encourage users to switch to the regular `default_dimensions` method, and would be a suitable way to avoid breaking change.
1 parent a2f0130 commit f567e3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/langchain/llm/base.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ class Base
2626
# Default LLM options. Can be overridden by passing `default_options: {}` to the Langchain::LLM::* constructors.
2727
attr_reader :defaults
2828

29-
# Ensuring backward compatibility after https://github.com/patterns-ai-core/langchainrb/pull/586
30-
# TODO: Delete this method later
29+
# Ensuring backward compatibility for `default_dimensions`.
30+
#
31+
# @deprecated Use `default_dimensions` instead.
32+
# @see https://github.com/patterns-ai-core/langchainrb/pull/586
3133
def default_dimension
34+
Langchain.logger.warn "DEPRECATED: `default_dimension` is deprecated, and will be removed in the next major version. Please use `default_dimensions` instead."
35+
3236
default_dimensions
3337
end
3438

0 commit comments

Comments
 (0)