Skip to content

Conversation

@chenlb
Copy link
Contributor

@chenlb chenlb commented Feb 26, 2025

PR 内容说明:

懒 import 相关包不成功后设置为 None,导致 pyright 检测报错:Variable not allowed in type expression

应该改为如下:

try:
     from dashscope import Generation as TongyiGeneration
     from dashscope.api_entities.dashscope_response import Message, GenerationResponse
 except ImportError:
-    TongyiGeneration = None
-    Message = None
-    GenerationResponse = None
+    raise ModuleNotFoundError("Please install Dashscope to use this feature: 'pip install dashscope'")

相关的 issue

Closes #3

确认

在提出此拉取请求时,我确认了以下几点(请复选框):

  • 我已阅读并理解贡献指南
  • 我已检查没有与此请求重复的拉取请求。
  • 我已经考虑过,并确认这份呈件对其他人很有价值。
  • 我已经运行 poe all (fmt、lint、pyright、test)通过了。
  • 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。

@chenlb chenlb added the test label Feb 26, 2025
@chenlb chenlb merged commit 48565b1 into langfarm:main Feb 26, 2025
1 check passed
@chenlb chenlb deleted the feature/pyright-pass branch February 26, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: 能让 pyright 检测通过

1 participant