Skip to content

Commit eb65e5b

Browse files
Merge pull request #1 from techthoughts2/Enhancements
Enhancements
2 parents 57ba9c0 + 5cc8fe9 commit eb65e5b

File tree

84 files changed

+1541
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1541
-694
lines changed

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"Braunfels",
2424
"Catesta",
2525
"Claudev",
26+
"COLORGUIDED",
2627
"DDIM",
2728
"DDPM",
2829
"DPMPP",

.vscode/tasks.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@
158158
"echo": false,
159159
"showReuseMessage": false
160160
},
161-
"group": "test"
161+
"group": {
162+
"kind": "test",
163+
"isDefault": true
164+
}
162165
},
163166
{
164167
"label": "DevCC",

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Invoke-AI21LabsJurassic2Model -Messages 'Explain zero-point energy.' -ModelID 'a
9999
```powershell
100100
#------------------------------------------------------------------------------------------------
101101
# Generates an image and saves the image to the C:\temp folder.
102-
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -ImagePrompt 'Create a starship emerging from a nebula.' -ModelID 'amazon.titan-image-generator-v1' -Credential $awsCredential -Region 'us-west-2'
102+
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -ImagePrompt 'Create a starship emerging from a nebula.' -ModelID 'amazon.titan-image-generator-v2:0' -Credential $awsCredential -Region 'us-west-2'
103103
#------------------------------------------------------------------------------------------------
104104
```
105105

actions_bootstrap.ps1

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ foreach ($module in $modulesToInstall) {
5454
ErrorAction = 'Stop'
5555
}
5656
try {
57-
Install-Module @installSplat
57+
if ($module.ModuleName -eq 'Pester' -and $IsWindows) {
58+
# special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389
59+
# this only affects windows builds
60+
Install-Module @installSplat -SkipPublisherCheck
61+
}
62+
else {
63+
Install-Module @installSplat
64+
}
5865
Import-Module -Name $module.ModuleName -ErrorAction Stop
5966
' - Successfully installed {0}' -f $module.ModuleName
6067
}

docs/CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.2.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.15.0]
9+
10+
- Module changes:
11+
- Amazon
12+
- Added support for Titan Image Generator G1 V2 - `amazon.titan-image-generator-v2:0`
13+
- Added new Conditioned Image Generation parameters to `Invoke-AmazonImageModel`
14+
- Added new Color Guided Content parameters to `Invoke-AmazonImageModel`
15+
- Added new Background removal parameters to `Invoke-AmazonImageModel`
16+
- Meta
17+
- Added support for Llama 3.1 405B Instruct - `meta.llama3-1-405b-instruct-v1:0`
18+
- Updated pricing to reflect current Meta Llama 3.1 prices
19+
- Corrected Meta Llama 3.1 models to show Multilingual support as `$true`
20+
- Mistral AI
21+
- Updated pricing to reflect current prices
22+
- Build changes:
23+
- Updated tests to follow Pester 5 rules
24+
- Updated integration tests for newly added capabilities
25+
826
## [0.9.1]
927

1028
- Updated IconUri in manifest.

docs/Invoke-AmazonImageModel.md

