Files
gh-giuseppe-trisciuoglio-de…/skills/aws-sdk-java-v2-bedrock/references/aws-sdk-examples.md
2025-11-29 18:28:34 +08:00

229 KiB
Raw Blame History

<html lang="en"

data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system" data-a11y-link-underlines="true"

<head> <style type="text/css"> :root { --tab-size-preference: 4; } pre, code { tab-size: var(--tab-size-preference); } </style>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-15839d47b75d.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-a5c85403da8c.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-4d11e88b2383.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-5e4ede5b5be6.css" />
<script type="application/json" id="client-env">{"locale":"en","featureFlags":["actions_custom_images_public_preview_visibility","actions_custom_images_storage_billing_ui_visibility","actions_enable_snapshot_keyword","actions_image_version_event","alternate_user_config_repo","api_insights_show_missing_data_banner","attestations_filtering","attestations_sorting","billing_hide_expired_credits","billing_unfiltered_discounts","client_version_header","codespaces_prebuild_region_target_update","contentful_lp_footnotes","copilot_agent_cli_public_preview","copilot_agent_task_list_v2","copilot_agent_tasks_btn_code_nav","copilot_agent_tasks_btn_code_view","copilot_agent_tasks_btn_code_view_lines","copilot_api_agentic_issue_marshal_yaml","copilot_api_github_draft_update_issue_skill","copilot_chat_agents_empty_state","copilot_chat_attach_multiple_images","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_reduce_quota_checks","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_skip_thread_create","copilot_coding_agent_task_response","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_deprecation_notice","copilot_features_raycast_logo","copilot_file_block_ref_matching","copilot_free_to_paid_telem","copilot_ftp_hyperspace_upgrade_prompt","copilot_ftp_settings_upgrade","copilot_ftp_upgrade_to_pro_from_models","copilot_ftp_your_copilot_settings","copilot_generate_commit_message_dry_regenerate","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_insights_column_chart_axis_legibility_fix","copilot_insights_public_preview","copilot_insights_usage_export_ndjson","copilot_mission_control_feedback","copilot_mission_control_session_feedback","copilot_no_floating_button","copilot_read_shared_conversation","copilot_security_alert_assignee_options","copilot_spaces_as_attachments","copilot_spaces_ga","copilot_spark_empty_state","copilot_spark_loading_webgl","copilot_spark_progressive_error_handling","copilot_spark_use_billing_headers","copilot_stable_conversation_view","copilot_swe_agent_progress_commands","copilot_swe_agent_use_subagents","copilot_workbench_agent_seed_tool","copilot_workbench_cache","copilot_workbench_connection_reload_banner","copilot_workbench_preview_analytics","copilot_workbench_skip_repo_on_codespace","copilot_workbench_use_single_prompt","direct_to_salesforce","disable_dashboard_universe_2025_private_preview","dotcom_chat_client_side_skills","failbot_report_error_react_apps_on_page","ghost_pilot_confidence_truncation_25","ghost_pilot_confidence_truncation_40","global_search_multi_orgs","hpc_improve_dom_insertion_observer","hyperspace_2025_logged_out_batch_1","hyperspace_nudges_universe25","inp_reduced_threshold","insert_before_patch","issue_fields_report_usage","issues_copilot_cross_repo_assign","issues_react_blur_item_picker_on_close","issues_react_bots_timeline_pagination","issues_react_prohibit_title_fallback","issues_react_remove_placeholders","issues_sticky_sidebar","kb_convert_to_space","lifecycle_label_name_updates","link_contact_sales_swp_marketo","marketing_pages_search_explore_provider","mcp_registry_install","memex_mwl_filter_field_delimiter","new_traffic_page_banner","open_agent_session_in_vscode_insiders","pinned_issue_fields","primer_react_segmented_control_tooltip","primer_react_unified_portal_root","record_sso_banner_metrics","remove_child_patch","repos_insights_remove_new_url","sample_network_conn_type","scheduled_reminders_updated_limits","site_features_copilot_universe","site_homepage_collaborate_video","site_homepage_contentful","site_homepage_eyebrow_banner","site_homepage_universe_animations","site_msbuild_webgl_hero","spark_fix_rename","spark_force_push_after_checkout","spark_improve_image_upload","spark_kv_encocoded_keys","spark_show_data_access_on_publish","spark_sync_repository_after_iteration","viewscreen_sandbox","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"}</script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/high-contrast-cookie-f3788027bd8d.js"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-7afc6a27812f.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_oddbird_popover-polyfill_dist_popover-fn_js-468bf7cab607.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-2f4e04-280c10ec004d.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/environment-b4e74adb6411.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_index_mjs-3eee64e5ddf0.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-9ab93471824e.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-ef89d23fcc0a.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-0d7d60-ad3a87b2f0eb.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_text-expander-element_dist_index_js-754f5b5e9e7e.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-665e70-ac788066c220.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_markdown-toolbar-element_dist_index_js-d41270eb61be.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-777ce2-9ec8c103bf42.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-9e1d42c09c62.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-d1fc399acbec.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_braintree_browser-detection_dist_browser-detection_js-node_modules_githu-bb80ec-f11c694928ba.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9012bef51135.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_morphdom_dist_morphdom-e-c1896e-ba47f43192a8.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-893f9f-9ba0881c72fb.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_turbo_dist_turbo_es2017-esm_js-8eb9b2209bcd.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_hotkey_dist_index_js-node_modules_github_hydro-analytics-client_d-dd3ec8-1f3d5f90de2b.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_quote-selection_dist_index_js-node_modules_github_session-resume_-31b9f3-9021ed20220b.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_document-metadata_document-metadata_ts-packages_failbot_failbot_ts-06156f7d8d1a.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_updatable-content_updatable-content_ts-38f5e2f7c2a7.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_ajax-error_ts-app_assets_modules_github_behaviors_details-6493f1-cecb020e2bb7.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_task-list_ts-app_assets_modules_github_throttled-input_ts-047775-cfe8770908d1.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-d8c5bfe37d1d.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-d431b500aedc.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-ef6d0f-20d6767cecc0.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-d89a4ddd4532.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_template-parts_lib_inde-f69fd1-ead47121f2f7.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-0d71a9-129b4f34d384.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-63ecfa2887c1.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-8cfd06ba3e39.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-3eebbd-7f6bf4b8b391.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_decorators_js-node_modules_delegated-events_di-e161aa-9086b9aee9d1.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_remote--abdaf7-71f92102de66.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/repositories-7c2a36f9c401.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_catalyst_lib_inde-96937f-70732ff56a20.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-614eb4e0c016.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/primer-react-cdd6dd11a475.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/react-lib-25ef56e89e94.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/react-core-4aba40ae1474.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/octicons-react-dfcd3f5e8531.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_emotion_is-prop-valid_dist_emotion-is-prop-valid_esm_js-node_modules_emo-825c28-cdae255a4bbc.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_hydro-analytics-c-c228f9-e9af1d9bff76.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_tanstack_query-core_build_modern_mutation_js-node_modules_tanstack_query-9bf7e4-2246c69bea10.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_swc_helpers_esm__class_private_method_get_js-node_modules_swc_helpers_es-d6b1a6-13297632eddc.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_dompurify_dist_purify_es_mjs-0294cfa498e7.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lodash-es__Stack_js-node_modules_lodash-es__Uint8Array_js-node_modules_l-4faaa6-fa61bd48d446.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_hydro-analytics-client_dist_analytics-client_js-node_modules_gith-c7919d-70dcea79f7a9.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_tanstack_react-virtual_dist_esm_index_js-3274b1ed347f.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_catalyst_lib_index_js-node_modules_swc_helpers_esm__class_static_-5988f51-502ec131d853.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_decorators_js-node_modules_fzy_js_index_js-nod-a71c46-526ae0c57e8d.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_paths_index_ts-290dbd707459.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_history_history_ts-packages_promise-with-resolvers-polyfill_promise-with-resolvers-p-2cdd04-a13a722d5075.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_ref-selector_RefSelector_tsx-496d6a5b2807.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_copilot-chat_utils_copilot-local-storage_ts-a7f467d66d91.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_copilot-chat_utils_language-info_ts-packages_copy-to-clipboard_CopyToClipboardButton_tsx-d2d760dd69a4.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_commit-attribution_index_ts-packages_commit-checks-status_index_ts-packages_current--18e2dc-495db525b69f.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_diffs_diff-parts_ts-f9d7298ee7c9.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_code-view-shared_hooks_use-canonical-object_ts-packages_code-view-shared_hooks_use-f-11e2e7-07a32be2f024.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_app-uuid_app-uuid_ts-packages_repos-file-tree-view_repos-file-tree-view_ts-0977800e9d2d.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_react-code-view_utilities_lines_ts-6fb547ac9323.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/react-code-view-129296157fdc.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/packages_notifications-subscriptions-menu_entry_ts-packages_promise-with-resolvers-polyfill_p-15cb60-9c0f034a796f.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/notifications-subscriptions-menu-4f0464db38d4.js" defer="defer"></script>
<meta name="hovercard-subject-tag" content="repository:66023605" data-turbo-transient>
<meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="user-login" content="">



<meta name="viewport" content="width=device-width">



  <meta name="description" content="Welcome to the AWS Code Examples Repository.  This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below. - aws-doc-sdk-examples/javav2/example_code/bedrock-runtime at main · awsdocs/aws-doc-sdk-examples">

  <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">

<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/bedrock-runtime" />

  <meta name="twitter:image" content="https://opengraph.githubassets.com/d5cf2330e6f2e40d0d542bbbdf6f227a5a449c26775147e13a3a1413c25e8222/awsdocs/aws-doc-sdk-examples" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="aws-doc-sdk-examples/javav2/example_code/bedrock-runtime at main · awsdocs/aws-doc-sdk-examples" /><meta name="twitter:description" content="Welcome to the AWS Code Examples Repository.  This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below...." />
  <meta name="hostname" content="github.com">



    <meta name="expected-hostname" content="github.com">
  <meta name="turbo-cache-control" content="no-cache" data-turbo-transient>

<meta data-hydrostats="publish">
<meta name="turbo-body-classes" content="logged-out env-production page-responsive">
</head>
<div class="position-relative header-wrapper js-header-wrapper ">
  <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a>

  <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">
<span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span>
  <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.45f06febf6dab702a065.module.css" />

<react-partial partial-name="keyboard-shortcuts-dialog" data-ssr="false" data-attempted-ssr="false" data-react-profiling="false"

<script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}</script>
<script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_gsap_index_js-6265bea06e74.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-dc050877d1bf.js" defer="defer"></script> <script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/sessions-917229b8a853.js" defer="defer"></script>

