Skip to content

Commit

Permalink
Modify DASHSCOPE_API_KEY_ENV into DASHSCOPE_API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
DavdGao committed Nov 4, 2024
1 parent 05b0ca4 commit 4a50fa8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/agentscope/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def count_dashscope_tokens(
"""
try:
import dashscope
from dashscope.common.constants import DASHSCOPE_API_KEY_ENV
except ImportError as exc:
raise ImportError(
"The package `dashscope` is required for token counting "
Expand All @@ -275,7 +274,7 @@ def count_dashscope_tokens(
response = dashscope.Tokenization.call(
model=model_name,
messages=messages,
api_key=api_key or os.environ.get(DASHSCOPE_API_KEY_ENV),
api_key=api_key or os.environ.get("DASHSCOPE_API_KEY"),
)

if response.status_code != HTTPStatus.OK:
Expand Down

0 comments on commit 4a50fa8

Please sign in to comment.