This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
import uuid | |
import datetime | |
from botocore.exceptions import ClientError | |
debug = False | |
def get_current_time(): | |
"""Function to get the current time""" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get AWS Account | |
# Enable access to Luma AI Ray2 in Bedrock Console (Model access from menu on left) | |
# Run this Python code in an environment with access to AWS account. | |
import boto3, time | |
bedrock_runtime = boto3.client('bedrock-runtime', region_name='us-west-2') | |
prompt = "Sci-fi city at night slow pan across the skyline" | |
s3_uri = 's3://[your bucket for output files]' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import datetime | |
def lambda_handler(event, context): | |
agent = event['agent'] | |
actionGroup = event['actionGroup'] | |
function = event['function'] | |
parameters = event.get('parameters', []) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
from botocore.exceptions import ClientError | |
from pydantic import BaseModel | |
from typing import Literal, Dict, Optional | |
class ClaudeLLM(BaseModel): | |
modelId: Literal[ | |
"anthropic.claude-3-sonnet-20240229-v1:0", | |
] = "anthropic.claude-3-sonnet-20240229-v1:0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from code here: https://docs.aws.amazon.com/code-library/latest/ug/bedrock-runtime_code_examples_actions.html | |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
// SPDX-License-Identifier: Apache-2.0 | |
import { fileURLToPath } from "url"; | |
import { | |
AccessDeniedException, | |
BedrockRuntimeClient, |