Skip to content

Commit

Permalink
Add DashScope model wrapper into AgentScope (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
qbc2016 authored Mar 14, 2024
1 parent e489305 commit 98a98c9
Show file tree
Hide file tree
Showing 6 changed files with 462 additions and 222 deletions.
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

0 comments on commit 98a98c9

Please sign in to comment.