BedrockTextGeneration
Python template · sinapsis_aws_bedrock.templates.bedrock_text_generation
Overview
Template for AWS Bedrock text generation using the Converse API.
Credentials and region are resolved with boto3's default credential chain (environment variables, `~/.aws/credentials`/`~/.aws/config`, `AWS_PROFILE`, SSO, or an IAM instance/role profile).
At initialization, a bare `llm_model_name` that requires a cross-region inference profile is automatically rewritten with the region prefix (`us.`/`eu.`/`apac.`) when a matching profile exists; on-demand model ids are left unchanged.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-aws-bedrock==1.0.0uv pip install sinapsis-aws-bedrock==1.0.0uv add sinapsis-aws-bedrock==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Bedrock model configuration. `llm_model_name` must be a Bedrock model id or inference-profile id (for example `us.anthropic.claude-3-5-sonnet-20241022-v2:0`).
Required
Default: null
The name or path of the LLM model to use (e.g., 'claude-3-7-sonnet-latest', 'TheBloke/Llama-2-7B-GGUF').
Required
Default: null
Bedrock Converse generation arguments.
Optional
Default: null
Top-k sampling. Not part of `inferenceConfig`; forwarded via `additional_model_request_fields` when supported by the model.
Optional
Default: null
Nucleus sampling parameter (`inferenceConfig.topP`).
Optional
Default: null
Maximum number of tokens to generate (`inferenceConfig.maxTokens`).
Optional
Default: 4096
Sampling temperature (`inferenceConfig.temperature`).
Optional
Default: null
Custom stop sequences (`inferenceConfig.stopSequences`).
Optional
Default: null
Provider-neutral structured output config.
Optional
Default: null
Output mode. Aliased to `type`.
Optional
Default: "text"
Optional schema used for structured JSON output. Aliased to `schema`.
Optional
Default: null
Required root property names.
Optional
Default: null
Root schema properties.
Optional
Default: null
Whether extra root-level fields are allowed.
Optional
Default: null
Extra model-specific request fields forwarded verbatim as Converse `additionalModelRequestFields`.
Optional
Default: null
Optional
Default: true
Optional
Default: "</think>"
Optional
Default: "<think>"
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: BedrockTextGeneration
class_name: BedrockTextGeneration
template_input: LLMConversationInput
attributes:
init_args:
llm_model_name: us.anthropic.claude-3-5-sonnet-20241022-v2:0
completion_args:
max_tokens: 1024
temperature: 0.7Show schema-based configuration skeleton
templates:
- template_name: "BedrockTextGeneration"
class_name: "BedrockTextGeneration"
attributes:
init_args:
llm_model_name: "<required>"
completion_args:
top_k: null
top_p: null
max_tokens: 4096
temperature: null
stop_sequences: null
response_format:
type_: "text"
schema_:
required: null
properties: null
additional_properties: null
additional_model_request_fields: null
cleanup_response: true
reasoning_end_tag: "</think>"
reasoning_start_tag: "<think>"
Inheritance
sinapsis_chatbots_base.templates.llm_template_base.LLMTemplateBaseEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.