Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DashScope model wrapper into AgentScope #54

Merged
merged 21 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/agentscope/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
OpenAIDALLEWrapper,
OpenAIEmbeddingWrapper,
)
from .tongyi_model import (
TongyiWrapper,
TongyiChatWrapper,
from .dashscope_model import (
DashScopeChatWrapper,
DashScopeImageSynthesisWrapper,
DashScopeTextEmbeddingWrapper,
)


Expand All @@ -35,8 +36,9 @@
"load_model_by_config_name",
"read_model_configs",
"clear_model_configs",
"TongyiWrapper",
"TongyiChatWrapper",
"DashScopeChatWrapper",
"DashScopeImageSynthesisWrapper",
"DashScopeTextEmbeddingWrapper",
]

_MODEL_CONFIGS: dict[str, dict] = {}
Expand All @@ -59,6 +61,13 @@ def _get_model_wrapper(model_type: str) -> Type[ModelWrapperBase]:
return ModelWrapperBase.registry[ # type: ignore [return-value]
model_type
]
elif model_type in ModelWrapperBase.deprecated_type_registry:
cls = ModelWrapperBase.deprecated_type_registry[model_type]
logger.warning(
f"Model type [{model_type}] will be deprecated in future releases,"
f" please use [{cls.model_type}] instead.",
)
return cls # type: ignore [return-value]
else:
logger.warning(
f"Unsupported model_type [{model_type}],"
Expand Down
Loading