[PR #5267] fix: casting non-string type value for tool parameter options #24851

Closed
opened 2026-02-21 20:23:48 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/5267

State: closed
Merged: Yes


Description

  • fixing the Pydantic validation warning message introduced in #4648 in starting up API service.
load builtin provider identity=ToolProviderIdentity(author='Serply.io', name='websearch', description=I18nObject(zh_Hans='Serply.io 是一个强大的实时 SERP API,可提供来自 搜索 招聘 新闻等搜索引擎集合的结构化数据。', pt_BR='Serply.io is a robust real-time SERP API delivering structured data from a collection of search engines including Web Search, Jobs, News, and many more.', en_US='Serply.io is a robust real-time SERP API delivering structured data from a collection of search engines including Web Search, Jobs, News, and many more.'), icon='icon.svg', label=I18nObject(zh_Hans='Serply.io', pt_BR='Serply.io', en_US='Serply.io'), tags=[<ToolLabelEnum.SEARCH: 'search'>, <ToolLabelEnum.BUSINESS: 'business'>, <ToolLabelEnum.NEWS: 'news'>, <ToolLabelEnum.PRODUCTIVITY: 'productivity'>]) tools=None credentials_schema={'serply_api_key': ToolProviderCredentials(name='serply_api_key', type=<CredentialsType.SECRET_INPUT: 'secret-input'>, required=True, default=None, options=None, label=I18nObject(zh_Hans='Serply.io API key', pt_BR='Serply.io API key', en_US='Serply.io API key'), help=I18nObject(zh_Hans='从 Serply.io 获取您的 Serply.io API key', pt_BR='Get your Serply.io API key from Serply.io', en_US='Get your Serply.io API key from https://Serply.io/'), url='https://Serply.io/', placeholder=I18nObject(zh_Hans='请输入你的 Serply.io API key', pt_BR='Please input your Serply.io API key', en_US='Please input your Serply.io API key'))} error: 1 validation error for ScholarSearchTool

parameters.2.options.24.value
  • as the tool parameter option accepts string type for value field, converting all the non-string type value into string type

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • TODO

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes
**Original Pull Request:** https://github.com/langgenius/dify/pull/5267 **State:** closed **Merged:** Yes --- # Description - fixing the Pydantic validation warning message introduced in #4648 in starting up API service. ``` load builtin provider identity=ToolProviderIdentity(author='Serply.io', name='websearch', description=I18nObject(zh_Hans='Serply.io 是一个强大的实时 SERP API,可提供来自 搜索 招聘 新闻等搜索引擎集合的结构化数据。', pt_BR='Serply.io is a robust real-time SERP API delivering structured data from a collection of search engines including Web Search, Jobs, News, and many more.', en_US='Serply.io is a robust real-time SERP API delivering structured data from a collection of search engines including Web Search, Jobs, News, and many more.'), icon='icon.svg', label=I18nObject(zh_Hans='Serply.io', pt_BR='Serply.io', en_US='Serply.io'), tags=[<ToolLabelEnum.SEARCH: 'search'>, <ToolLabelEnum.BUSINESS: 'business'>, <ToolLabelEnum.NEWS: 'news'>, <ToolLabelEnum.PRODUCTIVITY: 'productivity'>]) tools=None credentials_schema={'serply_api_key': ToolProviderCredentials(name='serply_api_key', type=<CredentialsType.SECRET_INPUT: 'secret-input'>, required=True, default=None, options=None, label=I18nObject(zh_Hans='Serply.io API key', pt_BR='Serply.io API key', en_US='Serply.io API key'), help=I18nObject(zh_Hans='从 Serply.io 获取您的 Serply.io API key', pt_BR='Get your Serply.io API key from Serply.io', en_US='Get your Serply.io API key from https://Serply.io/'), url='https://Serply.io/', placeholder=I18nObject(zh_Hans='请输入你的 Serply.io API key', pt_BR='Please input your Serply.io API key', en_US='Please input your Serply.io API key'))} error: 1 validation error for ScholarSearchTool parameters.2.options.24.value ``` - as the tool parameter option accepts string type for `value` field, converting all the non-string type value into string type ## Type of Change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement - [ ] Dependency upgrade # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] TODO # Suggested Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] My changes generate no new warnings - [ ] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods - [ ] `optional` I have made corresponding changes to the documentation - [ ] `optional` I have added tests that prove my fix is effective or that my feature works - [ ] `optional` New and existing unit tests pass locally with my changes
yindo added the pull-request label 2026-02-21 20:23:48 -05:00
yindo closed this issue 2026-02-21 20:23:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#24851