Skip to content

Commit 95a561d

Browse files
committed
specify stacklevel
1 parent 1c0add6 commit 95a561d

File tree

1 file changed

+3
-2
lines changed
  • libs/core/langchain_core/language_models

1 file changed

+3
-2
lines changed

libs/core/langchain_core/language_models/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import warnings
34
from abc import ABC, abstractmethod
45
from collections.abc import Mapping, Sequence
56
from functools import cache
@@ -12,7 +13,6 @@
1213
TypeVar,
1314
Union,
1415
)
15-
import warnings
1616

1717
from pydantic import BaseModel, ConfigDict, Field, field_validator
1818
from typing_extensions import TypeAlias, TypedDict, override
@@ -387,7 +387,8 @@ def get_num_tokens_from_messages(
387387
"""
388388
if tools is not None:
389389
warnings.warn(
390-
"Counting tokens in tool schemas is not yet supported. Ignoring tools."
390+
"Counting tokens in tool schemas is not yet supported. Ignoring tools.",
391+
stacklevel=2,
391392
)
392393
return sum([self.get_num_tokens(get_buffer_string([m])) for m in messages])
393394

0 commit comments

Comments
 (0)