mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge 25790e13a7 into 67c7b97fd2
This commit is contained in:
commit
d64ff2f8b4
1 changed files with 6 additions and 3 deletions
|
|
@ -64,12 +64,15 @@ class DashScopeChatConfig(OpenAIGPTConfig):
|
|||
stream: bool | None = None,
|
||||
) -> str:
|
||||
"""
|
||||
If api_base is not provided, use the default DashScope /chat/completions endpoint.
|
||||
If api_base is not provided, use the default DashScope base URL.
|
||||
Appends /chat/completions only when not already present, matching OpenAIGPTConfig behavior.
|
||||
"""
|
||||
if not api_base:
|
||||
api_base = "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||
|
||||
if not api_base.endswith("/chat/completions"):
|
||||
api_base = f"{api_base}/chat/completions"
|
||||
endpoint = "chat/completions"
|
||||
api_base = api_base.rstrip("/")
|
||||
if endpoint not in api_base:
|
||||
api_base = f"{api_base}/{endpoint}"
|
||||
|
||||
return api_base
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue