Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"apac",
"BDRR",
"Braunfels",
"bucketname",
"Catesta",
"Claudev",
"COLORGUIDED",
Expand All @@ -44,17 +45,20 @@
"luma",
"mixtral",
"Mogh",
"mybucket",
"notcontains",
"notlike",
"OTBS",
"outpainting",
"pixtral",
"pwsh",
"SECRETKEY",
"shouldprocess",
"Starfleet",
"starships",
"Stroustrup",
"toolspec",
"tooluse",
"webp",
"whitespaces",
"Worf",
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Jake Morrison
Copyright (c) 2025 Jake Morrison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.2.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.85.0] - **BREAKING CHANGES**

- Module changes:
- Converse
- `Invoke-ConverseAPI`
- parameter `MediaPath` renamed to `ImagePath` - ***Breaking Change***
- parameter `AdditionalModelRequestField` change from type `PSObject` to `[System.Collections.Specialized.OrderedDictionary]` - ***Breaking Change***
- Fixed bug where use of `AdditionalModelRequestField` was not being properly formatted
- Added new parameters `VideoPath`, `S3Location`, and `S3BucketOwner` to support Vision models that can take video files
- Updated model pricing to latest published model prices
- Minor spelling corrections throughout

## [0.75.0]

- Module changes:
Expand Down
4 changes: 2 additions & 2 deletions docs/Invoke-AnthropicModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ Accept wildcard characters: False
### -ThinkingBudgetTokens

Maximum number of tokens that Claude may use for its internal reasoning process.
Your thinking budgettokens must always be less than the max tokens you specify in your request.
thinking budget tokens must always be less than the max tokens you specify in your request.
This is a required parameter when using the Thinking switch.
This parameter is only available for Claude 3.7 model.
This paramater has no effect if not using the Thinking switch.
This parameter has no effect if not using the Thinking switch.

