-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
541bf1d
commit 2e941bb
Showing
22 changed files
with
1,328 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
- nvidia | ||
- nvidia_nim | ||
- cohere | ||
- upstage | ||
- bedrock | ||
- togetherai | ||
- openrouter | ||
|
Empty file.
14 changes: 14 additions & 0 deletions
14
api/core/model_runtime/model_providers/upstage/_assets/icon_l_en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
api/core/model_runtime/model_providers/upstage/_assets/icon_s_en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
from collections.abc import Mapping | ||
|
||
import openai | ||
from httpx import Timeout | ||
|
||
from core.model_runtime.errors.invoke import ( | ||
InvokeAuthorizationError, | ||
InvokeBadRequestError, | ||
InvokeConnectionError, | ||
InvokeError, | ||
InvokeRateLimitError, | ||
InvokeServerUnavailableError, | ||
) | ||
|
||
|
||
class _CommonUpstage: | ||
def _to_credential_kwargs(self, credentials: Mapping) -> dict: | ||
""" | ||
Transform credentials to kwargs for model instance | ||
:param credentials: | ||
:return: | ||
""" | ||
credentials_kwargs = { | ||
"api_key": credentials['upstage_api_key'], | ||
"base_url": "https://api.upstage.ai/v1/solar", | ||
"timeout": Timeout(315.0, read=300.0, write=20.0, connect=10.0), | ||
"max_retries": 1 | ||
} | ||
|
||
return credentials_kwargs | ||
|
||
@property | ||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]: | ||
""" | ||
Map model invoke error to unified error | ||
The key is the error type thrown to the caller | ||
The value is the error type thrown by the model, | ||
which needs to be converted into a unified error type for the caller. | ||
:return: Invoke error mapping | ||
""" | ||
return { | ||
InvokeConnectionError: [openai.APIConnectionError, openai.APITimeoutError], | ||
InvokeServerUnavailableError: [openai.InternalServerError], | ||
InvokeRateLimitError: [openai.RateLimitError], | ||
InvokeAuthorizationError: [openai.AuthenticationError, openai.PermissionDeniedError], | ||
InvokeBadRequestError: [ | ||
openai.BadRequestError, | ||
openai.NotFoundError, | ||
openai.UnprocessableEntityError, | ||
openai.APIError, | ||
], | ||
} | ||
|
||
|
Empty file.
1 change: 1 addition & 0 deletions
1
api/core/model_runtime/model_providers/upstage/llm/_position.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- soloar-1-mini-chat |
Oops, something went wrong.