Skip to content

Commit

Permalink
This release adds document support to Converse and ConverseStream APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sdk-dotnet-automation committed Jun 20, 2024
1 parent df994c8 commit a95ec46
Show file tree
Hide file tree
Showing 17 changed files with 810 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"members":{
"text":{"shape":"String"},
"image":{"shape":"ImageBlock"},
"document":{"shape":"DocumentBlock"},
"toolUse":{"shape":"ToolUseBlock"},
"toolResult":{"shape":"ToolResultBlock"},
"guardContent":{"shape":"GuardrailConverseContentBlock"}
Expand Down Expand Up @@ -355,6 +356,49 @@
},
"document":true
},
"DocumentBlock":{
"type":"structure",
"required":[
"format",
"name",
"source"
],
"members":{
"format":{"shape":"DocumentFormat"},
"name":{"shape":"DocumentBlockNameString"},
"source":{"shape":"DocumentSource"}
}
},
"DocumentBlockNameString":{
"type":"string",
"max":64,
"min":1
},
"DocumentFormat":{
"type":"string",
"enum":[
"pdf",
"csv",
"doc",
"docx",
"xls",
"xlsx",
"html",
"txt",
"md"
]
},
"DocumentSource":{
"type":"structure",
"members":{
"bytes":{"shape":"DocumentSourceBytesBlob"}
},
"union":true
},
"DocumentSourceBytesBlob":{
"type":"blob",
"min":1
},
"GuardrailAssessment":{
"type":"structure",
"members":{
Expand Down Expand Up @@ -1143,7 +1187,8 @@
"members":{
"json":{"shape":"Document"},
"text":{"shape":"String"},
"image":{"shape":"ImageBlock"}
"image":{"shape":"ImageBlock"},
"document":{"shape":"DocumentBlock"}
},
"union":true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,37 @@
"ToolUseBlock$input": "<p>The input to pass to the tool. </p>"
}
},
"DocumentBlock": {
"base": "<p>A document to include in a message when sending a <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html\">Converse</a> or <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html\">ConverseStream</a> request. You can include up to 5 documents in a request. The maximum document size is 50 MB.</p>",
"refs": {
"ContentBlock$document": "<p>A document to include in the message.</p>",
"ToolResultContentBlock$document": "<p>A tool result that is a document.</p>"
}
},
"DocumentBlockNameString": {
"base": null,
"refs": {
"DocumentBlock$name": "<p>A name for the document.</p>"
}
},
"DocumentFormat": {
"base": null,
"refs": {
"DocumentBlock$format": "<p>The format of a document, or its extension.</p>"
}
},
"DocumentSource": {
"base": "<p>Contains the content of the document included in a message when sending a <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html\">Converse</a> or <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html\">ConverseStream</a> request or in the response.</p>",
"refs": {
"DocumentBlock$source": "<p>Contains the content of the document.</p>"
}
},
"DocumentSourceBytesBlob": {
"base": null,
"refs": {
"DocumentSource$bytes": "<p>A base64-encoded string of a UTF-8 encoded file, that is the document to include in the message.</p>"
}
},
"GuardrailAssessment": {
"base": "<p>A behavior assessment of the guardrail policies used in a call to the Converse API. </p>",
"refs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@
"shape":"ImageBlock",
"documentation":"<p>Image to include in the message. </p> <note> <p>This field is only supported by Anthropic Claude 3 models.</p> </note>"
},
"document":{
"shape":"DocumentBlock",
"documentation":"<p>A document to include in the message.</p>"
},
"toolUse":{
"shape":"ToolUseBlock",
"documentation":"<p>Information about a tool use request from a model. </p>"
Expand Down Expand Up @@ -533,6 +537,63 @@
},
"document":true
},
"DocumentBlock":{
"type":"structure",
"required":[
"format",
"name",
"source"
],
"members":{
"format":{
"shape":"DocumentFormat",
"documentation":"<p>The format of a document, or its extension.</p>"
},
"name":{
"shape":"DocumentBlockNameString",
"documentation":"<p>A name for the document.</p>"
},
"source":{
"shape":"DocumentSource",
"documentation":"<p>Contains the content of the document.</p>"
}
},
"documentation":"<p>A document to include in a message when sending a <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html\">Converse</a> or <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html\">ConverseStream</a> request. You can include up to 5 documents in a request. The maximum document size is 50 MB.</p>"
},
"DocumentBlockNameString":{
"type":"string",
"max":64,
"min":1
},
"DocumentFormat":{
"type":"string",
"enum":[
"pdf",
"csv",
"doc",
"docx",
"xls",
"xlsx",
"html",
"txt",
"md"
]
},
"DocumentSource":{
"type":"structure",
"members":{
"bytes":{
"shape":"DocumentSourceBytesBlob",
"documentation":"<p>A base64-encoded string of a UTF-8 encoded file, that is the document to include in the message.</p>"
}
},
"documentation":"<p>Contains the content of the document included in a message when sending a <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html\">Converse</a> or <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html\">ConverseStream</a> request or in the response.</p>",
"union":true
},
"DocumentSourceBytesBlob":{
"type":"blob",
"min":1
},
"GuardrailAssessment":{
"type":"structure",
"members":{
Expand Down Expand Up @@ -1633,6 +1694,10 @@
"image":{
"shape":"ImageBlock",
"documentation":"<p>A tool result that is an image.</p> <note> <p>This field is only supported by Anthropic Claude 3 models.</p> </note>"
},
"document":{
"shape":"DocumentBlock",
"documentation":"<p>A tool result that is a document.</p>"
}
},
"documentation":"<p>The tool result content block.</p>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
<property>Amazon.BedrockRuntime.Model.ContentBlockStopEvent.ContentBlockIndex</property>
<min>0</min>
</property-value-rule>
<property-value-rule>
<property>Amazon.BedrockRuntime.Model.DocumentBlock.Name</property>
<min>1</min>
<max>64</max>
</property-value-rule>
<property-value-rule>
<property>Amazon.BedrockRuntime.Model.DocumentSource.Bytes</property>
<min>1</min>
</property-value-rule>
<property-value-rule>
<property>Amazon.BedrockRuntime.Model.GuardrailConfiguration.GuardrailIdentifier</property>
<min>0</min>
Expand Down
19 changes: 19 additions & 0 deletions sdk/src/Services/BedrockRuntime/Generated/Model/ContentBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,31 @@ namespace Amazon.BedrockRuntime.Model
/// </summary>
public partial class ContentBlock
{
private DocumentBlock _document;
private GuardrailConverseContentBlock _guardContent;
private ImageBlock _image;
private string _text;
private ToolResultBlock _toolResult;
private ToolUseBlock _toolUse;

/// <summary>
/// Gets and sets the property Document.
/// <para>
/// A document to include in the message.
/// </para>
/// </summary>
public DocumentBlock Document
{
get { return this._document; }
set { this._document = value; }
}

// Check to see if Document property is set
internal bool IsSetDocument()
{
return this._document != null;
}

/// <summary>
/// Gets and sets the property GuardContent.
/// <para>
Expand Down
102 changes: 102 additions & 0 deletions sdk/src/Services/BedrockRuntime/Generated/Model/DocumentBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/*
* Do not modify this file. This file is generated from the bedrock-runtime-2023-09-30.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;

using Amazon.Runtime;
using Amazon.Runtime.Internal;

#pragma warning disable CS0612,CS0618,CS1570
namespace Amazon.BedrockRuntime.Model
{
/// <summary>
/// A document to include in a message when sending a <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a>
/// or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>
/// request. You can include up to 5 documents in a request. The maximum document size
/// is 50 MB.
/// </summary>
public partial class DocumentBlock
{
private DocumentFormat _format;
private string _name;
private DocumentSource _source;

/// <summary>
/// Gets and sets the property Format.
/// <para>
/// The format of a document, or its extension.
/// </para>
/// </summary>
[AWSProperty(Required=true)]
public DocumentFormat Format
{
get { return this._format; }
set { this._format = value; }
}

// Check to see if Format property is set
internal bool IsSetFormat()
{
return this._format != null;
}

/// <summary>
/// Gets and sets the property Name.
/// <para>
/// A name for the document.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=64)]
public string Name
{
get { return this._name; }
set { this._name = value; }
}

// Check to see if Name property is set
internal bool IsSetName()
{
return this._name != null;
}

/// <summary>
/// Gets and sets the property Source.
/// <para>
/// Contains the content of the document.
/// </para>
/// </summary>
[AWSProperty(Required=true)]
public DocumentSource Source
{
get { return this._source; }
set { this._source = value; }
}

// Check to see if Source property is set
internal bool IsSetSource()
{
return this._source != null;
}

}
}
Loading

0 comments on commit a95ec46

Please sign in to comment.