```yaml
Type: Int32
Expand Down
204 changes: 181 additions & 23 deletions docs/Invoke-ConverseAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,69 @@ Sends messages, media, or documents to a model via the Converse API and returns

## SYNTAX

### MessageSet (Default)
### MessageOnlySet (Default)

```powershell
Invoke-ConverseAPI -ModelID <String> [-Message <String>] [-MediaPath <String[]>] [-DocumentPath <String[]>]
Invoke-ConverseAPI -ModelID <String> [-Message <String>] [-ReturnFullObject] [-NoContextPersist]
[-MaxTokens <Int32>] [-StopSequences <String[]>] [-Temperature <Single>] [-TopP <Single>]
[-SystemPrompt <String>] [-Tools <PSObject[]>] [-ToolChoice <String>] [-ToolName <String>]
[-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

### MessageDocumentSet

```powershell
Invoke-ConverseAPI -ModelID <String> [-Message <String>] [-DocumentPath <String[]>] [-ReturnFullObject]
[-NoContextPersist] [-MaxTokens <Int32>] [-StopSequences <String[]>] [-Temperature <Single>] [-TopP <Single>]
[-SystemPrompt <String>] [-Tools <PSObject[]>] [-ToolChoice <String>] [-ToolName <String>]
[-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

### MessageS3VideoSet

```powershell
Invoke-ConverseAPI -ModelID <String> [-Message <String>] -S3Location <String> [-S3BucketOwner <String>]
[-ReturnFullObject] [-NoContextPersist] [-MaxTokens <Int32>] [-StopSequences <String[]>]
[-Temperature <Single>] [-TopP <Single>] [-SystemPrompt <String>] [-Tools <PSObject[]>] [-ToolChoice <String>]
[-ToolName <String>] [-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <PSObject>] [-AdditionalModelResponseFieldPath <String[]>] [-AccessKey <String>]
[-Credential <AWSCredentials>] [-EndpointUrl <String>] [-NetworkCredential <PSCredential>]
[-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>] [-SecretKey <String>]
[-SessionToken <String>] [<CommonParameters>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

### MessageVideoSet

```powershell
Invoke-ConverseAPI -ModelID <String> [-Message <String>] [-VideoPath <String>] [-ReturnFullObject]
[-NoContextPersist] [-MaxTokens <Int32>] [-StopSequences <String[]>] [-Temperature <Single>] [-TopP <Single>]
[-SystemPrompt <String>] [-Tools <PSObject[]>] [-ToolChoice <String>] [-ToolName <String>]
[-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

### MessageImageSet

```powershell
Invoke-ConverseAPI -ModelID <String> [-Message <String>] [-ImagePath <String[]>] [-ReturnFullObject]
[-NoContextPersist] [-MaxTokens <Int32>] [-StopSequences <String[]>] [-Temperature <Single>] [-TopP <Single>]
[-SystemPrompt <String>] [-Tools <PSObject[]>] [-ToolChoice <String>] [-ToolName <String>]
[-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

### ToolsResultsSet
Expand All @@ -33,10 +85,10 @@ Invoke-ConverseAPI -ModelID <String> [-ReturnFullObject] [-NoContextPersist] [-M
[-StopSequences <String[]>] [-Temperature <Single>] [-TopP <Single>] [-SystemPrompt <String>]
[-Tools <PSObject[]>] [-ToolChoice <String>] [-ToolName <String>] -ToolsResults <PSObject[]>
[-GuardrailID <String>] [-GuardrailVersion <String>] [-GuardrailTrace <String>]
[-AdditionalModelRequestField <PSObject>] [-AdditionalModelResponseFieldPath <String[]>] [-AccessKey <String>]
[-Credential <AWSCredentials>] [-EndpointUrl <String>] [-NetworkCredential <PSCredential>]
[-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>] [-SecretKey <String>]
[-SessionToken <String>] [<CommonParameters>]
[-AdditionalModelRequestField <OrderedDictionary>] [-AdditionalModelResponseFieldPath <String[]>]
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -122,7 +174,7 @@ Additional parameters are provided to control the response generation.
```powershell
$invokeConverseAPISplat = @{
Message = 'Please describe the painting in the attached image.'
MediaPath = $pathToMediaFile
ImagePath = $pathToImageFile
ModelID = 'anthropic.claude-3-sonnet-20240229-v1:0'
ReturnFullObject = $true
Credential = $awsCredential
Expand All @@ -131,11 +183,45 @@ $invokeConverseAPISplat = @{
Invoke-ConverseAPI @invokeConverseAPISplat
```

Sends a media vision message to the on-demand specified model via the Converse API.
The model will describe the image in the media file.
Sends an image vision message to the on-demand specified model via the Converse API.
The model will describe the image in the image file.

### EXAMPLE 7

```powershell
$invokeConverseAPISplat = @{
Message = 'Please describe the video in the attached video.'
VideoPath = $pathToVideoFile
ModelID = 'amazon.nova-pro-v1:0'
ReturnFullObject = $true
Credential = $awsCredential
Region = 'us-west-2'
}
Invoke-ConverseAPI @invokeConverseAPISplat
```

Sends a video vision message to the on-demand specified model via the Converse API.
The model will describe the video in the video file.

### EXAMPLE 8

```powershell
$invokeConverseAPISplat = @{
Message = 'Please describe the video in the attached video.'
S3Location = 's3://mybucket/myvideo.mp4'
ModelID = 'amazon.nova-pro-v1:0'
ReturnFullObject = $true
Credential = $awsCredential
Region = 'us-west-2'
}
Invoke-ConverseAPI @invokeConverseAPISplat
```

Sends a video vision message to the on-demand specified model via the Converse API.
The model will describe the video in the S3 location.

### EXAMPLE 9

```powershell
$invokeConverseAPISplat = @{
Message = 'Provide a one sentence summary of the document.'
Expand All @@ -150,7 +236,31 @@ Invoke-ConverseAPI @invokeConverseAPISplat
Sends a document message to the on-demand specified model via the Converse API.
The model will provide a one sentence summary of the document.

### EXAMPLE 8
### EXAMPLE 10

```powershell
$additionalModelRequestFields = [ordered]@{
thinking = [ordered]@{
type = 'enabled'
budget_tokens = 1024
}
}
$invokeConverseAPISplat = @{
Message = 'Explain zero-point energy.'
ModelID = 'anthropic.claude-3-sonnet-20240229-v1:0'
SystemPrompt = 'You are a physicist explaining zero-point energy to a layperson.'
AdditionalModelRequestField = $additionalModelRequestFields
Credential = $awsCredential
Region = 'us-west-2'
}
Invoke-ConverseAPI @invokeConverseAPISplat
```

Sends a message to the on-demand specified model via the Converse API.
Additional parameters are provided to control the response generation.
The additional model request field is used to enable thinking and set the budget tokens for the model's internal reasoning process.

### EXAMPLE 11

```powershell
$tools = [PSCustomObject]@{
Expand Down Expand Up @@ -185,7 +295,7 @@ A tool is provided to answer the user's question.
Additional parameters are provided to require the use of the tool and to specify the tool to use.
This will prompt the model to return a tool-based response.

### EXAMPLE 9
### EXAMPLE 12

```powershell
$tools = [PSCustomObject]@{
Expand Down Expand Up @@ -251,7 +361,7 @@ The message to be sent to the model.

```yaml
Type: String
Parameter Sets: MessageSet
Parameter Sets: MessageOnlySet, MessageDocumentSet, MessageS3VideoSet, MessageVideoSet, MessageImageSet
Aliases:

Required: False
Expand All @@ -261,15 +371,63 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -MediaPath
### -ImagePath

File path to local media file.
Up to 20 media files can be sent in a single request.
The media files must adhere to the model's media requirements.
File path to local image file.
Up to 20 image files can be sent in a single request.
The image files must adhere to the model's image requirements.

```yaml
Type: String[]
Parameter Sets: MessageSet
Parameter Sets: MessageImageSet
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -VideoPath

File path to local video file.

```yaml
Type: String
Parameter Sets: MessageVideoSet
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -S3Location

The location of a video object in an Amazon S3 bucket.

```yaml
Type: String
Parameter Sets: MessageS3VideoSet
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -S3BucketOwner

If the bucket belongs to another AWS account, specify that accounts ID.

```yaml
Type: String
Parameter Sets: MessageS3VideoSet
Aliases:

Required: False
Expand All @@ -287,7 +445,7 @@ The document(s) must adhere to the model's document requirements.

```yaml
Type: String[]
Parameter Sets: MessageSet
Parameter Sets: MessageDocumentSet
Aliases:

Required: False
Expand Down Expand Up @@ -544,7 +702,7 @@ Accept wildcard characters: False
Additional inference parameters that the model supports, beyond the base set of inference parameters that Converse supports.

```yaml
Type: PSObject
Type: OrderedDictionary
Parameter Sets: (All)
Aliases:

Expand Down
2 changes: 1 addition & 1 deletion docs/Invoke-LumaAIModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Invoke-LumaAIModel [-VideoPrompt] <String> [[-S3OutputURI] <String>] [[-AspectRa

## DESCRIPTION

Sends an ansynchronous message to a Luma AI model on the Amazon Bedrock platform to generate a video.
Sends an asynchronous message to a Luma AI model on the Amazon Bedrock platform to generate a video.
The response from this model is an invocation ARN, which can be used to check the status of the async job.
The async job once completed will store the output video in the specified S3 bucket.
The cmdlet will also attempt to download the video from S3 if the -AttemptS3Download switch is specified.
Expand Down
2 changes: 1 addition & 1 deletion docs/pwshBedrock-Advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ $finalResponse

## Custom Message with DeepSeek Model

The DeepSeek Model requires very specific formatting. If you want to send a custom crafted message rather than engaging the model over a series of conversations, you can send a contextaul custom message:
The DeepSeek Model requires very specific formatting. If you want to send a custom crafted message rather than engaging the model over a series of conversations, you can send a contextual custom message:

```powershell
# Sends a custom conversation message to the on-demand DeepSeek model in the specified AWS region and returns the response.
Expand Down
4 changes: 2 additions & 2 deletions docs/pwshBedrock-Basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Install-Module -Name pwshBedrock -Repository PSGallery -Scope CurrentUser

Before you can use pwshBedrock, you'll need to meet a few prerequisites:

1. **AWS Account**: You need an AWS account. Within your AWS account, you must [manage and add model acesss](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) for each model you want to interact with. This is a one-time manual action. Note that model access is region-specific, so if you plan to engage with models in multiple regions, you'll need to perform this step in each region.
1. **AWS Account**: You need an AWS account. Within your AWS account, you must [manage and add model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) for each model you want to interact with. This is a one-time manual action. Note that model access is region-specific, so if you plan to engage with models in multiple regions, you'll need to perform this step in each region.
1. **AWS Credentials**: You'll need AWS credentials with the `bedrock:InvokeModel` permission.

### Determine which model you'll engage with
Expand Down Expand Up @@ -62,7 +62,7 @@ Refer to the [FAQ - When should I use Converse vs calling the model directly usi

`pwshBedrock` supports the [Converse](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) API which provides a consistent interface for most models that support messages. This allows you to write code once and use it with different models.

In the example below, you can change the ModelID to another model, such as `meta.llama3-8b-instruct-v1:0` to engage a different model without modifying the function or parameters. *Note: Converse does not support all model IDs, particulary image-only models.*
In the example below, you can change the ModelID to another model, such as `meta.llama3-8b-instruct-v1:0` to engage a different model without modifying the function or parameters. *Note: Converse does not support all model IDs, particularly image-only models.*

```powershell
Invoke-ConverseAPI -ModelID anthropic.claude-3-5-sonnet-20240620-v1:0 -Message 'Explain zero-point energy.' -Credential $awsCredential -Region us-east-1
Expand Down
Loading