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

[Feat] Add ernie-speed #315

Merged
merged 1 commit into from
Feb 8, 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
2 changes: 1 addition & 1 deletion erniebot/src/erniebot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
DEFAULT_REQUEST_TIMEOUT_SECS: Final[float] = 600

POLLING_INTERVAL_SECS: Final[float] = 5
POLLING_TIMEOUT_SECS: Final[float] = 20
POLLING_TIMEOUT_SECS: Final[float] = 600
13 changes: 11 additions & 2 deletions erniebot/src/erniebot/resources/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class ChatCompletion(EBResource, CreatableWithStreaming):
"ernie-longtext": {
"model_id": "ernie_bot_8k",
},
"ernie-speed": {
"model_id": "ernie_speed",
},
},
},
APIType.AISTUDIO: {
Expand Down Expand Up @@ -478,8 +481,14 @@ def _set_val_if_key_exists(src: dict, dst: dict, key: str) -> None:

# params
params = {}
if model == "ernie-turbo":
for arg in ("functions", "stop", "disable_search", "enable_citation"):
if model in ("ernie-turbo", "ernie-speed"):
for arg in (
"functions",
"stop",
"disable_search",
"enable_citation",
"tool_choice",
):
if arg in kwargs:
raise errors.InvalidArgumentError(f"`{arg}` is not supported by the {model} model.")
params["messages"] = messages
Expand Down
Loading