Skip to content

Commit

Permalink
Adjusted get_num_tokens_from_messages method
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuligin committed Feb 7, 2024
1 parent c37ca45 commit 9f9715b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/core/langchain_core/language_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def get_num_tokens_from_messages(self, messages: List[BaseMessage]) -> int:
Returns:
The sum of the number of tokens across the messages.
"""
return sum([self.get_num_tokens(get_buffer_string([m])) for m in messages])
return self.get_num_tokens(get_buffer_string(messages))

@classmethod
def _all_required_field_names(cls) -> Set:
Expand Down

0 comments on commit 9f9715b

Please sign in to comment.