From 95a561d3de4ed93ae9f0d1e53337f7c9adf4c899 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Tue, 12 Nov 2024 12:52:05 -0500 Subject: [PATCH] specify stacklevel --- libs/core/langchain_core/language_models/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/language_models/base.py b/libs/core/langchain_core/language_models/base.py index e9956b9f6b554..a6db99a495111 100644 --- a/libs/core/langchain_core/language_models/base.py +++ b/libs/core/langchain_core/language_models/base.py @@ -1,5 +1,6 @@ from __future__ import annotations +import warnings from abc import ABC, abstractmethod from collections.abc import Mapping, Sequence from functools import cache @@ -12,7 +13,6 @@ TypeVar, Union, ) -import warnings from pydantic import BaseModel, ConfigDict, Field, field_validator from typing_extensions import TypeAlias, TypedDict, override @@ -387,7 +387,8 @@ def get_num_tokens_from_messages( """ if tools is not None: warnings.warn( - "Counting tokens in tool schemas is not yet supported. Ignoring tools." + "Counting tokens in tool schemas is not yet supported. Ignoring tools.", + stacklevel=2, ) return sum([self.get_num_tokens(get_buffer_string([m])) for m in messages])