+215-4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,36 @@ Invoke-AmazonImageModel -ImagesSavePath <Object> -VariationImagePath <String[]>
5252
[-SessionToken <String>] [<CommonParameters>]
5353
```
5454

55+
### Condition
56+
```
57+
Invoke-AmazonImageModel -ImagesSavePath <Object> [-ConditionImagePath <String>] -ConditionTextPrompt <String>
58+
[-ControlMode <String>] [-ControlStrength <Single>] [-NegativeText <String>] [-NumberOfImages <Int32>]
59+
[-Width <Int32>] [-Height <Int32>] [-CfgScale <Single>] -ModelID <String> [-ReturnFullObject]
60+
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
61+
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
62+
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
63+
```
64+
65+
### ColorGuided
66+
```
67+
Invoke-AmazonImageModel -ImagesSavePath <Object> [-ColorGuidedImagePath <String>]
68+
-ColorGuidedTextPrompt <String> -Colors <String[]> [-NegativeText <String>] [-NumberOfImages <Int32>]
69+
[-Width <Int32>] [-Height <Int32>] [-CfgScale <Single>] -ModelID <String> [-ReturnFullObject]
70+
[-AccessKey <String>] [-Credential <AWSCredentials>] [-EndpointUrl <String>]
71+
[-NetworkCredential <PSCredential>] [-ProfileLocation <String>] [-ProfileName <String>] [-Region <Object>]
72+
[-SecretKey <String>] [-SessionToken <String>] [<CommonParameters>]
73+
```
74+
75+
### BackgroundRemoval
76+
```
77+
Invoke-AmazonImageModel -ImagesSavePath <Object> [-BackgroundRemovalImagePath <String>]
78+
[-NegativeText <String>] [-NumberOfImages <Int32>] [-Width <Int32>] [-Height <Int32>] [-CfgScale <Single>]
79+
-ModelID <String> [-ReturnFullObject] [-AccessKey <String>] [-Credential <AWSCredentials>]
80+
[-EndpointUrl <String>] [-NetworkCredential <PSCredential>] [-ProfileLocation <String>]
81+
[-ProfileName <String>] [-Region <Object>] [-SecretKey <String>] [-SessionToken <String>]
82+
[<CommonParameters>]
83+
```
84+
5585
## DESCRIPTION
5686
Sends a message to an Amazon Titan on the Amazon Bedrock platform and returns the model's response.
5787
The response from this model is an image or images generated based on the input parameters.
@@ -61,19 +91,22 @@ Text-to-image - Generation - Generate an image using a text prompt.
6191
Inpainting - Editing - Modify an image by changing the inside of a mask to match the surrounding background.
6292
Outpainting - Editing - Modify an image by seamlessly extending the region defined by the mask.
6393
Image Variation - Editing - Modify an image by producing variations of the original image.
94+
Conditioning - Generation - Generate an image based on the text prompt and by providing a 'condition image' to achieve more fine-grained control over the resulting generated image.
95+
Color Guided Generation - Generation - Provide a list of hex color codes along with a text prompt to generate an image that follows the color palette.
96+
Background Removal - Editing - Remove the background from an image.
6497

6598
## EXAMPLES
6699

67100
### EXAMPLE 1
68101
```
69-
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -ImagePrompt 'Create a starship emerging from a nebula.' -ModelID 'amazon.titan-image-generator-v1' -Credential $awsCredential -Region 'us-west-2'
102+
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -ImagePrompt 'Create a starship emerging from a nebula.' -ModelID 'amazon.titan-image-generator-v2:0' -Credential $awsCredential -Region 'us-west-2'
70103
```
71104

72105
Generates an image and saves the image to the C:\temp folder.
73106

74107
### EXAMPLE 2
75108
```
76-
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -VariationImagePath 'C:\temp\image1.png' -VariationTextPrompt 'Add more stars and space debris.' -ModelID 'amazon.titan-image-generator-v1' -Credential $awsCredential -Region 'us-west-2'
109+
Invoke-AmazonImageModel -ImagesSavePath 'C:\temp' -VariationImagePath 'C:\temp\image1.png' -VariationTextPrompt 'Add more stars and space debris.' -ModelID 'amazon.titan-image-generator-v2:0' -Credential $awsCredential -Region 'us-west-2'
77110
```
78111

79112
Generates variations of the image located at C:\temp\image1.png and saves the images to the C:\temp folder.
@@ -89,7 +122,7 @@ $invokeAmazonImageSplat = @{
89122
Width = 1024
90123
Height = 1024
91124
CfgScale = 10
92-
ModelID = 'amazon.titan-image-generator-v1'
125+
ModelID = 'amazon.titan-image-generator-v2:0'
93126
Credential = $awsCredential
94127
Region = 'us-west-2'
95128
}
@@ -148,6 +181,54 @@ Invoke-AmazonImageModel @invokeAmazonImageSplat
148181

149182
Generates variations of the image located at $variationMainImage and saves the images to the specified folder.
150183

184+
### EXAMPLE 7
185+
```
186+
$invokeAmazonImageSplat = @{
187+
ImagesSavePath = 'C:\temp'
188+
ConditionImagePath = $conditioningMainImage
189+
ConditionTextPrompt = 'Create a starship emerging from a nebula.'
190+
ControlMode = 'CANNY_EDGE'
191+
ControlStrength = 0.5
192+
ModelID = $ModelID
193+
Credential = $awsCredential
194+
Region = 'us-west-2'
195+
}
196+
Invoke-AmazonImageModel @invokeAmazonImageSplat
197+
```
198+
199+
Generates an image based on the text prompt and the conditioning image and saves the image to the specified folder.
200+
The layout and composition of the generated image are guided by the conditioning image.
201+
The control mode is set to CANNY_EDGE and the control strength is set to 0.5.
202+
203+
### EXAMPLE 8
204+
```
205+
$invokeAmazonImageSplat = @{
206+
ImagesSavePath = 'C:\temp'
207+
ColorGuidedTextPrompt = 'Create a starship emerging from a nebula.'
208+
Colors = @('#FF0000', '#00FF00', '#0000FF')
209+
ModelID = $ModelID
210+
Credential = $awsCredential
211+
Region = 'us-west-2'
212+
}
213+
Invoke-AmazonImageModel @invokeAmazonImageSplat
214+
```
215+
216+
Generates an image based on the text prompt colored by the specified hex colors and saves the image to the specified folder.
217+
218+
### EXAMPLE 9
219+
```
220+
$invokeAmazonImageSplat = @{
221+
ImagesSavePath = 'C:\temp'
222+
BackgroundRemovalImagePath = $backgroundRemovalImage
223+
ModelID = $ModelID
224+
Credential = $awsCredential
225+
Region = 'us-west-2'
226+
}
227+
Invoke-AmazonImageModel @invokeAmazonImageSplat
228+
```
229+
230+
Removes the background from the image located at $backgroundRemovalImage and saves the image to the specified folder.
231+
151232
## PARAMETERS
152233

153234
### -ImagesSavePath
@@ -383,6 +464,136 @@ Accept pipeline input: False
383464
Accept wildcard characters: False
384465
```
385466
467+
### -ConditionImagePath
468+
File path to local media file conditioning image that guides the layout and composition of the generated image.
469+
V2 only.
470+
A single input conditioning image that guides the layout and composition of the generated image
471+
472+
```yaml
473+
Type: String
474+
Parameter Sets: Condition
475+
Aliases:
476+
477+
Required: False
478+
Position: Named
479+
Default value: None
480+
Accept pipeline input: False
481+
Accept wildcard characters: False
482+
```
483+
484+
### -ConditionTextPrompt
485+
A text prompt to generate the image.
486+
V2 only.
487+
488+
```yaml
489+
Type: String
490+
Parameter Sets: Condition
491+
Aliases:
492+
493+
Required: True
494+
Position: Named
495+
Default value: None
496+
Accept pipeline input: False
497+
Accept wildcard characters: False
498+
```
499+
500+
### -ControlMode
501+
Specifies that type of conditioning mode should be used.
502+
V2 only.
503+
504+
```yaml
505+
Type: String
506+
Parameter Sets: Condition
507+
Aliases:
508+
509+
Required: False
510+
Position: Named
511+
Default value: None
512+
Accept pipeline input: False
513+
Accept wildcard characters: False
514+
```
515+
516+
### -ControlStrength
517+
Specifies how similar the layout and composition of the generated image should be to the conditioningImage.
518+
Lower values used to introduce more randomness.
519+
V2 only.
520+
521+
```yaml
522+
Type: Single
523+
Parameter Sets: Condition
524+
Aliases:
525+
526+
Required: False
527+
Position: Named
528+
Default value: 0
529+
Accept pipeline input: False
530+
Accept wildcard characters: False
531+
```
532+
533+
### -ColorGuidedImagePath
534+
File path to local media file conditioning image that guides the color palette of the generated image.
535+
V2 only.
536+
537+
```yaml
538+
Type: String
539+
Parameter Sets: ColorGuided
540+
Aliases:
541+
542+
Required: False
543+
Position: Named
544+
Default value: None
545+
Accept pipeline input: False
546+
Accept wildcard characters: False
547+
```
548+
549+
### -ColorGuidedTextPrompt
550+
A text prompt to generate the image.
551+
V2 only.
552+
553+
```yaml
554+
Type: String
555+
Parameter Sets: ColorGuided
556+
Aliases:
557+
558+
Required: True
559+
Position: Named
560+
Default value: None
561+
Accept pipeline input: False
562+
Accept wildcard characters: False
563+
```
564+
565+
### -Colors
566+
A list of up to 10 hex color codes to specify colors in the generated image.
567+
V2 only.
568+
569+
```yaml
570+
Type: String[]
571+
Parameter Sets: ColorGuided
572+
Aliases:
573+
574+
Required: True
575+
Position: Named
576+
Default value: None
577+
Accept pipeline input: False
578+
Accept wildcard characters: False
579+
```
580+
581+
### -BackgroundRemovalImagePath
582+
File path to local media file that you want to have the background removed from.
583+
V2 only.
584+
585+
```yaml
586+
Type: String
587+
Parameter Sets: BackgroundRemoval
588+
Aliases:
589+
590+
Required: False
591+
Position: Named
592+
Default value: None
593+
Accept pipeline input: False
594+
Accept wildcard characters: False
595+
```
596+
386597
### -NegativeText
387598
A text prompt to define what not to include in the image.
388599
Don't use negative words in the negativeText prompt.
@@ -477,7 +688,7 @@ Aliases:
477688

