mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-04 10:34:30 +00:00
chore(model): Modify siliconflow name (#2194)
This commit is contained in:
@@ -109,7 +109,7 @@ class EmbeddingLoader:
|
||||
if proxy_param.proxy_backend:
|
||||
openapi_param["model_name"] = proxy_param.proxy_backend
|
||||
return OpenAPIRerankEmbeddings(**openapi_param)
|
||||
elif model_name in ["rerank_proxy_silicon_flow"]:
|
||||
elif model_name in ["rerank_proxy_siliconflow"]:
|
||||
from dbgpt.rag.embedding.rerank import SiliconFlowRerankEmbeddings
|
||||
|
||||
proxy_param = cast(ProxyEmbeddingParameters, param)
|
||||
|
@@ -349,7 +349,7 @@ class SiliconFlowProxyLLMModelAdapter(ProxyLLMModelAdapter):
|
||||
return True
|
||||
|
||||
def do_match(self, lower_model_name_or_path: Optional[str] = None):
|
||||
return lower_model_name_or_path == "silicon_flow_proxyllm"
|
||||
return lower_model_name_or_path == "siliconflow_proxyllm"
|
||||
|
||||
def get_llm_client_class(
|
||||
self, params: ProxyModelParameters
|
||||
@@ -359,9 +359,9 @@ class SiliconFlowProxyLLMModelAdapter(ProxyLLMModelAdapter):
|
||||
return SiliconFlowLLMClient
|
||||
|
||||
def get_async_generate_stream_function(self, model, model_path: str):
|
||||
from dbgpt.model.proxy.llms.siliconflow import silicon_flow_generate_stream
|
||||
from dbgpt.model.proxy.llms.siliconflow import siliconflow_generate_stream
|
||||
|
||||
return silicon_flow_generate_stream
|
||||
return siliconflow_generate_stream
|
||||
|
||||
|
||||
register_model_adapter(OpenAIProxyLLMModelAdapter)
|
||||
|
@@ -621,7 +621,7 @@ _EMBEDDING_PARAMETER_CLASS_TO_NAME_CONFIG = {
|
||||
"proxy_tongyi",
|
||||
"proxy_qianfan",
|
||||
"rerank_proxy_http_openapi",
|
||||
"rerank_proxy_silicon_flow",
|
||||
"rerank_proxy_siliconflow",
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -12,10 +12,10 @@ if TYPE_CHECKING:
|
||||
ClientType = Union[AsyncAzureOpenAI, AsyncOpenAI]
|
||||
|
||||
|
||||
_SILICON_FLOW_DEFAULT_MODEL = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
||||
_SILICONFLOW_DEFAULT_MODEL = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
||||
|
||||
|
||||
async def silicon_flow_generate_stream(
|
||||
async def siliconflow_generate_stream(
|
||||
model: ProxyModel, tokenizer, params, device, context_len=2048
|
||||
):
|
||||
client: SiliconFlowLLMClient = model.proxy_llm_client
|
||||
@@ -39,7 +39,7 @@ class SiliconFlowLLMClient(OpenAILLMClient):
|
||||
model: Optional[str] = None,
|
||||
proxies: Optional["ProxiesTypes"] = None,
|
||||
timeout: Optional[int] = 240,
|
||||
model_alias: Optional[str] = "silicon_flow_proxyllm",
|
||||
model_alias: Optional[str] = "siliconflow_proxyllm",
|
||||
context_length: Optional[int] = None,
|
||||
openai_client: Optional["ClientType"] = None,
|
||||
openai_kwargs: Optional[Dict[str, Any]] = None,
|
||||
@@ -47,11 +47,11 @@ class SiliconFlowLLMClient(OpenAILLMClient):
|
||||
):
|
||||
api_base = (
|
||||
api_base
|
||||
or os.getenv("SILICON_FLOW_API_BASE")
|
||||
or os.getenv("SILICONFLOW_API_BASE")
|
||||
or "https://api.siliconflow.cn/v1"
|
||||
)
|
||||
api_key = api_key or os.getenv("SILICON_FLOW_API_KEY")
|
||||
model = model or _SILICON_FLOW_DEFAULT_MODEL
|
||||
api_key = api_key or os.getenv("SILICONFLOW_API_KEY")
|
||||
model = model or _SILICONFLOW_DEFAULT_MODEL
|
||||
if not context_length:
|
||||
if "200k" in model:
|
||||
context_length = 200 * 1024
|
||||
@@ -60,7 +60,7 @@ class SiliconFlowLLMClient(OpenAILLMClient):
|
||||
|
||||
if not api_key:
|
||||
raise ValueError(
|
||||
"SiliconFlow API key is required, please set 'SILICON_FLOW_API_KEY' in environment "
|
||||
"SiliconFlow API key is required, please set 'SILICONFLOW_API_KEY' in environment "
|
||||
"or pass it as an argument."
|
||||
)
|
||||
|
||||
@@ -83,5 +83,5 @@ class SiliconFlowLLMClient(OpenAILLMClient):
|
||||
def default_model(self) -> str:
|
||||
model = self._model
|
||||
if not model:
|
||||
model = _SILICON_FLOW_DEFAULT_MODEL
|
||||
model = _SILICONFLOW_DEFAULT_MODEL
|
||||
return model
|
||||
|
Reference in New Issue
Block a user