-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: migrate from boto3 to custom http client * refactor: create an aws http client, and switch bedrock client to use it * test: rename test, add async tests * feat: add async client, remove bedrock_session class * docs: Azure README (#139) * feat: Add async tokenizer, add detokenize method (#144) * feat: add detokenize method, add async tokenizer * chore: update pyproject and poetry.lock * fix: fix tokenizer name in examples and readme, add example * test: adjust unittest + add unittest for async * chore: cache -> lru_cache to support python 3.8 * test: fix test_imports test * chore: add env_config to bedrock client to avoid breaking changes * refactor: sagemaker client, boto->aws http client * refactor: export aws auth logic to new class * refactor: remove aws_http_client, use http_client instead, add aws auth test * test: fix tests * refactor: remove aws_http_client * chore(deps-dev): bump authlib from 1.3.0 to 1.3.1 (#131) Bumps [authlib](https://github.com/lepture/authlib) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/lepture/authlib/releases) - [Changelog](https://github.com/lepture/authlib/blob/master/docs/changelog.rst) - [Commits](lepture/authlib@v1.3.0...v1.3.1) --- updated-dependencies: - dependency-name: authlib dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Asaf Joseph Gardin <[email protected]> * chore(deps): bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 (#138) Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.14 to 1.9.0. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](pypa/gh-action-pypi-publish@81e9d93...ec4db0b) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Asaf Joseph Gardin <[email protected]> * chore: rebase code * refactor: chat + chat completions - migrate to new client * refactor: cr comments * chore: add async to new bedrock components * refactor: rename aws folder * chore: refactor to use http client * chore: fix typo on file name bedrock_chat_completions * fix: fix errors * chore: fix typo * chore: add async to sm resources * test: fix imports test * fix: Added deprecation warning * fix: Added deprecation warning to async * chore: add log for ignoring stream * chore: fix lint * refactor: export get_aws_region, add async sm to readme, add async examples * test: add async test files to test_sagemaker.py * refactor: remove get_aws_region func --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Asaf Joseph Gardin <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f117c3f
commit cf1a576
Showing
18 changed files
with
465 additions
and
54 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
from ai21.clients.common.gec_base import GEC | ||
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource | ||
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource, AsyncSageMakerResource | ||
from ai21.models import GECResponse | ||
|
||
|
||
class SageMakerGEC(SageMakerResource, GEC): | ||
def create(self, text: str, **kwargs) -> GECResponse: | ||
body = self._create_body(text=text) | ||
|
||
response = self._invoke(body) | ||
response = self._post(body) | ||
|
||
return self._json_to_response(response) | ||
return self._json_to_response(response.json()) | ||
|
||
|
||
class AsyncSageMakerGEC(AsyncSageMakerResource, GEC): | ||
async def create(self, text: str, **kwargs) -> GECResponse: | ||
body = self._create_body(text=text) | ||
|
||
response = await self._post(body) | ||
|
||
return self._json_to_response(response.json()) |
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
Oops, something went wrong.