Navigation Menu

Toggle navigation
  <a class="mr-lg-3 color-fg-inherit flex-order-2 js-prevent-focus-on-mobile-nav"
    href="/"
    aria-label="Homepage"
    data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to go to homepage&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Logomark;ref_loc:Header&quot;}">
    <svg height="32" aria-hidden="true" viewBox="0 0 24 24" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github">
<path d="M12 1C5.923 1 1 5.923 1 12c0 4.867 3.149 8.979 7.521 10.436.55.096.756-.233.756-.522 0-.262-.013-1.128-.013-2.049-2.764.509-3.479-.674-3.699-1.292-.124-.317-.66-1.293-1.127-1.554-.385-.207-.936-.715-.014-.729.866-.014 1.485.797 1.691 1.128.99 1.663 2.571 1.196 3.204.907.096-.715.385-1.196.701-1.471-2.448-.275-5.005-1.224-5.005-5.432 0-1.196.426-2.186 1.128-2.956-.111-.275-.496-1.402.11-2.915 0 0 .921-.288 3.024 1.128a10.193 10.193 0 0 1 2.75-.371c.936 0 1.871.123 2.75.371 2.104-1.43 3.025-1.128 3.025-1.128.605 1.513.221 2.64.111 2.915.701.77 1.127 1.747 1.127 2.956 0 4.222-2.571 5.157-5.019 5.432.399.344.743 1.004.743 2.035 0 1.471-.014 2.654-.014 3.025 0 .289.206.632.756.522C19.851 20.979 23 16.854 23 12c0-6.077-4.922-11-11-11Z"></path>
  <div class="d-flex flex-1 flex-order-2 text-right d-lg-none gap-2 flex-justify-end">
      <a
        href="/login?return_to=https%3A%2F%2Fgithub.com%2Fawsdocs%2Faws-doc-sdk-examples%2Ftree%2Fmain%2Fjavav2%2Fexample_code%2Fbedrock-runtime"
        class="HeaderMenu-link HeaderMenu-button d-inline-flex f5 no-underline border color-border-default rounded-2 px-2 py-1 color-fg-inherit js-prevent-focus-on-mobile-nav"
        data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/bedrock-runtime&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="008f041157b2221a78b5d2f8b408160dc9a81f3e978841edf4ef305f9ee7f0fc"
        data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to Sign in&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Sign in;ref_loc:Header&quot;}"
      >
        Sign in
      </a>
          <div class="AppHeader-appearanceSettings">
<react-partial-anchor>
  <button data-target="react-partial-anchor.anchor" id="icon-button-895c74a5-0d35-4724-985f-ca46aeabf6e3" aria-labelledby="tooltip-c04b8b8a-3a2e-4794-a0be-134af42a93f8" type="button" disabled="disabled" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium AppHeader-button HeaderMenu-link border cursor-wait">  <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-sliders Button-visual">
<path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path>
Appearance settings
  <template data-target="react-partial-anchor.template">
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.45f06febf6dab702a065.module.css" />

<react-partial partial-name="appearance-settings" data-ssr="false" data-attempted-ssr="false" data-react-profiling="true"

<script type="application/json" data-target="react-partial.embeddedData">{"props":{}}</script>
  </template>
</react-partial-anchor>
  </div>
</div>


<div class="HeaderMenu js-header-menu height-fit position-lg-relative d-lg-flex flex-column flex-auto top-0">
  <div class="HeaderMenu-wrapper d-flex flex-column flex-self-start flex-lg-row flex-auto rounded rounded-lg-0">
        <nav class="HeaderMenu-nav" aria-label="Global">
          <ul class="d-lg-flex list-style-none">
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Platform
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>
  <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 dropdown-menu-wide">
    <div class="d-lg-flex dropdown-menu-wide">
        <div class="HeaderMenu-column px-lg-4">
            <div class="">

              <ul class="list-style-none f5" >
                  <li>
GitHub Copilot
    </div>

    Write better code with AI
  </div>

                  <li>
GitHub Spark
        <span class="HeaderMenu-label">
          New
        </span>
    </div>

    Build and deploy intelligent apps
  </div>

                  <li>
