Skip to content

docs: fix API key lookup in function calling examples - #1801

Merged
Yunnglin merged 1 commit into
modelscope:mainfrom
git-jxj:docs/fix-custom-dataset-example
Oct 8, 2026
Merged

Yunnglin merged 1 commit into
modelscope:mainfrom
git-jxj:docs/fix-custom-dataset-example

Conversation

@git-jxj

@git-jxj git-jxj commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The preset and local Function Calling examples in the English and Chinese custom-dataset guides use env.get(...) without defining env, so copying either example raises NameError before evaluation starts.

Import os and read DASHSCOPE_API_KEY with os.getenv, as the other examples on the same pages do.

Validation: executed all four snippets using the real TaskConfig with evaluation mocked; each now builds the expected API configuration. make lint and the CI lite smoke test (mock model) pass.

@Yunnglin Yunnglin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix — verified against the docs. The two Function Calling snippets referenced an undefined env, so copying them raised NameError before the run started. Your change to import os + os.getenv('DASHSCOPE_API_KEY') both resolves it and matches the convention already used by the other examples on the same pages. No env.get remains in either file, and CI is green. LGTM 👍

@Yunnglin
Yunnglin merged commit 309671e into modelscope:main Oct 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants