Amazon Bedrock Converse API Data Types
This project is a Pydantic implementation of Amazon Bedrock Runtime Converse API Data Types.
Example Usage
from bedrock_types import ConverseResponse
...
response = client.converse(
modelId=model_id,
messages=messages,
system=system_prompts,
inferenceConfig=inference_config,
additionalModelRequestFields=additional_model_fields,
)
parsed = ConverseResponse.model_validate(response)
print(parsed.model_dump_json(indent=4, exclude_unset=True))
print(parsed.ResponseMetadata)
Output
ResponseMetadata={'RequestId': '427c73bb-df2d-4c1a-8744-db1b5b3c4897', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Thu, 13 Jun 2024 09:11:25 GMT', 'content-type': 'application/json', 'content-length': '247', 'connection': 'keep-alive', 'x-amzn-requestid': '427c73bb-df2d-4c1a-8744-db1b5b3c4897'}, 'RetryAttempts': 0} additionalModelResponseFields=None metrics=ConverseMetrics(latencyMs=740) output=ConverseOutput(message=Message(content=[ContentBlock(image=None, text="Why don't scientists trust atoms? Because they make up everything!", toolResult=None, toolUse=None)], role='assistant')) stopReason='end_turn' usage=TokenUsage(inputTokens=22, outputTokens=16, totalTokens=38)
{
"ResponseMetadata": {
"RequestId": "427c73bb-df2d-4c1a-8744-db1b5b3c4897",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"date": "Thu, 13 Jun 2024 09:11:25 GMT",
"content-type": "application/json",
"content-length": "247",
"connection": "keep-alive",
"x-amzn-requestid": "427c73bb-df2d-4c1a-8744-db1b5b3c4897"
},
"RetryAttempts": 0
},
"metrics": {
"latencyMs": 740
},
"output": {
"message": {
"content": [
{
"text": "Why don't scientists trust atoms? Because they make up everything!"
}
],
"role": "assistant"
}
},
"stopReason": "end_turn",
"usage": {
"inputTokens": 22,
"outputTokens": 16,
"totalTokens": 38
}
}
{'RequestId': '427c73bb-df2d-4c1a-8744-db1b5b3c4897', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Thu, 13 Jun 2024 09:11:25 GMT', 'content-type': 'application/json', 'content-length': '247', 'connection': 'keep-alive', 'x-amzn-requestid': '427c73bb-df2d-4c1a-8744-db1b5b3c4897'}, 'RetryAttempts': 0}
Metadata
Release files for bedrock-types 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bedrock_types-0.1.3.tar.gz | 5.7 kB | Without provenance | Details for bedrock_types-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bedrock_types-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for bedrock_types-0.1.3-py3-none-any.whl |
Total release size: 10.2 kB
Release files / bedrock_types-0.1.3.tar.gz
| Download URL | bedrock_types-0.1.3.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
189bbca5ade725de0af8462a445daf8702c4f51bef954f04ce6bcde0c60fdd5f
|
|
BLAKE2b-256 checksum How to use checksums |
e895062b944a77283e50e226ac05e5dc59367070066daf5769a0b9365bbc3e7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Release files / bedrock_types-0.1.3-py3-none-any.whl
| Download URL | bedrock_types-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
405e82dea3786088a32ab357e7b94e5a52b32add894626137d308fc96465ac9a
|
|
BLAKE2b-256 checksum How to use checksums |
aa2bb23f56302b8083f09491e925cc77b45b5bbf821593550bfca944632b596a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Security for bedrock-types 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.