GitHub Models
        <span class="HeaderMenu-label">
          New
        </span>
    </div>

    Manage and compare prompts
  </div>

                  <li>
GitHub Advanced Security
    </div>

    Find and fix vulnerabilities
  </div>

                  <li>
Actions
    </div>

    Automate any workflow
  </div>

              </ul>
            </div>
        </div>
        <div class="HeaderMenu-column px-lg-4 pb-3 pb-lg-0 border-lg-right">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

              <ul class="list-style-none f5" >
                  <li>
Codespaces
    </div>

    Instant dev environments
  </div>

                  <li>
Issues
    </div>

    Plan and track work
  </div>

                  <li>
Code Review
    </div>

    Manage code changes
  </div>

                  <li>
Discussions
    </div>

    Collaborate outside of code
  </div>

                  <li>
Code Search
    </div>

    Find more, search less
  </div>

              </ul>
            </div>
        </div>
        <div class="HeaderMenu-column px-lg-4">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 mb-3 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="platform-explore-heading">Explore</span>

              <ul class="list-style-none f5" aria-labelledby="platform-explore-heading">
                  <li>
Why GitHub

                  <li>
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                  <li>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                  <li>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
              </ul>
            </div>
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="platform-integrations-heading">Integrations</span>

              <ul class="list-style-none f5" aria-labelledby="platform-integrations-heading">
                  <li>
GitHub Marketplace

                  <li>
MCP Registry

              </ul>
            </div>
        </div>
    </div>

      <div class="HeaderMenu-trailing-link rounded-bottom-2 mt-lg-4 px-lg-4 py-4 py-lg-3 f5 text-semibold">
        <a data-analytics-event="{&quot;location&quot;:&quot;navbar&quot;,&quot;action&quot;:&quot;view_all_features&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;view_all_features_link_platform_navbar&quot;}" href="https://github.com/features">
          View all features
          <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-right HeaderMenu-trailing-link-icon">
<path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Solutions
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>
  <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 dropdown-menu-wide">
    <div class="d-lg-flex dropdown-menu-wide">
        <div class="HeaderMenu-column px-lg-4 pb-3 pb-lg-0 border-lg-right">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="solutions-by-company-size-heading">By company size</span>

              <ul class="list-style-none f5" aria-labelledby="solutions-by-company-size-heading">
                  <li>
Enterprises

                  <li>
Small and medium teams

                  <li>
Startups

                  <li>
Nonprofits

              </ul>
            </div>
        </div>
        <div class="HeaderMenu-column px-lg-4 pb-3 pb-lg-0 border-lg-right">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="solutions-by-use-case-heading">By use case</span>

              <ul class="list-style-none f5" aria-labelledby="solutions-by-use-case-heading">
                  <li>
App Modernization

                  <li>
DevSecOps

                  <li>
DevOps

                  <li>
CI/CD

                  <li>
View all use cases

              </ul>
            </div>
        </div>
        <div class="HeaderMenu-column px-lg-4">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="solutions-by-industry-heading">By industry</span>

              <ul class="list-style-none f5" aria-labelledby="solutions-by-industry-heading">
                  <li>
Healthcare

                  <li>
Financial services

                  <li>
Manufacturing

                  <li>
Government

                  <li>
View all industries

              </ul>
            </div>
        </div>
    </div>

      <div class="HeaderMenu-trailing-link rounded-bottom-2 mt-lg-4 px-lg-4 py-4 py-lg-3 f5 text-semibold">
        <a data-analytics-event="{&quot;location&quot;:&quot;navbar&quot;,&quot;action&quot;:&quot;view_all_solutions&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;view_all_solutions_link_solutions_navbar&quot;}" href="/solutions">
          View all solutions
          <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-right HeaderMenu-trailing-link-icon">
<path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Resources
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>
  <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 dropdown-menu-wide">
    <div class="d-lg-flex dropdown-menu-wide">
        <div class="HeaderMenu-column px-lg-4 pb-3 pb-lg-0 border-lg-right">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 pb-3">

                  <span class="d-block h4 color-fg-default my-1" id="resources-topics-heading">Topics</span>

              <ul class="list-style-none f5" aria-labelledby="resources-topics-heading">
                  <li>
AI

                  <li>
DevOps

                  <li>
Security

                  <li>
Software Development

                  <li>
View all

              </ul>
            </div>
        </div>
        <div class="HeaderMenu-column px-lg-4">
            <div class="border-bottom border-lg-bottom-0 pb-lg-0 border-bottom-0">

                  <span class="d-block h4 color-fg-default my-1" id="resources-explore-heading">Explore</span>

              <ul class="list-style-none f5" aria-labelledby="resources-explore-heading">
                  <li>
Learning Pathways
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                  <li>
Events & Webinars

                  <li>
Ebooks & Whitepapers

                  <li>
Customer Stories

                  <li>
Partners

                  <li>
Executive Insights

              </ul>
            </div>
        </div>
    </div>

  </div>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Open Source
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>
  <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4">
    <div class="d-lg-flex dropdown-menu-wide">
        <div class="HeaderMenu-column px-lg-4">
            <div class="border-bottom mb-3 mb-lg-3 pb-3">

              <ul class="list-style-none f5" >
                  <li>
  <div>
    <div class="color-fg-default h4">
      GitHub Sponsors

    </div>

    Fund open source developers
  </div>

              </ul>
            </div>
            <div class="border-bottom mb-3 mb-lg-3 pb-3">

              <ul class="list-style-none f5" >
                  <li>
  <div>
    <div class="color-fg-default h4">
      The ReadME Project

    </div>

    GitHub community articles
  </div>

              </ul>
            </div>
            <div class="border-bottom border-bottom-0">

                  <span class="d-block h4 color-fg-default my-1" id="open-source-repositories-heading">Repositories</span>

              <ul class="list-style-none f5" aria-labelledby="open-source-repositories-heading">
                  <li>
Topics

                  <li>
Trending

                  <li>
Collections

              </ul>
            </div>
        </div>
    </div>

  </div>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Enterprise
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>
  <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4">
    <div class="d-lg-flex dropdown-menu-wide">
        <div class="HeaderMenu-column px-lg-4">
            <div class="border-bottom mb-3 mb-lg-3 pb-3">

              <ul class="list-style-none f5" >
                  <li>
Enterprise platform
    </div>

    AI-powered developer platform
  </div>

              </ul>
            </div>
            <div class="border-bottom border-bottom-0">

                  <span class="d-block h4 color-fg-default my-1" id="enterprise-available-add-ons-heading">Available add-ons</span>

              <ul class="list-style-none f5" aria-labelledby="enterprise-available-add-ons-heading">
                  <li>
GitHub Advanced Security
    </div>

    Enterprise-grade security features
  </div>

                  <li>
Copilot for business
    </div>

    Enterprise-grade AI features
  </div>

                  <li>
Premium Support
    </div>

    Enterprise-grade 24/7 support
  </div>

              </ul>
            </div>
        </div>
    </div>

  </div>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
<a class="HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block" data-analytics-event="{&quot;location&quot;:&quot;navbar&quot;,&quot;action&quot;:&quot;platform&quot;,&quot;context&quot;:&quot;global&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;platform_link_global_navbar&quot;}" href="https://github.com/pricing">Pricing</a>
          </ul>
        </nav>

    <div class="d-flex flex-column flex-lg-row width-full flex-justify-end flex-lg-items-center text-center mt-3 mt-lg-0 text-lg-left ml-lg-3">
