-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/bump-version-to-0.15.0
- Loading branch information
Showing
147 changed files
with
2,748 additions
and
1,897 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
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
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
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
248 changes: 140 additions & 108 deletions
248
api/core/app/apps/advanced_chat/generate_task_pipeline.py
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
File renamed without changes.
43 changes: 43 additions & 0 deletions
43
api/core/model_runtime/model_providers/gpustack/speech2text/speech2text.py
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,43 @@ | ||
from typing import IO, Optional | ||
|
||
from core.model_runtime.model_providers.openai_api_compatible.speech2text.speech2text import OAICompatSpeech2TextModel | ||
|
||
|
||
class GPUStackSpeech2TextModel(OAICompatSpeech2TextModel): | ||
""" | ||
Model class for GPUStack Speech to text model. | ||
""" | ||
|
||
def _invoke(self, model: str, credentials: dict, file: IO[bytes], user: Optional[str] = None) -> str: | ||
""" | ||
Invoke speech2text model | ||
:param model: model name | ||
:param credentials: model credentials | ||
:param file: audio file | ||
:param user: unique user id | ||
:return: text for given audio file | ||
""" | ||
compatible_credentials = self._get_compatible_credentials(credentials) | ||
return super()._invoke(model, compatible_credentials, file) | ||
|
||
def validate_credentials(self, model: str, credentials: dict) -> None: | ||
""" | ||
Validate model credentials | ||
:param model: model name | ||
:param credentials: model credentials | ||
""" | ||
compatible_credentials = self._get_compatible_credentials(credentials) | ||
super().validate_credentials(model, compatible_credentials) | ||
|
||
def _get_compatible_credentials(self, credentials: dict) -> dict: | ||
""" | ||
Get compatible credentials | ||
:param credentials: model credentials | ||
:return: compatible credentials | ||
""" | ||
compatible_credentials = credentials.copy() | ||
base_url = credentials["endpoint_url"].rstrip("/").removesuffix("/v1-openai") | ||
compatible_credentials["endpoint_url"] = f"{base_url}/v1-openai" | ||
return compatible_credentials |
Oops, something went wrong.