Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /snowcell-cloud_Snowcode /openhands /llm /bedrock.py
| import boto3 | |
| from openhands.core.logger import openhands_logger as logger | |
| def list_foundation_models( | |
| aws_region_name: str, aws_access_key_id: str, aws_secret_access_key: str | |
| ) -> list[str]: | |
| try: | |
| # The AWS bedrock model id is not queried, if no AWS parameters are configured. | |
| client = boto3.client( | |
| service_name='bedrock', | |
| region_name=aws_region_name, | |
| aws_access_key_id=aws_access_key_id, | |
| aws_secret_access_key=aws_secret_access_key, | |
| ) | |
| foundation_models_list = client.list_foundation_models( | |
| byOutputModality='TEXT', byInferenceType='ON_DEMAND' | |
| ) | |
| model_summaries = foundation_models_list['modelSummaries'] | |
| return ['bedrock/' + model['modelId'] for model in model_summaries] | |
| except Exception as err: | |
| logger.warning( | |
| '%s. Please config AWS_REGION_NAME AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY' | |
| ' if you want use bedrock model.', | |
| err, | |
| ) | |
| return [] | |
| def remove_error_modelId(model_list: list[str]) -> list[str]: | |
| return list(filter(lambda m: not m.startswith('bedrock'), model_list)) | |
Xet Storage Details
- Size:
- 1.17 kB
- Xet hash:
- dbdd6dfa2676e249ac7e57a4a7c15add7c983e8c5721b7c16d0be6eeb946014e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.