Search or jump to...
<input type="hidden" name="type" class="js-site-search-type-field">

Search code, repositories, users, issues, pull requests...

      <div data-view-component="true">        <div class="search-suggestions position-fixed width-full color-shadow-large border color-fg-default color-bg-default overflow-hidden d-flex flex-column query-builder-container"
      style="border-radius: 12px;"
      data-target="qbsearch-input.queryBuilderContainer"
      hidden
    >
      <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="query-builder-test-form" action="" accept-charset="UTF-8" method="get">
Clear
  </div>
  <template id="search-icon">
    <div class="position-relative">
            <ul
              role="listbox"
              class="ActionListWrap QueryBuilder-ListWrap"
              aria-label="Suggestions"
              data-action="
                combobox-commit:query-builder#comboboxCommit
                mousedown:query-builder#resultsMousedown
              "
              data-target="query-builder.resultsList"
              data-persist-list=false
              id="query-builder-test-results"
              tabindex="-1"
            ></ul>
    </div>
  <div class="FormControl-inlineValidation" id="validation-47e3176d-3389-454c-89c3-37eded2c8397" hidden="hidden">
    <span class="FormControl-inlineValidation--visual">
      <svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-alert-fill">
<path d="M4.855.708c.5-.896 1.79-.896 2.29 0l4.675 8.351a1.312 1.312 0 0 1-1.146 1.954H1.33A1.313 1.313 0 0 1 .183 9.058ZM7 7V3H5v4Zm-1 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path>
</div>

Provide feedback

</div>
<div class="Overlay-actionWrap">
  <button data-close-dialog-id="feedback-dialog" aria-label="Close" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>

We read every piece of feedback, and take your input very seriously.

Cancel Submit feedback
<custom-scopes data-target="qbsearch-input.customScopesManager">

Saved searches

Use saved searches to filter your results more quickly

    <div hidden class="create-custom-scope-form" data-target="custom-scopes.createCustomScopeForm">
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="custom-scopes-dialog-form" data-turbo="false" action="/search/custom_scopes" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="aZ0DlBH+hF4gpQApWdrWitxPe8R+t9VSy+4+/Ua0NPx0djiLngZS4HU1Unwsg26dAnbVWp8QpWJkn8BMoka3hA==" />
      <div data-target="custom-scopes.customScopesModalDialogFlash"></div>

      <input type="hidden" id="custom_scope_id" name="custom_scope_id" data-target="custom-scopes.customScopesIdField">

      <div class="form-group">
        <label for="custom_scope_name">Name</label>
        <auto-check src="/search/custom_scopes/check_name" required>
          <input
            type="text"
            name="custom_scope_name"
            id="custom_scope_name"
            data-target="custom-scopes.customScopesNameField"
            class="form-control"
            autocomplete="off"
            placeholder="github-ruby"
            required
            maxlength="50">
          <input type="hidden" data-csrf="true" value="SFpfDQdLy3Vi8+SgHeJVBZD4yKawzamrCrpLLT8osUFoL+j0/gnktcXFYPP9PKn9gpAEt8NTpZpNzF+O7m8v5Q==" />
        </auto-check>
      </div>

      <div class="form-group">
        <label for="custom_scope_query">Query</label>
        <input
          type="text"
          name="custom_scope_query"
          id="custom_scope_query"
          data-target="custom-scopes.customScopesQueryField"
          class="form-control"
          autocomplete="off"
          placeholder="(repo:mona/a OR repo:mona/b) AND lang:python"
          required
          maxlength="500">
      </div>

      <p class="text-small color-fg-muted">
        To see all available qualifiers, see our <a class="Link--inTextBlock" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax">documentation</a>.
      </p>
    <div data-target="custom-scopes.manageCustomScopesForm">
      <div data-target="custom-scopes.list"></div>
    </div>
Cancel Create saved search
        <div class="position-relative HeaderMenu-link-wrap d-lg-inline-block">
          <a
            href="/login?return_to=https%3A%2F%2Fgithub.com%2Fawsdocs%2Faws-doc-sdk-examples%2Ftree%2Fmain%2Fjavav2%2Fexample_code%2Fbedrock-runtime"
            class="HeaderMenu-link HeaderMenu-link--sign-in HeaderMenu-button flex-shrink-0 no-underline d-none d-lg-inline-flex border border-lg-0 rounded px-2 py-1"
            style="margin-left: 12px;"
            data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/bedrock-runtime&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="008f041157b2221a78b5d2f8b408160dc9a81f3e978841edf4ef305f9ee7f0fc"
            data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to go to homepage&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Sign in;ref_loc:Header&quot;}"
          >
            Sign in
          </a>
        </div>

          <a href="/signup?ref_cta=Sign+up&amp;ref_loc=header+logged+out&amp;ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Ffiles%2Fdisambiguate&amp;source=header-repo&amp;source_repo=awsdocs%2Faws-doc-sdk-examples"
            class="HeaderMenu-link HeaderMenu-link--sign-up HeaderMenu-button flex-shrink-0 d-flex d-lg-inline-flex no-underline border color-border-default rounded px-2 py-1"
            data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/bedrock-runtime&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="008f041157b2221a78b5d2f8b408160dc9a81f3e978841edf4ef305f9ee7f0fc"
            data-analytics-event="{&quot;category&quot;:&quot;Sign up&quot;,&quot;action&quot;:&quot;click to sign up for account&quot;,&quot;label&quot;:&quot;ref_page:/&lt;user-name&gt;/&lt;repo-name&gt;/files/disambiguate;ref_cta:Sign up;ref_loc:header logged out&quot;}"
          >
            Sign up
          </a>

            <div class="AppHeader-appearanceSettings">
<react-partial-anchor>
  <button data-target="react-partial-anchor.anchor" id="icon-button-5fed235f-2f5e-4c85-b6b5-6d9890244fd6" aria-labelledby="tooltip-2a7f9bd1-3110-41c8-8187-e1c8b7b6cfba" type="button" disabled="disabled" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium AppHeader-button HeaderMenu-link border cursor-wait">  <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-sliders Button-visual">
<path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path>
Appearance settings
  <template data-target="react-partial-anchor.template">
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.45f06febf6dab702a065.module.css" />

<react-partial partial-name="appearance-settings" data-ssr="false" data-attempted-ssr="false" data-react-profiling="true"

<script type="application/json" data-target="react-partial.embeddedData">{"props":{}}</script>
  </template>
</react-partial-anchor>
      <button type="button" class="sr-only js-header-menu-focus-trap d-block d-lg-none">Resetting focus</button>
    </div>
  </div>
</div>
  <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full">

    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
<path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
<button id="icon-button-7dc5dcf0-a901-4261-8467-78de22a2e324" aria-labelledby="tooltip-a1b380d4-c0c5-4519-953b-ceb3a89ac6d1" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close">  <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
Dismiss alert
<div id="js-flash-container" class="flash-container" data-turbo-replace>
  <div>{{ message }}</div>

</div>
  <div class="d-flex flex-nowrap flex-justify-end mb-3  px-3 px-lg-5" style="gap: 1rem;">

    <div class="flex-auto min-width-0 width-fit">
<span class="author flex-self-stretch" itemprop="author">
  <a class="url fn" rel="author" data-hovercard-type="organization" data-hovercard-url="/orgs/awsdocs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/awsdocs">
    awsdocs