478689
Required: True
479690
Position: Named
480-
Default value: Amazon.titan-image-generator-v1
691+
Default value: Amazon.titan-image-generator-v2:0
481692
Accept pipeline input: False
482693
Accept wildcard characters: False
483694
```

docs/pwshBedrock.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Module Name: pwshBedrock
33
Module Guid: b4f9e4dc-0229-44ef-99a1-08be4c5e81f2
44
Download Help Link: NA
5-
Help Version: 0.9.1
5+
Help Version: 0.15.0
66
Locale: en-US
77
---
88

src/Tests/Integration/AI21Labs.Tests.ps1

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
#-------------------------------------------------------------------------
2-
Set-Location -Path $PSScriptRoot
3-
#-------------------------------------------------------------------------
4-
$ModuleName = 'pwshBedrock'
5-
#-------------------------------------------------------------------------
6-
#if the module is already in memory, remove it
7-
Get-Module $ModuleName | Remove-Module -Force
8-
$PathToManifest = [System.IO.Path]::Combine('..', '..', 'Artifacts', "$ModuleName.psd1")
9-
#-------------------------------------------------------------------------
10-
Import-Module $PathToManifest -Force
11-
#-------------------------------------------------------------------------
12-
# $awsCredential = [Amazon.Runtime.BasicAWSCredentials]::new('FAKEACCESSKEY', 'FAKESECRETKEY')
1+
BeforeDiscovery {
2+
Set-Location -Path $PSScriptRoot
3+
$ModuleName = 'pwshBedrock'
4+
$PathToManifest = [System.IO.Path]::Combine('..', '..', $ModuleName, "$ModuleName.psd1")
5+
#if the module is already in memory, remove it
6+
Get-Module $ModuleName -ErrorAction SilentlyContinue | Remove-Module -Force
7+
Import-Module $PathToManifest -Force
8+
# $awsCredential = [Amazon.Runtime.BasicAWSCredentials]::new('FAKEACCESSKEY', 'FAKESECRETKEY')
9+
}
1310

1411
InModuleScope 'pwshBedrock' {
1512
Describe 'AI21 Labs Integration Tests' -Tag Integration {

0 commit comments

Comments
 (0)