diff --git a/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/base.py b/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/base.py index fcc7e88b9d8e293eb2486c398947ae47a73d6b01..40c318cd80a40f01aacb23c203e58443c8bac24b 100644 --- a/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/base.py +++ b/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/base.py @@ -2,6 +2,7 @@ from http import HTTPStatus from typing import Any, Dict, List, Optional, Sequence, Tuple +from pydantic import ConfigDict from llama_index.core.base.llms.types import ( ChatMessage, @@ -121,6 +122,11 @@ class DashScope(CustomLLM): ``` """ + """ In Pydantic V2, protected_namespaces is a configuration option used to prevent certain namespace keywords + (such as model_, etc.) from being used as field names. so we need to disable it here. + """ + model_config = ConfigDict(protected_namespaces=()) + model_name: str = Field( default=DashScopeGenerationModels.QWEN_MAX, description="The DashScope model to use.", diff --git a/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml index b81d41b0974fe99fb68b008d1229b0a1c3a4ec8f..3335d26a33f22ce46483e0f6dd0f196a4b0c1b9a 100644 --- a/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml @@ -27,7 +27,7 @@ exclude = ["**/BUILD"] license = "MIT" name = "llama-index-llms-dashscope" readme = "README.md" -version = "0.2.5" +version = "0.2.6" [tool.poetry.dependencies] python = ">=3.8.1,<4.0"