/ aws-doc-sdk-examples

<span></span><span class="Label Label--secondary v-align-middle mr-1">Public</span>
    </div>

    <div id="repository-details-container" class="flex-shrink-0" data-turbo-replace style="max-width: 70%;">
        <ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;">
  • <div data-hide-on-error>
        
          <button aria-label="Watching a repository" type="button" disabled="disabled" data-view-component="true" class="Button--secondary Button--small Button">  <span class="Button-content">
      <span class="Button-visual Button-leadingVisual">
        <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-eye">
    <path d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"></path>
    
    Watch
    </div>
    <p data-show-on-error hidden>
        
          <span class="d-flex pt-1">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert mr-1">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
    
    Couldn't load subscription status.  Retry
          </span>
    
    </p>
    
      <h3 data-view-component="true" class="blankslate-heading">        Uh oh!
    

    There was an error while loading. Please reload this page.

  • Fork 5.8k
  •     </div>
      </div>
    
        <div id="responsive-meta-container" data-turbo-replace>
    
          <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
    
    Additional navigation options
      <div data-view-component="true" class="Overlay-body Overlay-body--paddingNone">          <action-list>
    
    • <a tabindex="-1" id="item-867e239a-504d-4bb7-8fa8-01735ab0b120" href="/awsdocs/aws-doc-sdk-examples" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code">
      <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Code
      
    • <a tabindex="-1" id="item-b7d5472c-832a-4239-ba6f-5db292be4d35" href="/awsdocs/aws-doc-sdk-examples/issues" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened">
      <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Issues
      
    • <a tabindex="-1" id="item-a0e98666-5eb0-4134-b112-64e7a7f6ebcc" href="/awsdocs/aws-doc-sdk-examples/pulls" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request">
      <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Pull requests
      
    • <a tabindex="-1" id="item-dbf25313-d30a-4355-ac65-397e6449f8c4" href="/awsdocs/aws-doc-sdk-examples/actions" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play">
      <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Actions
      
    • <a tabindex="-1" id="item-a94709ea-fc20-42e0-8995-fbd205707d19" href="/awsdocs/aws-doc-sdk-examples/projects" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table">
      <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Projects
      
    • <a tabindex="-1" id="item-3491046b-5e55-45c5-aafd-5fbaacf08fb5" href="/awsdocs/aws-doc-sdk-examples/wiki" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-book">
      <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Wiki
      
    • <a tabindex="-1" id="item-0707d35f-9925-40d3-8515-bf8fa8111586" href="/awsdocs/aws-doc-sdk-examples/security" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield">
      <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Security
      
    • <a tabindex="-1" id="item-5ebffc5a-bfaf-4ef5-af1b-452612127352" href="/awsdocs/aws-doc-sdk-examples/pulse" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
          <span class="ActionListItem-visual ActionListItem-visual--leading">
            <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph">
      <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path>
      
          <span data-view-component="true" class="ActionListItem-label">
            Insights
      

    <react-app app-name="react-code-view" initial-path="/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/bedrock-runtime" style="display: block; min-height: calc(100vh - 64px);" data-attempted-ssr="false" data-ssr="false" data-lazy="false" data-alternate="false" data-data-router-enabled="false" data-react-profiling="false"

    <script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"path":"javav2/example_code/bedrock-runtime","repo":{"id":66023605,"defaultBranch":"main","name":"aws-doc-sdk-examples","ownerLogin":"awsdocs","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2016-08-18T19:06:57.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/8661631?v=4","public":true,"private":false,"isOrgOwned":true},"currentUser":null,"refInfo":{"name":"main","listCacheKey":"v0:1761223143.0","canEdit":false,"refType":"branch","currentOid":"309de24d867a2b3f01d4da8018ad8173243556af"},"tree":{"items":[{"name":"src","path":"javav2/example_code/bedrock-runtime/src","contentType":"directory"},{"name":".gitignore","path":"javav2/example_code/bedrock-runtime/.gitignore","contentType":"file"},{"name":"README.md","path":"javav2/example_code/bedrock-runtime/README.md","contentType":"file"},{"name":"pom.xml","path":"javav2/example_code/bedrock-runtime/pom.xml","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAmazon Bedrock Runtime code examples for the SDK for Java 2.x\u003c/h1\u003e\u003ca id=\"user-content-amazon-bedrock-runtime-code-examples-for-the-sdk-for-java-2x\" class=\"anchor\" aria-label=\"Permalink: Amazon Bedrock Runtime code examples for the SDK for Java 2.x\" href=\"#amazon-bedrock-runtime-code-examples-for-the-sdk-for-java-2x\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOverview\u003c/h2\u003e\u003ca id=\"user-content-overview\" class=\"anchor\" aria-label=\"Permalink: Overview\" href=\"#overview\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eShows how to use the AWS SDK for Java 2.x to work with Amazon Bedrock Runtime.\u003c/p\u003e\n\n\n\u003cp dir=\"auto\"\u003e\u003cem\u003eAmazon Bedrock Runtime is a fully managed service that makes it easy to use foundation models from third-party providers and Amazon.\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e⚠ Important\u003c/h2\u003e\u003ca id=\"user-content--important\" class=\"anchor\" aria-label=\"Permalink: ⚠ Important\" href=\"#-important\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRunning this code might result in charges to your AWS account. For more details, see \u003ca href=\"https://aws.amazon.com/pricing/\" rel=\"nofollow\"\u003eAWS Pricing\u003c/a\u003e and \u003ca href=\"https://aws.amazon.com/free/\" rel=\"nofollow\"\u003eFree Tier\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eRunning the tests might result in charges to your AWS account.\u003c/li\u003e\n\u003cli\u003eWe recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see \u003ca href=\"https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege\" rel=\"nofollow\"\u003eGrant least privilege\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eThis code is not tested in every AWS Region. For more information, see \u003ca href=\"https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services\" rel=\"nofollow\"\u003eAWS Regional Services\u003c/a\u003e.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eNote: This project uses JDK 21\u003c/strong\u003e\u003c/p\u003e\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCode examples\u003c/h2\u003e\u003ca id=\"user-content-code-examples\" class=\"anchor\" aria-label=\"Permalink: Code examples\" href=\"#code-examples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePrerequisites\u003c/h3\u003e\u003ca id=\"user-content-prerequisites\" class=\"anchor\" aria-label=\"Permalink: Prerequisites\" href=\"#prerequisites\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor prerequisites, see the \u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/README.md#Prerequisites\"\u003eREADME\u003c/a\u003e in the \u003ccode\u003ejavav2\u003c/code\u003e folder.\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e⚠ You must request access to a model before you can use it. If you try to use the model (with the API or console)\nbefore you have requested access to it, you will receive an error message. For more information,\nsee \u003ca href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html\" rel=\"nofollow\"\u003eModel access\u003c/a\u003e.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eScenarios\u003c/h3\u003e\u003ca id=\"user-content-scenarios\" class=\"anchor\" aria-label=\"Permalink: Scenarios\" href=\"#scenarios\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCode examples that show you how to accomplish a specific task by calling multiple\nfunctions within the same service.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/usecases/video_generation_bedrock_nova_reel/src/main/java/com/example/novareel/VideoGenerationService.java\"\u003eGenerate videos from text prompts using Amazon Bedrock\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/scenario/BedrockScenario.java\"\u003eTool use with the Converse API\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAmazon Nova\u003c/h3\u003e\u003ca id=\"user-content-amazon-nova\" class=\"anchor\" aria-label=\"Permalink: Amazon Nova\" href=\"#amazon-nova\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/amazon/nova/text/ConverseAsync.java#L6\"\u003eConverse\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/amazon/nova/text/ConverseStream.java#L6\"\u003eConverseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/scenario/BedrockScenario.java#L15\"\u003eScenario: Tool use with the Converse API\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAmazon Nova Canvas\u003c/h3\u003e\u003ca id=\"user-content-amazon-nova-canvas\" class=\"anchor\" aria-label=\"Permalink: Amazon Nova Canvas\" href=\"#amazon-nova-canvas\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/amazon/nova/canvas/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAmazon Titan Image Generator\u003c/h3\u003e\u003ca id=\"user-content-amazon-titan-image-generator\" class=\"anchor\" aria-label=\"Permalink: Amazon Titan Image Generator\" href=\"#amazon-titan-image-generator\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/amazonTitanImage/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAmazon Titan Text Embeddings\u003c/h3\u003e\u003ca id=\"user-content-amazon-titan-text-embeddings\" class=\"anchor\" aria-label=\"Permalink: Amazon Titan Text Embeddings\" href=\"#amazon-titan-text-embeddings\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/amazonTitanTextEmbeddings/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAnthropic Claude\u003c/h3\u003e\u003ca id=\"user-content-anthropic-claude\" class=\"anchor\" aria-label=\"Permalink: Anthropic Claude\" href=\"#anthropic-claude\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/Converse.java#L6\"\u003eConverse\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/ConverseStream.java#L6\"\u003eConverseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/InvokeModelWithResponseStream.java#L6\"\u003eInvokeModelWithResponseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/ReasoningAsync.java#L6\"\u003eReasoning\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/anthropicClaude/ReasoningStream.java#L6\"\u003eReasoning with a streaming response\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCohere Command\u003c/h3\u003e\u003ca id=\"user-content-cohere-command\" class=\"anchor\" aria-label=\"Permalink: Cohere Command\" href=\"#cohere-command\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/cohereCommand/Converse.java#L6\"\u003eConverse\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/cohereCommand/ConverseStream.java#L6\"\u003eConverseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/cohereCommand/Command_R_InvokeModel.java#L6\"\u003eInvokeModel: Command R and R+\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/cohereCommand/Command_R_InvokeModelWithResponseStream.java#L6\"\u003eInvokeModelWithResponseStream: Command R and R+\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMeta Llama\u003c/h3\u003e\u003ca id=\"user-content-meta-llama\" class=\"anchor\" aria-label=\"Permalink: Meta Llama\" href=\"#meta-llama\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/metaLlama/Converse.java#L6\"\u003eConverse\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/metaLlama/ConverseStream.java#L6\"\u003eConverseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/metaLlama/Llama3_InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/metaLlama/Llama3_InvokeModelWithResponseStream.java#L6\"\u003eInvokeModelWithResponseStream\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMistral AI\u003c/h3\u003e\u003ca id=\"user-content-mistral-ai\" class=\"anchor\" aria-label=\"Permalink: Mistral AI\" href=\"#mistral-ai\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/mistral/Converse.java#L6\"\u003eConverse\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/mistral/ConverseStream.java#L6\"\u003eConverseStream\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/mistral/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/mistral/InvokeModelWithResponseStream.java#L6\"\u003eInvokeModelWithResponseStream\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStable Diffusion\u003c/h3\u003e\u003ca id=\"user-content-stable-diffusion\" class=\"anchor\" aria-label=\"Permalink: Stable Diffusion\" href=\"#stable-diffusion\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/models/stabilityAi/InvokeModel.java#L6\"\u003eInvokeModel\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRun the examples\u003c/h2\u003e\u003ca id=\"user-content-run-the-examples\" class=\"anchor\" aria-label=\"Permalink: Run the examples\" href=\"#run-the-examples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInstructions\u003c/h3\u003e\u003ca id=\"user-content-instructions\" class=\"anchor\" aria-label=\"Permalink: Instructions\" href=\"#instructions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGenerate videos from text prompts using Amazon Bedrock\u003c/h4\u003e\u003ca id=\"user-content-generate-videos-from-text-prompts-using-amazon-bedrock\" class=\"anchor\" aria-label=\"Permalink: Generate videos from text prompts using Amazon Bedrock\" href=\"#generate-videos-from-text-prompts-using-amazon-bedrock\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis example shows you how to a Spring Boot app that generates videos from text prompts using Amazon Bedrock and the Nova-Reel model.\u003c/p\u003e\n\n\n\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTool use with the Converse API\u003c/h4\u003e\u003ca id=\"user-content-tool-use-with-the-converse-api\" class=\"anchor\" aria-label=\"Permalink: Tool use with the Converse API\" href=\"#tool-use-with-the-converse-api\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis example shows you how to build a typical interaction between an application, a generative AI model, and connected tools or APIs to mediate interactions between the AI and the outside world. It uses the example of connecting an external weather API to the AI model so it can provide real-time weather information based on user input.\u003c/p\u003e\n\n\n\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTests\u003c/h3\u003e\u003ca id=\"user-content-tests\" class=\"anchor\" aria-label=\"Permalink: Tests\" href=\"#tests\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e⚠ Running tests might result in charges to your AWS account.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo find instructions for running these tests, see the \u003ca href=\"/awsdocs/aws-doc-sdk-examples/blob/main/javav2/README.md#Tests\"\u003eREADME\u003c/a\u003e\nin the \u003ccode\u003ejavav2\u003c/code\u003e folder.\u003c/p\u003e\n\n\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdditional resources\u003c/h2\u003e\u003ca id=\"user-content-additional-resources\" class=\"anchor\" aria-label=\"Permalink: Additional resources\" href=\"#additional-resources\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html\" rel=\"nofollow\"\u003eAmazon Bedrock Runtime User Guide\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/welcome.html\" rel=\"nofollow\"\u003eAmazon Bedrock Runtime API Reference\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/bedrock-runtime/package-summary.html\" rel=\"nofollow\"\u003eSDK for Java 2.x Amazon Bedrock Runtime reference\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\n\u003chr\u003e\n\u003cp dir=\"auto\"\u003eCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSPDX-License-Identifier: Apache-2.0\u003c/p\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"Amazon Bedrock Runtime code examples for the SDK for Java 2.x","anchor":"amazon-bedrock-runtime-code-examples-for-the-sdk-for-java-2x","htmlText":"Amazon Bedrock Runtime code examples for the SDK for Java 2.x"},{"level":2,"text":"Overview","anchor":"overview","htmlText":"Overview"},{"level":2,"text":"⚠ Important","anchor":"-important","htmlText":"⚠ Important"},{"level":2,"text":"Code examples","anchor":"code-examples","htmlText":"Code examples"},{"level":3,"text":"Prerequisites","anchor":"prerequisites","htmlText":"Prerequisites"},{"level":3,"text":"Scenarios","anchor":"scenarios","htmlText":"Scenarios"},{"level":3,"text":"Amazon Nova","anchor":"amazon-nova","htmlText":"Amazon Nova"},{"level":3,"text":"Amazon Nova Canvas","anchor":"amazon-nova-canvas","htmlText":"Amazon Nova Canvas"},{"level":3,"text":"Amazon Titan Image Generator","anchor":"amazon-titan-image-generator","htmlText":"Amazon Titan Image Generator"},{"level":3,"text":"Amazon Titan Text Embeddings","anchor":"amazon-titan-text-embeddings","htmlText":"Amazon Titan Text Embeddings"},{"level":3,"text":"Anthropic Claude","anchor":"anthropic-claude","htmlText":"Anthropic Claude"},{"level":3,"text":"Cohere Command","anchor":"cohere-command","htmlText":"Cohere Command"},{"level":3,"text":"Meta Llama","anchor":"meta-llama","htmlText":"Meta Llama"},{"level":3,"text":"Mistral AI","anchor":"mistral-ai","htmlText":"Mistral AI"},{"level":3,"text":"Stable Diffusion","anchor":"stable-diffusion","htmlText":"Stable Diffusion"},{"level":2,"text":"Run the examples","anchor":"run-the-examples","htmlText":"Run the examples"},{"level":3,"text":"Instructions","anchor":"instructions","htmlText":"Instructions"},{"level":4,"text":"Generate videos from text prompts using Amazon Bedrock","anchor":"generate-videos-from-text-prompts-using-amazon-bedrock","htmlText":"Generate videos from text prompts using Amazon Bedrock"},{"level":4,"text":"Tool use with the Converse API","anchor":"tool-use-with-the-converse-api","htmlText":"Tool use with the Converse API"},{"level":3,"text":"Tests","anchor":"tests","htmlText":"Tests"},{"level":2,"text":"Additional resources","anchor":"additional-resources","htmlText":"Additional resources"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fawsdocs%2Faws-doc-sdk-examples%2Ftree%2Fmain%2Fjavav2%2Fexample_code%2Fbedrock-runtime"}},"totalCount":4,"showBranchInfobar":false},"fileTree":{"javav2/example_code":{"items":[{"name":"acm","path":"javav2/example_code/acm","contentType":"directory"},{"name":"apigateway","path":"javav2/example_code/apigateway","contentType":"directory"},{"name":"appautoscale","path":"javav2/example_code/appautoscale","contentType":"directory"},{"name":"appsync","path":"javav2/example_code/appsync","contentType":"directory"},{"name":"athena","path":"javav2/example_code/athena","contentType":"directory"},{"name":"autoscale","path":"javav2/example_code/autoscale","contentType":"directory"},{"name":"batch","path":"javav2/example_code/batch","contentType":"directory"},{"name":"bedrock-agent","path":"javav2/example_code/bedrock-agent","contentType":"directory"},{"name":"bedrock-agents-runtime","path":"javav2/example_code/bedrock-agents-runtime","contentType":"directory"},{"name":"bedrock-runtime","path":"javav2/example_code/bedrock-runtime","contentType":"directory"},{"name":"bedrock","path":"javav2/example_code/bedrock","contentType":"directory"},{"name":"cloudformation","path":"javav2/example_code/cloudformation","contentType":"directory"},{"name":"cloudfront","path":"javav2/example_code/cloudfront","contentType":"directory"},{"name":"cloudtrail","path":"javav2/example_code/cloudtrail","contentType":"directory"},{"name":"cloudwatch-logs","path":"javav2/example_code/cloudwatch-logs","contentType":"directory"},{"name":"cloudwatch","path":"javav2/example_code/cloudwatch","contentType":"directory"},{"name":"codecommit","path":"javav2/example_code/codecommit","contentType":"directory"},{"name":"codedeploy","path":"javav2/example_code/codedeploy","contentType":"directory"},{"name":"codepipeline","path":"javav2/example_code/codepipeline","contentType":"directory"},{"name":"cognito","path":"javav2/example_code/cognito","contentType":"directory"},{"name":"comprehend","path":"javav2/example_code/comprehend","contentType":"directory"},{"name":"connect","path":"javav2/example_code/connect","contentType":"directory"},{"name":"dynamodb","path":"javav2/example_code/dynamodb","contentType":"directory"},{"name":"dynamodbasync","path":"javav2/example_code/dynamodbasync","contentType":"directory"},{"name":"ec2","path":"javav2/example_code/ec2","contentType":"directory"},{"name":"ecr","path":"javav2/example_code/ecr","contentType":"directory"},{"name":"ecs","path":"javav2/example_code/ecs","contentType":"directory"},{"name":"elasticbeanstalk","path":"javav2/example_code/elasticbeanstalk","contentType":"directory"},{"name":"emr","path":"javav2/example_code/emr","contentType":"directory"},{"name":"entityresolution","path":"javav2/example_code/entityresolution","contentType":"directory"},{"name":"eventbridge","path":"javav2/example_code/eventbridge","contentType":"directory"},{"name":"firehose","path":"javav2/example_code/firehose","contentType":"directory"},{"name":"forecast","path":"javav2/example_code/forecast","contentType":"directory"},{"name":"glacier","path":"javav2/example_code/glacier","contentType":"directory"},{"name":"glue","path":"javav2/example_code/glue","contentType":"directory"},{"name":"guardduty","path":"javav2/example_code/guardduty","contentType":"directory"},{"name":"iam","path":"javav2/example_code/iam","contentType":"directory"},{"name":"identitystore","path":"javav2/example_code/identitystore","contentType":"directory"},{"name":"iot","path":"javav2/example_code/iot","contentType":"directory"},{"name":"iotfleetwise","path":"javav2/example_code/iotfleetwise","contentType":"directory"},{"name":"iotsitewise","path":"javav2/example_code/iotsitewise","contentType":"directory"},{"name":"kendra","path":"javav2/example_code/kendra","contentType":"directory"},{"name":"keyspaces","path":"javav2/example_code/keyspaces","contentType":"directory"},{"name":"kinesis","path":"javav2/example_code/kinesis","contentType":"directory"},{"name":"kms","path":"javav2/example_code/kms","contentType":"directory"},{"name":"lambda","path":"javav2/example_code/lambda","contentType":"directory"},{"name":"lex","path":"javav2/example_code/lex","contentType":"directory"},{"name":"location","path":"javav2/example_code/location","contentType":"directory"},{"name":"lookoutvision","path":"javav2/example_code/lookoutvision","contentType":"directory"},{"name":"mediaconvert","path":"javav2/example_code/mediaconvert","contentType":"directory"},{"name":"mediastore","path":"javav2/example_code/mediastore","contentType":"directory"},{"name":"medicalimaging","path":"javav2/example_code/medicalimaging","contentType":"directory"},{"name":"memorydb","path":"javav2/example_code/memorydb","contentType":"directory"},{"name":"migrationhub","path":"javav2/example_code/migrationhub","contentType":"directory"},{"name":"mq","path":"javav2/example_code/mq","contentType":"directory"},{"name":"neptune","path":"javav2/example_code/neptune","contentType":"directory"},{"name":"opensearch","path":"javav2/example_code/opensearch","contentType":"directory"},{"name":"personalize","path":"javav2/example_code/personalize","contentType":"directory"},{"name":"pinpoint","path":"javav2/example_code/pinpoint","contentType":"directory"},{"name":"polly","path":"javav2/example_code/polly","contentType":"directory"},{"name":"quicksight","path":"javav2/example_code/quicksight","contentType":"directory"},{"name":"rds","path":"javav2/example_code/rds","contentType":"directory"},{"name":"redshift","path":"javav2/example_code/redshift","contentType":"directory"},{"name":"rekognition","path":"javav2/example_code/rekognition","contentType":"directory"},{"name":"route53","path":"javav2/example_code/route53","contentType":"directory"},{"name":"route53recoverycluster","path":"javav2/example_code/route53recoverycluster","contentType":"directory"},{"name":"s3","path":"javav2/example_code/s3","contentType":"directory"},{"name":"sagemaker","path":"javav2/example_code/sagemaker","contentType":"directory"},{"name":"scheduler","path":"javav2/example_code/scheduler","contentType":"directory"},{"name":"secrets-manager","path":"javav2/example_code/secrets-manager","contentType":"directory"},{"name":"ses","path":"javav2/example_code/ses","contentType":"directory"},{"name":"sns","path":"javav2/example_code/sns","contentType":"directory"},{"name":"sqs-jms","path":"javav2/example_code/sqs-jms","contentType":"directory"},{"name":"sqs","path":"javav2/example_code/sqs","contentType":"directory"},{"name":"ssm","path":"javav2/example_code/ssm","contentType":"directory"},{"name":"stepfunctions","path":"javav2/example_code/stepfunctions","contentType":"directory"},{"name":"sts","path":"javav2/example_code/sts","contentType":"directory"},{"name":"support","path":"javav2/example_code/support","contentType":"directory"},{"name":"swf","path":"javav2/example_code/swf","contentType":"directory"},{"name":"textract","path":"javav2/example_code/textract","contentType":"directory"},{"name":"timestream","path":"javav2/example_code/timestream","contentType":"directory"},{"name":"transcribe-streaming","path":"javav2/example_code/transcribe-streaming","contentType":"directory"},{"name":"transcribe","path":"javav2/example_code/transcribe","contentType":"directory"},{"name":"translate","path":"javav2/example_code/translate","contentType":"directory"},{"name":"workdocs","path":"javav2/example_code/workdocs","contentType":"directory"},{"name":"xray","path":"javav2/example_code/xray","contentType":"directory"}],"totalCount":86},"javav2":{"items":[{"name":"example_code","path":"javav2/example_code","contentType":"directory"},{"name":"usecases","path":"javav2/usecases","contentType":"directory"},{"name":"Dockerfile","path":"javav2/Dockerfile","contentType":"file"},{"name":"README.md","path":"javav2/README.md","contentType":"file"},{"name":"premium-ex.md","path":"javav2/premium-ex.md","contentType":"file"},{"name":"run_tests.sh","path":"javav2/run_tests.sh","contentType":"file"}],"totalCount":6},"":{"items":[{"name":".doc_gen","path":".doc_gen","contentType":"directory"},{"name":".dotnet","path":".dotnet","contentType":"directory"},{"name":".git-hooks","path":".git-hooks","contentType":"directory"},{"name":".github","path":".github","contentType":"directory"},{"name":".tools","path":".tools","contentType":"directory"},{"name":"applications","path":"applications","contentType":"directory"},{"name":"aws-cfn","path":"aws-cfn","contentType":"directory"},{"name":"aws-cli","path":"aws-cli","contentType":"directory"},{"name":"cpp","path":"cpp","contentType":"directory"},{"name":"dotnetv3","path":"dotnetv3","contentType":"directory"},{"name":"dotnetv4","path":"dotnetv4","contentType":"directory"},{"name":"go","path":"go","contentType":"directory"},{"name":"gov2","path":"gov2","contentType":"directory"},{"name":"java","path":"java","contentType":"directory"},{"name":"javascript","path":"javascript","contentType":"directory"},{"name":"javascriptv3","path":"javascriptv3","contentType":"directory"},{"name":"javav2","path":"javav2","contentType":"directory"},{"name":"kotlin","path":"kotlin","contentType":"directory"},{"name":"php","path":"php","contentType":"directory"},{"name":"python","path":"python","contentType":"directory"},{"name":"resources","path":"resources","contentType":"directory"},{"name":"ruby","path":"ruby","contentType":"directory"},{"name":"rust_dev_preview","path":"rust_dev_preview","contentType":"directory"},{"name":"rustv1","path":"rustv1","contentType":"directory"},{"name":"sap-abap","path":"sap-abap","contentType":"directory"},{"name":"scenarios","path":"scenarios","contentType":"directory"},{"name":"swift","path":"swift","contentType":"directory"},{"name":".abapgit.xml","path":".abapgit.xml","contentType":"file"},{"name":".flake8","path":".flake8","contentType":"file"},{"name":".git-blame-ignore-revs","path":".git-blame-ignore-revs","contentType":"file"},{"name":".gitallowed","path":".gitallowed","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"NOTICE","path":"NOTICE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"abaplint.json","path":"abaplint.json","contentType":"file"}],"totalCount":38}},"fileTreeProcessingTime":22.39458,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"copilotSWEAgentEnabled":false,"csrf_tokens":{"/awsdocs/aws-doc-sdk-examples/branches":{"post":"M-ZxEUYVkoq1JUoipnWnBrUUHqQLMvqzTA_9gcKiFeK7KCsppZ_1aZUJauL6le1pz_Lzi3tRlU-HSi5nYSZqMw"},"/awsdocs/aws-doc-sdk-examples/branches/fetch_and_merge/main":{"post":"wLFubHbV5k3m1m_fFHBMZKI0ZMpIght4vB_SuTICZw-NAj2rm5jSPzCEbuXxsgcqcpV2LMfsT_b1iLBozoyDWw"},"/awsdocs/aws-doc-sdk-examples/branches/fetch_and_merge/main?discard_changes=true":{"post":"grj9z6GAK70uJVdYoE9DmarPBRLzpj804grX7byWWZ3PC64ITM0fz_h3VmJFjQjXem4X9HzIa7qrnbU8QBi9yQ"}}},"title":"aws-doc-sdk-examples/javav2/example_code/bedrock-runtime at main · awsdocs/aws-doc-sdk-examples","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-9bd411a8e273.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-4747241b1152.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}</script>
    </main>
    
          <footer class="footer pt-8 pb-6 f6 color-fg-muted p-responsive" role="contentinfo" >
    

    Footer

    © 2025 GitHub, Inc.
    <nav aria-label="Footer">
      <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3>
    
      <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading">
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to Terms&quot;,&quot;label&quot;:&quot;text:terms&quot;}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to privacy&quot;,&quot;label&quot;:&quot;text:privacy&quot;}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to security&quot;,&quot;label&quot;:&quot;text:security&quot;}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to status&quot;,&quot;label&quot;:&quot;text:status&quot;}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to community&quot;,&quot;label&quot;:&quot;text:community&quot;}" href="https://github.community/" data-view-component="true" class="Link--secondary Link">Community</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to docs&quot;,&quot;label&quot;:&quot;text:docs&quot;}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to contact&quot;,&quot;label&quot;:&quot;text:contact&quot;}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a>
          </li>
    
          <li class="mx-2" >
    
    Manage cookies
  • Do not share my personal information
  •   </ul>
    </nav>
    
    <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999"
      data-locale="en"
      data-initial-cookie-consent-allowed=""
      data-cookie-consent-required="true"
    ></ghcc-consent>
    
    You cant perform that action at this time.
    <template id="site-details-dialog">
    
    <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;">
    
    <template id="snippet-clipboard-copy-button">
    
    </div>
    <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div>
    <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div>
    
    </html>