SkillAgentSearch skills...

PwshBedrock

pwshBedrock is a PowerShell module designed to simplify interaction with Amazon Bedrock foundation models. It enables users to send messages, retrieve responses, manage conversation contexts, generate images and videos, and estimate costs. Supporting both InvokeModel and Converse API, it streamlines AI integration in PowerShell workflows.

Install / Use

/learn @techthoughts2/PwshBedrock

README

pwshBedrock

Minimum Supported PowerShell Version PowerShell Gallery Cross Platform License Documentation Status

<p align="center"> <img src="./docs/assets/pwshBedrock.png" alt="pwshBedrock Logo" > </p>

Branch | Windows - PowerShell | Windows - pwsh | Linux | MacOS --- | --- | --- | --- | --- | main | pwshBedrock-Windows-PowerShell | pwshBedrock-Windows-pwsh| pwshBedrock-Linux | pwshBedrock-MacOS Enhancements | pwshBedrock-Windows-PowerShell | pwshBedrock-Windows-pwsh | pwshBedrock-Linux | pwshBedrock-MacOS

Synopsis

pwshBedrock is a PowerShell module that enables interaction with foundation models (FMs) on the Amazon Bedrock platform. It allows users to send messages, retrieve responses, manage conversation contexts, generate/transform images, and estimate costs.

Description

pwshBedrock provides a set of cmdlets to interact with on-demand foundation models (FMs) hosted on Amazon Bedrock. Each model offers varying capabilities, enabling you to send messages or media files, retrieve responses, manage conversation contexts, generate/transform images, and estimate usage costs. This module simplifies the integration of Bedrock models into your PowerShell development and workflows.

You can use pwshBedrock to interact with models directly via InvokeModel or through the Converse API for supported models. Converse provides a consistent interface for most models that support messages, allowing you to write code once and use it with different models while receiving a consistent response format.

pwshBedrock is designed to streamline the process of building generative AI applications with Amazon Bedrock using PowerShell, offering an accessible and efficient approach for developers looking to explore and leverage generative AI within their PowerShell projects.

Features

Note: Not all models support all features

  • Messaging: Directly engage with Bedrock models using simple or custom messages and receive responses.
  • Custom Conversations: Supports custom formats for conversations, allowing for tailored interactions.
  • Context Control: Maintain continuous and coherent interactions with models through effective context management.
  • Image Generation: Leverage powerful image generative capabilities to both create and transform images.
  • Video Generation: Leverage powerful video generative capabilities to create videos.
  • Document Support: Upload common document types directly to the model to provide context or generate summaries.
  • Vision:: Provide medial files directly to the model for context and evaluation.
  • Cost Estimation: Estimates the cost of your AI engagements, helping you keep a tab on model engagement.
  • Function calling: Connect models to external tools. Enables models to handle specific use cases and pull custom responses.
  • Converse API support Provides a consistent interface that works with most models that support messages. This allows you to write code once and use it with different models. It also provides a consistent response format for each model.

Getting Started

Documentation

Documentation for pwshBedrock is available at: https://www.pwshbedrock.dev

Prerequisites

  • PowerShell 5.1 or later
  • AWS account with access to Amazon Bedrock
    • AWS credentials with appropriate bedrock:InvokeModel permission
    • You must manage and add model access through one-time request model access action. Note: this must be done for each model you plan to interact with.

Installation

# Install pwshBedrock from the PowerShell Gallery
Install-Module -Name pwshBedrock -Repository PSGallery -Scope CurrentUser

Quick start

Converse

Converse provides a consistent interface that works with most models that support messages.

#------------------------------------------------------------------------------------------------
# Sends a message to the specified model via the Converse API in the specified AWS region and returns the response.
Invoke-ConverseAPI -ModelID anthropic.claude-3-5-sonnet-20240620-v1:0 -Message 'Explain zero-point energy.' -Credential $awsCredential -Region us-east-1
#------------------------------------------------------------------------------------------------

Models

AI21 Labs Jamba-Instruct models
#------------------------------------------------------------------------------------------------
# Sends a chat message to the on-demand AI21 Labs Jamba model in the specified AWS region and returns the response.
Invoke-AI21LabsJambaModel -Message 'Explain zero-point energy.' -ModelID 'ai21.jamba-1-5-large-v1:0' -Credential $awsCredential -Region 'us-east-1'
#------------------------------------------------------------------------------------------------
Amazon Image Generator
#------------------------------------------------------------------------------------------------
# Generates an image and saves the image to the C:\temp folder.
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -ImagePrompt 'Create a starship emerging from a nebula.' -ModelID 'amazon.nova-canvas-v1:0' -Credential $awsCredential -Region 'us-east-1'
#------------------------------------------------------------------------------------------------
Amazon Titan Text models
#------------------------------------------------------------------------------------------------
# Sends a text message to the on-demand Amazon Titan model in the specified AWS region and returns the response.
Invoke-AmazonTextModel -Message 'Explain zero-point energy.' -ModelID amazon.titan-text-lite-v1 -Credential $awsCredential -Region 'us-west-2'
#------------------------------------------------------------------------------------------------
Amazon Nova Reel models
#------------------------------------------------------------------------------------------------
# Sends messages to an Amazon Nova Reel model on the Amazon Bedrock platform to generate a video.
Invoke-AmazonVideoModel -VideoPrompt 'Closeup of a large seashell in the sand, gentle waves flow around the shell. Camera zoom in.' -ModelID 'amazon.nova-reel-v1:1' -S3OutputURI 's3://mybucket' -Credential $awsCredential -Region 'us-east-1'
#------------------------------------------------------------------------------------------------
# Generates a video asynchronously using the Nova Reel AI model and stores the output in the specified S3 bucket. Downloads the video to the specified local path.
Invoke-AmazonVideoModel -VideoPrompt 'A cat playing with a ball.' -ModelID 'amazon.nova-reel-v1:1' -S3OutputURI 's3://mybucket' -AttemptS3Download -LocalSavePath 'C:\temp\videos' -Credential $awsCredential -Region 'us-east-1'
#------------------------------------------------------------------------------------------------
Amazon Nova Text models
#------------------------------------------------------------------------------------------------
# Sends a text message to the on-demand Amazon Nova model in the specified AWS region and returns the response.
Invoke-AmazonNovaTextModel -Message 'Explain zero-point energy.' -ModelID 'amazon.nova-pro-v1:0' -Credential $awsCredential -Region 'us-east-1'
#------------------------------------------------------------------------------------------------
Anthropic Models
#------------------------------------------------------------------------------------------------
# Sends a text message to the on-demand Anthropic model in the specified AWS region and returns the response.
Invoke-AnthropicModel -Message 'Explain zero-point energy.' -ModelID 'anthropic.c

Related Skills

View on GitHub
GitHub Stars7
CategoryOperations
Updated9mo ago
Forks1

Languages

PowerShell

Security Score

82/100

Audited on Jun 26, 2025

No findings