diff --git a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoder.java b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoder.java index f381109a2..3ec3829bd 100644 --- a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoder.java +++ b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoder.java @@ -30,7 +30,7 @@ * @param The type of the event * @param The type of the initial event */ -public final class AwsEventShapeDecoder +final class AwsEventShapeDecoder implements EventDecoder { private final InitialEventType initialEventType; diff --git a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoder.java b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoder.java index 7f1a8e042..aab71b31a 100644 --- a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoder.java +++ b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoder.java @@ -6,15 +6,18 @@ package software.amazon.smithy.java.aws.events; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.BiFunction; import java.util.function.Function; -import software.amazon.eventstream.HeaderValue; import software.amazon.eventstream.Message; import software.amazon.smithy.java.core.error.ModeledException; import software.amazon.smithy.java.core.schema.Schema; @@ -22,18 +25,21 @@ import software.amazon.smithy.java.core.schema.ShapeUtils; import software.amazon.smithy.java.core.schema.TraitKey; import software.amazon.smithy.java.core.serde.Codec; +import software.amazon.smithy.java.core.serde.InterceptingSerializer; +import software.amazon.smithy.java.core.serde.SerializationException; import software.amazon.smithy.java.core.serde.ShapeSerializer; import software.amazon.smithy.java.core.serde.SpecificShapeSerializer; import software.amazon.smithy.java.core.serde.event.EventEncoder; import software.amazon.smithy.java.core.serde.event.EventStreamingException; +import software.amazon.smithy.java.io.ByteBufferUtils; import software.amazon.smithy.model.shapes.ShapeId; -public final class AwsEventShapeEncoder implements EventEncoder { +final class AwsEventShapeEncoder implements EventEncoder { private final InitialEventType initialEventType; private final Codec codec; private final String payloadMediaType; - private final Map, ShapeSerializer>> possibleTypes; + private final Set possibleTypes; private final Map possibleExceptions; private final Function exceptionHandler; @@ -48,7 +54,6 @@ public AwsEventShapeEncoder( this.codec = Objects.requireNonNull(codec, "codec"); this.payloadMediaType = Objects.requireNonNull(payloadMediaType, "payloadMediaType"); this.possibleTypes = possibleTypes(Objects.requireNonNull(eventSchema, "eventSchema"), - codec, initialEventType.value()); this.possibleExceptions = possibleExceptions(Objects.requireNonNull(eventSchema, "eventSchema")); this.exceptionHandler = Objects.requireNonNull(exceptionHandler, "exceptionHandler"); @@ -57,47 +62,138 @@ public AwsEventShapeEncoder( @Override public AwsEventFrame encode(SerializableStruct item) { var typeHolder = new AtomicReference(); - var headers = new HashMap(); - var payload = encodeInput(item, typeHolder, headers); - headers.put(":message-type", HeaderValue.fromString("event")); - headers.put(":event-type", HeaderValue.fromString(typeHolder.get())); - headers.put(":content-type", HeaderValue.fromString(payloadMediaType)); - return new AwsEventFrame(new Message(headers, payload)); + var contentTypeHolder = new AtomicReference<>(payloadMediaType); + var headers = HeadersBuilder.forEvent(); + var payload = encodeInput(item, headers, typeHolder, contentTypeHolder); + headers.eventType(typeHolder.get()); + var contentType = contentTypeHolder.get(); + if (contentType != null) { + headers.contentType(contentTypeHolder.get()); + } + return new AwsEventFrame(new Message(headers.build(), payload)); } + @Override + public AwsEventFrame encodeFailure(Throwable exception) { + Schema exceptionSchema; + if (exception instanceof ModeledException me + && (exceptionSchema = possibleExceptions.get(me.schema().id())) != null) { + var headers = HeadersBuilder.forException() + .exceptionType(exceptionSchema.memberName()); + var contentTypeHolder = new AtomicReference<>(payloadMediaType); + var payload = encodeModeledException(me, headers, contentTypeHolder); + var contentType = contentTypeHolder.get(); + if (contentType != null) { + headers.contentType(contentTypeHolder.get()); + } + return new AwsEventFrame(new Message(headers.build(), payload)); + } + var es = exceptionHandler.apply(exception); + var headers = HeadersBuilder.forError() + .errorCode(es.getErrorCode()) + .errorMessage(es.getMessage()); + return new AwsEventFrame(new Message(headers.build(), new byte[0])); + } + + /** + * Encodes the item event returning the bytes for the payload. The headers builder is also updated + * when a member is serialized in the headers. + * + *

+ * The serialization captures the union member and sets its value in the `typeHolder` reference. This + * value is set in the `:event-type` header of the event. + * + *

+ * The content type can change depending on the use of `@eventPayload` for blobs and string members. The + * contentEncodingHolder is updated to reflect this value. If nothing gets serialized to the payload, + * this reference is updated to `null` to signal the caller that the content-type should not be set. + */ private byte[] encodeInput( SerializableStruct item, + HeadersBuilder headers, AtomicReference typeHolder, - Map headers + AtomicReference contentEncodingHolder ) { + var out = new ByteArrayOutputStream(); + var baseSerializer = createSerializer(out, codec, headers, contentEncodingHolder); if (isInitialRequest(item.schema())) { // The initial event is serialized fully instead of just a single member as for events. typeHolder.set(initialEventType.value()); - var os = new ByteArrayOutputStream(); - try (var baseSerializer = possibleTypes.get(initialEventType.value()).apply(os, headers)) { - ShapeUtils.withFilteredMembers(item.schema(), item, AwsEventShapeEncoder::excludeEventStreamMember) - .serialize(baseSerializer); - } - return os.toByteArray(); - } - var os = new ByteArrayOutputStream(); - var serializer = new SpecificShapeSerializer() { - @Override - public void writeStruct(Schema schema, SerializableStruct struct) { - var memberName = schema.memberName(); - if (possibleTypes.containsKey(memberName) && - typeHolder.compareAndSet(null, schema.memberName())) { - try (var baseSerializer = possibleTypes.get(memberName).apply(os, headers)) { + ShapeUtils.withFilteredMembers(item.schema(), item, AwsEventShapeEncoder::excludeEventStreamMember) + .serialize(baseSerializer); + } else { + var serializer = new SpecificShapeSerializer() { + @Override + public void writeStruct(Schema schema, SerializableStruct struct) { + var memberName = schema.memberName(); + if (possibleTypes.contains(memberName) && + typeHolder.compareAndSet(null, memberName)) { baseSerializer.writeStruct(schema, struct); } } + }; + item.serializeMembers(serializer); + } + return out.toByteArray(); + } + + /** + * Encodes the item event returning the bytes for the payload. The headers builder is also updated + * when a member is serialized in the headers. + */ + private byte[] encodeModeledException( + ModeledException item, + HeadersBuilder headers, + AtomicReference contentEncodingHolder + ) { + var out = new ByteArrayOutputStream(); + var baseSerializer = createSerializer(out, codec, headers, contentEncodingHolder); + item.serialize(baseSerializer); + return out.toByteArray(); + } + + /** + * Returns the set of all the possible event types. + */ + static Set possibleTypes(Schema eventSchema, String initialEventType) { + var result = new HashSet(); + for (var memberSchema : eventSchema.members()) { + var memberName = memberSchema.memberName(); + result.add(memberName); + } + result.add(initialEventType); + return Collections.unmodifiableSet(result); + } + + /** + * Returns the mapping between shape id and schema for all possible modeled exceptions for this stream. + */ + static Map possibleExceptions(Schema eventSchema) { + var result = new HashMap(); + for (var memberSchema : eventSchema.members()) { + if (memberSchema.hasTrait(TraitKey.ERROR_TRAIT)) { + if (result.put(memberSchema.memberTarget().id(), memberSchema) != null) { + throw new IllegalStateException("Duplicate key"); + } } - }; - item.serializeMembers(serializer); - return os.toByteArray(); + } + return Collections.unmodifiableMap(result); } - private boolean isInitialRequest(Schema schema) { + static ShapeSerializer createSerializer( + OutputStream out, + Codec codec, + HeadersBuilder headers, + AtomicReference contentTypeHolder + ) { + var eventSerializer = new EventHeaderSerializer(headers); + return new EventSerializer(out, codec, eventSerializer, contentTypeHolder); + } + + /** + * Returns true if the given schema is for the initial event type. + */ + static boolean isInitialRequest(Schema schema) { for (var member : schema.members()) { if (isEventStreamMember(member)) { return true; @@ -106,146 +202,187 @@ private boolean isInitialRequest(Schema schema) { return false; } - private static boolean excludeEventStreamMember(Schema schema) { + /** + * Returns true if the schema not the event stream member for the initial request. + */ + static boolean excludeEventStreamMember(Schema schema) { return !isEventStreamMember(schema); } - private static boolean isEventStreamMember(Schema schema) { + /** + * Returns true if this is a event stream members. + */ + static boolean isEventStreamMember(Schema schema) { if (schema.isMember() && schema.memberTarget().hasTrait(TraitKey.STREAMING_TRAIT)) { return true; } return false; } - @Override - public AwsEventFrame encodeFailure(Throwable exception) { - AwsEventFrame frame; - Schema exceptionSchema; - if (exception instanceof ModeledException me - && (exceptionSchema = possibleExceptions.get(me.schema().id())) != null) { - var headers = Map.of( - ":message-type", - HeaderValue.fromString("exception"), - ":exception-type", - HeaderValue.fromString(exceptionSchema.memberName()), - ":content-type", - HeaderValue.fromString(payloadMediaType)); - var payload = codec.serialize(me); - var bytes = new byte[payload.remaining()]; - payload.get(bytes); - frame = new AwsEventFrame(new Message(headers, bytes)); - } else { - EventStreamingException es = exceptionHandler.apply(exception); - var headers = Map.of( - ":message-type", - HeaderValue.fromString("error"), - ":error-code", - HeaderValue.fromString(es.getErrorCode()), - ":error-message", - HeaderValue.fromString(es.getMessage())); - frame = new AwsEventFrame(new Message(headers, new byte[0])); + /** + * Returns true if the schema have any members that ought to be serialized in + * the event payload. + */ + static boolean hasPayloadMembers(Schema struct) { + for (var member : struct.members()) { + if (isPayloadMember(member)) { + return true; + } } - return frame; - + return false; } - static Map, ShapeSerializer>> possibleTypes( - Schema eventSchema, - Codec codec, - String initialEventType - ) { - var result = new HashMap, ShapeSerializer>>(); - var factory = new EventShapeSerializerFactory(codec); - for (var memberSchema : eventSchema.members()) { - String memberName = memberSchema.memberName(); - result.put(memberName, factory::createSerializer); + /** + * Returns true if the schema is a member that ought to be serialized in the + * event payload. + */ + static boolean isPayloadMember(Schema member) { + if (isHeadersMember(member)) { + return false; } - result.put(initialEventType, factory::createSerializer); - return Collections.unmodifiableMap(result); + if (isEventStreamMember(member)) { + return false; + } + if (isEventPayload(member)) { + return false; + } + return true; } - static Map possibleExceptions(Schema eventSchema) { - var result = new HashMap(); - for (var memberSchema : eventSchema.members()) { - if (memberSchema.hasTrait(TraitKey.ERROR_TRAIT)) { - if (result.put(memberSchema.memberTarget().id(), memberSchema) != null) { - throw new IllegalStateException("Duplicate key"); - } + /** + * Returns true if the schema has a member that is directly serialized as the + * payload of the event. Such member has the `@eventPayload` trait attached. + */ + static boolean hasEventPayloadMember(Schema struct) { + for (var member : struct.members()) { + if (member.hasTrait(TraitKey.EVENT_PAYLOAD_TRAIT)) { + return true; } } - return Collections.unmodifiableMap(result); + return false; } - static class EventShapeSerializerFactory { - private final Codec codec; - - EventShapeSerializerFactory(Codec codec) { - this.codec = codec; + /** + * Returns true if the schema is a member that is directly serialized as the + * payload of the event. This depends on the presence of the trait `@eventPayload`. + */ + static boolean isEventPayload(Schema member) { + if (member.hasTrait(TraitKey.EVENT_PAYLOAD_TRAIT)) { + return true; } + return false; + } - public ShapeSerializer createSerializer(OutputStream out, Map headers) { - var eventSerializer = new EventHeaderSerializer(headers); - var baseSerializer = codec.createSerializer(out); - return new EventSerializer(eventSerializer, baseSerializer); - } + /** + * Returns true if the schema is a member that is serialized in the headers of the event. + * This depends on the presence of the trait `@eventHeader`. + */ + static boolean isHeadersMember(Schema member) { + return member.hasTrait(TraitKey.EVENT_HEADER_TRAIT); } + /** + * Serializes an event, class implements the logic to serialize into the headers, + * or the payload of the message depending on the presence of the event serialization + * traits. + */ static class EventSerializer extends SpecificShapeSerializer { + private final OutputStream out; + private final Codec codec; private final EventHeaderSerializer headerSerializer; - private final ShapeSerializer baseSerializer; + private final AtomicReference contentTypeHolder; - public EventSerializer(EventHeaderSerializer headerSerializer, ShapeSerializer baseSerializer) { + public EventSerializer( + OutputStream out, + Codec codec, + EventHeaderSerializer headerSerializer, + AtomicReference contentTypeHolder + ) { + this.out = out; + this.codec = codec; this.headerSerializer = headerSerializer; - this.baseSerializer = baseSerializer; + this.contentTypeHolder = contentTypeHolder; } @Override public void writeStruct(Schema schema, SerializableStruct struct) { if (hasEventPayloadMember(schema)) { - ShapeUtils.withFilteredMembers(schema, struct, this::isEventPayload) - .serializeMembers(baseSerializer); - + try (var serializer = new EventPayloadSerializer(out, codec, contentTypeHolder)) { + ShapeUtils.withFilteredMembers(schema, struct, AwsEventShapeEncoder::isEventPayload) + .serializeMembers(serializer); + } } else { - ShapeUtils.withFilteredMembers(schema, struct, this::isPayloadMember) - .serialize(baseSerializer); + if (hasPayloadMembers(schema)) { + try (var serializer = codec.createSerializer(out)) { + ShapeUtils.withFilteredMembers(schema, struct, AwsEventShapeEncoder::isPayloadMember) + .serialize(serializer); + } + } else { + contentTypeHolder.set(null); + } } - ShapeUtils.withFilteredMembers(schema, struct, this::isHeadersMember) + ShapeUtils.withFilteredMembers(schema, struct, AwsEventShapeEncoder::isHeadersMember) .serialize(headerSerializer); } + } - private boolean isPayloadMember(Schema schema) { - if (schema.hasTrait(TraitKey.EVENT_HEADER_TRAIT)) { - return false; - } - if (isEventStreamMember(schema)) { - return false; - } - return true; - } - - private boolean isEventPayload(Schema schema) { - if (schema.hasTrait(TraitKey.EVENT_PAYLOAD_TRAIT)) { - return true; - } - return false; - } + /** + * Serializes a member with the trait `@eventPayload` directly into the payload of the event. + * The following member types have special handling: + *

    + *
  • blob For blob members the non-encoded bytes are the payload of the event and the + * event `:content-type` header is set to "application/octet-stream"
  • + *
  • string For string members the UTF-8 encoded bytes are the payload of the event and the + * event `:content-type` header is set to "text/plain"
  • + *
  • Any other is encoded with the underlying protocol and uses the content type defined for it
  • + *
+ */ + static class EventPayloadSerializer extends InterceptingSerializer { + private final OutputStream out; + private final Codec codec; + private final AtomicReference contentEncodingHolder; + private ShapeSerializer codecSerializer; - private boolean hasEventPayloadMember(Schema schema) { - for (var member : schema.members()) { - if (member.hasTrait(TraitKey.EVENT_PAYLOAD_TRAIT)) { - return true; - } - } - return false; + EventPayloadSerializer(OutputStream out, Codec codec, AtomicReference contentEncodingHolder) { + this.out = out; + this.codec = codec; + this.contentEncodingHolder = contentEncodingHolder; } - private boolean isHeadersMember(Schema schema) { - return schema.hasTrait(TraitKey.EVENT_HEADER_TRAIT); + @Override + protected ShapeSerializer before(Schema schema) { + return switch (schema.type()) { + case BLOB -> new SpecificShapeSerializer() { + @Override + public void writeBlob(Schema schema, ByteBuffer value) { + contentEncodingHolder.set("application/octet-stream"); + try { + out.write(ByteBufferUtils.getBytes(value)); + } catch (IOException e) { + throw new SerializationException(e); + } + } + }; + case STRING -> new SpecificShapeSerializer() { + @Override + public void writeString(Schema schema, String value) { + contentEncodingHolder.set("text/plain"); + try { + out.write(value.getBytes(StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new SerializationException(e); + } + } + }; + default -> (codecSerializer = codec.createSerializer(out)); + }; } @Override public void flush() { - baseSerializer.flush(); + if (codecSerializer != null) { + codecSerializer.flush(); + } } } } diff --git a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/EventHeaderSerializer.java b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/EventHeaderSerializer.java index 61662eff4..a8799f589 100644 --- a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/EventHeaderSerializer.java +++ b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/EventHeaderSerializer.java @@ -7,57 +7,55 @@ import java.nio.ByteBuffer; import java.time.Instant; -import java.util.Map; -import software.amazon.eventstream.HeaderValue; import software.amazon.smithy.java.core.schema.Schema; import software.amazon.smithy.java.core.schema.SerializableStruct; import software.amazon.smithy.java.core.serde.SpecificShapeSerializer; -public class EventHeaderSerializer extends SpecificShapeSerializer { - private final Map headers; +class EventHeaderSerializer extends SpecificShapeSerializer { + private final HeadersBuilder headers; - public EventHeaderSerializer(Map headers) { + public EventHeaderSerializer(HeadersBuilder headers) { this.headers = headers; } @Override public void writeBoolean(Schema schema, boolean value) { - headers.put(schema.memberName(), HeaderValue.fromBoolean(value)); + headers.put(schema.memberName(), value); } @Override public void writeShort(Schema schema, short value) { - headers.put(schema.memberName(), HeaderValue.fromShort(value)); + headers.put(schema.memberName(), value); } @Override public void writeByte(Schema schema, byte value) { - headers.put(schema.memberName(), HeaderValue.fromByte(value)); + headers.put(schema.memberName(), value); } @Override public void writeInteger(Schema schema, int value) { - headers.put(schema.memberName(), HeaderValue.fromInteger(value)); + headers.put(schema.memberName(), value); } @Override public void writeLong(Schema schema, long value) { - headers.put(schema.memberName(), HeaderValue.fromLong(value)); + headers.put(schema.memberName(), value); } @Override public void writeString(Schema schema, String value) { - headers.put(schema.memberName(), HeaderValue.fromString(value)); + headers.put(schema.memberName(), value); } @Override public void writeBlob(Schema schema, ByteBuffer value) { - headers.put(schema.memberName(), HeaderValue.fromByteBuffer(value)); + headers.put(schema.memberName(), value); } @Override public void writeTimestamp(Schema schema, Instant value) { - headers.put(schema.memberName(), HeaderValue.fromTimestamp(value)); + headers.put(schema.memberName(), value); } @Override diff --git a/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/HeadersBuilder.java b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/HeadersBuilder.java new file mode 100644 index 000000000..5e67bc0c8 --- /dev/null +++ b/aws/aws-event-streams/src/main/java/software/amazon/smithy/java/aws/events/HeadersBuilder.java @@ -0,0 +1,179 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.java.aws.events; + +import java.nio.ByteBuffer; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; +import software.amazon.eventstream.HeaderValue; + +/** + * Util class to build headers for AWS events. + */ +final class HeadersBuilder { + + private final Map headers = new HashMap<>(); + + HeadersBuilder() {} + + /** + * Returns a headers builder for messages of type event. + */ + static HeadersBuilder forEvent() { + return new HeadersBuilder() + .messageType(MessageType.EVENT); + } + + /** + * Returns a headers builder for messages of type error. + */ + static HeadersBuilder forError() { + return new HeadersBuilder() + .messageType(MessageType.ERROR); + } + + /** + * Returns a headers builder for messages of type exception. + */ + static HeadersBuilder forException() { + return new HeadersBuilder() + .messageType(MessageType.EXCEPTION); + } + + public HeadersBuilder messageType(MessageType messageType) { + headers.put(":message-type", HeaderValue.fromString(messageType.toString())); + return this; + } + + /** + * Sets the `:content-type` header. + */ + public HeadersBuilder contentType(String contentType) { + headers.put(":content-type", HeaderValue.fromString(contentType)); + return this; + } + + /** + * Sets the `:event-type` header. + */ + public HeadersBuilder eventType(String eventType) { + headers.put(":event-type", HeaderValue.fromString(eventType)); + return this; + } + + /** + * Sets the `:exception-type` header. + */ + public HeadersBuilder exceptionType(String eventType) { + headers.put(":exception-type", HeaderValue.fromString(eventType)); + return this; + } + + /** + * Sets the `:error-code` header. + */ + public HeadersBuilder errorCode(String errorCode) { + headers.put(":error-code", HeaderValue.fromString(errorCode)); + return this; + } + + /** + * Sets the `:error-message` header. + */ + public HeadersBuilder errorMessage(String errorMessage) { + headers.put(":error-message", HeaderValue.fromString(errorMessage)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, String value) { + headers.put(name, HeaderValue.fromString(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, int value) { + headers.put(name, HeaderValue.fromInteger(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, long value) { + headers.put(name, HeaderValue.fromLong(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, boolean value) { + headers.put(name, HeaderValue.fromBoolean(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, short value) { + headers.put(name, HeaderValue.fromShort(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, byte value) { + headers.put(name, HeaderValue.fromByte(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, ByteBuffer value) { + headers.put(name, HeaderValue.fromByteBuffer(value)); + return this; + } + + /** + * Adds the header with the given name and value. + */ + public HeadersBuilder put(String name, Instant value) { + headers.put(name, HeaderValue.fromTimestamp(value)); + return this; + } + + /** + * Returns the map with the header values. + */ + public Map build() { + return headers; + } + + enum MessageType { + EVENT("event"), + ERROR("error"), + EXCEPTION("exception"); + + private final String value; + + MessageType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } +} diff --git a/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoderTest.java b/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoderTest.java index 7b8932401..34fc06f81 100644 --- a/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoderTest.java +++ b/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeDecoderTest.java @@ -34,7 +34,7 @@ class AwsEventShapeDecoderTest { @Test public void testDecodeInitialResponse() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forEvent() .eventType("initial-response") .contentType("text/json") .put("intMemberHeader", 123) @@ -57,7 +57,7 @@ public void testDecodeInitialResponse() { @Test public void testDecodeHeadersOnlyMember() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forEvent() .contentType("text/json") .eventType("headersOnlyMember") .put("sequenceNum", 123) @@ -81,7 +81,7 @@ public void testDecodeHeadersOnlyMember() { @Test public void testDecodeStructureMember() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forEvent() .contentType("text/json") .eventType("structureMember") .build(); @@ -104,7 +104,7 @@ public void testDecodeStructureMember() { @Test public void testDecodeBodyAndHeaderMember() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forEvent() .contentType("text/json") .eventType("bodyAndHeaderMember") .put("intMember", 123) @@ -131,7 +131,7 @@ public void testDecodeBodyAndHeaderMember() { @Test public void testDecodeStringMember() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forEvent() .contentType("text/json") .eventType("stringMember") .build(); @@ -154,9 +154,8 @@ public void testDecodeStringMember() { @Test public void testDecodeExceptionMember() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() + var headers = HeadersBuilder.forException() .contentType("text/json") - .messageType("exception") .exceptionType("modeledErrorMember") .build(); var message = new Message(headers, "{\"message\":\"Client exception\"}".getBytes(StandardCharsets.UTF_8)); @@ -179,8 +178,7 @@ public void testDecodeExceptionMember() { @Test public void testDecodeError() { // Arrange - var headers = new AwsEventShapeEncoderTest.HeadersBuilder() - .messageType("error") + var headers = HeadersBuilder.forError() .put(":error-code", "InternalFailure") .put(":error-message", "An internal server error occurred") .build(); diff --git a/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoderTest.java b/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoderTest.java index 5f6e65f75..d6b5312bd 100644 --- a/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoderTest.java +++ b/aws/aws-event-streams/src/test/java/software/amazon/smithy/java/aws/events/AwsEventShapeEncoderTest.java @@ -7,10 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import java.util.HashMap; -import java.util.Map; import org.junit.jupiter.api.Test; -import software.amazon.eventstream.HeaderValue; import software.amazon.smithy.java.aws.events.model.BodyAndHeaderEvent; import software.amazon.smithy.java.aws.events.model.HeadersOnlyEvent; import software.amazon.smithy.java.aws.events.model.MyError; @@ -40,7 +37,7 @@ public void testEncodeInitialRequest() { var result = encoder.encode(event); // Assert - var expectedHeaders = new HeadersBuilder() + var expectedHeaders = HeadersBuilder.forEvent() .contentType("text/json") .eventType("initial-request") .put("headerString", "headerValue") @@ -61,13 +58,12 @@ public void testEncodeHeadersOnlyMember() { var result = encoder.encode(event); // Assert - var expectedHeaders = new HeadersBuilder() - .contentType("text/json") + var expectedHeaders = HeadersBuilder.forEvent() .eventType("headersOnlyMember") .put("sequenceNum", 123) .build(); assertEquals(expectedHeaders, result.unwrap().getHeaders()); - assertEquals("{}", new String(result.unwrap().getPayload())); + assertEquals("", new String(result.unwrap().getPayload())); } @Test @@ -82,7 +78,7 @@ public void testEncodeStructureMember() { var result = encoder.encode(event); // Assert - var expectedHeaders = new HeadersBuilder() + var expectedHeaders = HeadersBuilder.forEvent() .contentType("text/json") .eventType("structureMember") .build(); @@ -105,7 +101,7 @@ public void testEncodeBodyAndHeaderMember() { var result = encoder.encode(event); // Assert - var expectedHeaders = new HeadersBuilder() + var expectedHeaders = HeadersBuilder.forEvent() .contentType("text/json") .eventType("bodyAndHeaderMember") .put("intMember", 123) @@ -126,12 +122,12 @@ public void testEncodeStringMember() { var result = encoder.encode(event); // Assert - var expectedHeaders = new HeadersBuilder() - .contentType("text/json") + var expectedHeaders = HeadersBuilder.forEvent() + .contentType("text/plain") .eventType("stringMember") .build(); assertEquals(expectedHeaders, result.unwrap().getHeaders()); - assertEquals("\"hello world!\"", new String(result.unwrap().getPayload())); + assertEquals("hello world!", new String(result.unwrap().getPayload())); } @Test @@ -144,9 +140,8 @@ public void testEncodeException() { var result = encoder.encodeFailure(exception); // Assert - var expectedHeaders = new HeadersBuilder() + var expectedHeaders = HeadersBuilder.forException() .contentType("text/json") - .messageType("exception") .exceptionType("modeledErrorMember") .build(); assertEquals(expectedHeaders, result.unwrap().getHeaders()); @@ -163,8 +158,7 @@ public void testEncodeError() { var result = encoder.encodeFailure(exception); // Assert - var expectedHeaders = new HeadersBuilder() - .messageType("error") + var expectedHeaders = HeadersBuilder.forError() .put(":error-message", "Internal Server Error") .put(":error-code", "InternalServerException") .build(); @@ -185,45 +179,4 @@ static Codec createJsonCodec() { return JsonCodec.builder().build(); } - static class HeadersBuilder { - private final Map headers = new HashMap<>(); - - HeadersBuilder() { - headers.put(":message-type", HeaderValue.fromString("event")); - } - - public HeadersBuilder messageType(String messageType) { - headers.put(":message-type", HeaderValue.fromString(messageType)); - return this; - } - - public HeadersBuilder contentType(String contentType) { - headers.put(":content-type", HeaderValue.fromString(contentType)); - return this; - } - - public HeadersBuilder eventType(String eventType) { - headers.put(":event-type", HeaderValue.fromString(eventType)); - return this; - } - - public HeadersBuilder exceptionType(String eventType) { - headers.put(":exception-type", HeaderValue.fromString(eventType)); - return this; - } - - public HeadersBuilder put(String name, String value) { - headers.put(name, HeaderValue.fromString(value)); - return this; - } - - public HeadersBuilder put(String name, int value) { - headers.put(name, HeaderValue.fromInteger(value)); - return this; - } - - public Map build() { - return headers; - } - } } diff --git a/examples/transcribestreaming-client/README.md b/examples/transcribestreaming-client/README.md new file mode 100644 index 000000000..da5170787 --- /dev/null +++ b/examples/transcribestreaming-client/README.md @@ -0,0 +1,18 @@ +## Example: Transcribe Streaming Client +Example AWS Transcribe client using the REST JSON 1.0 protocol, with event streams, and +the SigV4 auth scheme. + +**Note**: This example project is used to test end to end event streams + +### Usage +To use this example as a template, run the following command with the [Smithy CLI](https://smithy.io/2.0/guides/smithy-cli/index.html): + +```console +smithy init -t transcribestreaming-client --url https://github.com/smithy-lang/smithy-java +``` + +or + +```console +smithy init -t transcribestreaming-client --url git@github.com:smithy-lang/smithy-java.git +``` diff --git a/examples/transcribestreaming-client/build.gradle.kts b/examples/transcribestreaming-client/build.gradle.kts new file mode 100644 index 000000000..0e1e21638 --- /dev/null +++ b/examples/transcribestreaming-client/build.gradle.kts @@ -0,0 +1,76 @@ +plugins { + `java-library` + id("software.amazon.smithy.gradle.smithy-base") +} + +dependencies { + val smithyJavaVersion: String by project + + smithyBuild("software.amazon.smithy.java:codegen-plugin:$smithyJavaVersion") + smithyBuild("software.amazon.smithy.java:client-api:$smithyJavaVersion") + + implementation("software.amazon.smithy.java:aws-client-restjson:$smithyJavaVersion") + implementation("software.amazon.smithy.java:client-core:$smithyJavaVersion") + implementation("software.amazon.smithy.java:aws-sigv4:$smithyJavaVersion") + implementation("software.amazon.smithy.java:client-rulesengine:${smithyJavaVersion}") + implementation("software.amazon.smithy.java:aws-client-rulesengine:${smithyJavaVersion}") + implementation("org.slf4j:slf4j-simple:1.7.36") + implementation(libs.smithy.aws.endpoints) + implementation(libs.smithy.aws.smoke.test.model) + implementation(libs.smithy.aws.traits) + + // Test dependencies + testImplementation(project(":aws:sdkv2:aws-sdkv2-auth")) + testImplementation("org.junit.jupiter:junit-jupiter:6.0.3") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") +} + +// Add generated Java sources to the main sourceset +afterEvaluate { + val clientPath = smithy.getPluginProjectionPath(smithy.sourceProjection.get(), "java-codegen") + sourceSets { + main { + java { + srcDir(clientPath) + } + resources { + srcDir("${clientPath.get()}/META-INF") + srcDir("${clientPath.get()}/resources") + } + } + create("it") { + compileClasspath += main.get().output + configurations["testRuntimeClasspath"] + configurations["testCompileClasspath"] + runtimeClasspath += output + compileClasspath + test.get().runtimeClasspath + test.get().output + } + } +} + +tasks { + val smithyBuild by getting + compileJava { + dependsOn(smithyBuild) + } + processResources { + dependsOn(smithyBuild) + } + val integ by registering(Test::class) { + useJUnitPlatform() + testClassesDirs = sourceSets["it"].output.classesDirs + classpath = sourceSets["it"].runtimeClasspath + } +} + + +// Helps Intellij IDE's discover smithy models +sourceSets { + main { + java { + srcDir("model") + } + } +} + +repositories { + mavenLocal() + mavenCentral() +} diff --git a/examples/transcribestreaming-client/model/model.json b/examples/transcribestreaming-client/model/model.json new file mode 100644 index 000000000..a8415a114 --- /dev/null +++ b/examples/transcribestreaming-client/model/model.json @@ -0,0 +1,4976 @@ +{ + "smithy": "2.0", + "metadata": { + "suppressions": [ + { + "id": "HttpMethodSemantics", + "namespace": "*" + }, + { + "id": "HttpResponseCodeSemantics", + "namespace": "*" + }, + { + "id": "PaginatedTrait", + "namespace": "*" + }, + { + "id": "HttpHeaderTrait", + "namespace": "*" + }, + { + "id": "HttpUriConflict", + "namespace": "*" + }, + { + "id": "Service", + "namespace": "*" + } + ] + }, + "shapes": { + "com.amazonaws.transcribestreaming#Alternative": { + "type": "structure", + "members": { + "Transcript": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Contains transcribed text.

" + } + }, + "Items": { + "target": "com.amazonaws.transcribestreaming#ItemList", + "traits": { + "smithy.api#documentation": "

Contains words, phrases, or punctuation marks in your transcription output.

" + } + }, + "Entities": { + "target": "com.amazonaws.transcribestreaming#EntityList", + "traits": { + "smithy.api#documentation": "

Contains entities identified as personally identifiable information (PII) in your transcription \n output.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A list of possible alternative transcriptions for the input audio. Each alternative may contain\n one or more of Items, Entities, or Transcript.

" + } + }, + "com.amazonaws.transcribestreaming#AlternativeList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#Alternative" + } + }, + "com.amazonaws.transcribestreaming#AudioChunk": { + "type": "blob" + }, + "com.amazonaws.transcribestreaming#AudioEvent": { + "type": "structure", + "members": { + "AudioChunk": { + "target": "com.amazonaws.transcribestreaming#AudioChunk", + "traits": { + "smithy.api#documentation": "

\n An audio blob containing the next segment of audio from your application,\n with a maximum duration of 1 second. \n The maximum size in bytes varies based on audio properties.\n

\n

Find recommended size in Transcribing streaming best practices.\n

\n

\n Size calculation: Duration (s) * Sample Rate (Hz) * Number of Channels * 2 (Bytes per Sample)\n

\n

\n For example, a 1-second chunk of 16 kHz, 2-channel, 16-bit audio would be \n 1 * 16000 * 2 * 2 = 64000 bytes.\n

\n

\n For 8 kHz, 1-channel, 16-bit audio, a 1-second chunk would be \n 1 * 8000 * 1 * 2 = 16000 bytes.\n

", + "smithy.api#eventPayload": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A wrapper for your audio chunks. Your audio stream consists of one or more audio\n events, which consist of one or more audio chunks.

\n

For more information, see Event stream encoding.

" + } + }, + "com.amazonaws.transcribestreaming#AudioStream": { + "type": "union", + "members": { + "AudioEvent": { + "target": "com.amazonaws.transcribestreaming#AudioEvent", + "traits": { + "smithy.api#documentation": "

A blob of audio from your application. Your audio stream consists of one or more audio\n events.

\n

For more information, see Event stream encoding.

" + } + }, + "ConfigurationEvent": { + "target": "com.amazonaws.transcribestreaming#ConfigurationEvent", + "traits": { + "smithy.api#documentation": "

Contains audio channel definitions and post-call analytics settings.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

An encoded stream of audio blobs. Audio streams are encoded as either HTTP/2 or WebSocket \n data frames.

\n

For more information, see Transcribing streaming audio.

", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#BadRequestException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

One or more arguments to the StartStreamTranscription, \n StartMedicalStreamTranscription, or StartCallAnalyticsStreamTranscription \n operation was not valid. For example, MediaEncoding or LanguageCode \n used unsupported values. Check the specified parameters and try your request again.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.transcribestreaming#Boolean": { + "type": "boolean", + "traits": { + "smithy.api#default": false + } + }, + "com.amazonaws.transcribestreaming#BucketName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 64 + }, + "smithy.api#pattern": "^[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]$" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsEntity": { + "type": "structure", + "members": { + "BeginOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the start of the identified entity.

" + } + }, + "EndOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the end of the identified entity.

" + } + }, + "Category": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The category of information identified. For example, PII.

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The type of PII identified. For example, NAME or \n CREDIT_DEBIT_NUMBER.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or words that represent the identified entity.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with the identification of an entity in your transcript.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified entity correctly matches the entity spoken in your\n media.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains entities identified as personally identifiable information (PII) in your\n transcription output, along with various associated attributes. Examples include category,\n confidence score, content, type, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsEntityList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsEntity" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsItem": { + "type": "structure", + "members": { + "BeginOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the start of the identified item.

" + } + }, + "EndOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the end of the identified item.

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#ItemType", + "traits": { + "smithy.api#documentation": "

The type of item identified. Options are: PRONUNCIATION (spoken words) and\n PUNCTUATION.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or punctuation that was transcribed.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with a word or phrase in your transcript.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified item correctly matches the item spoken in your media.

" + } + }, + "VocabularyFilterMatch": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates whether the specified item matches a word in the vocabulary filter included in\n your Call Analytics request. If true, there is a vocabulary filter match.

" + } + }, + "Stable": { + "target": "com.amazonaws.transcribestreaming#Stable", + "traits": { + "smithy.api#documentation": "

If partial result stabilization is enabled, Stable indicates whether the specified \n item is stable (true) or if it may change when the segment is complete \n (false).

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A word, phrase, or punctuation mark in your Call Analytics transcription output, along with various \n associated attributes, such as confidence score, type, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsItem" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode": { + "type": "enum", + "members": { + "EN_US": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-US" + } + }, + "EN_GB": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-GB" + } + }, + "ES_US": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "es-US" + } + }, + "FR_CA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fr-CA" + } + }, + "FR_FR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fr-FR" + } + }, + "EN_AU": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-AU" + } + }, + "IT_IT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "it-IT" + } + }, + "DE_DE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "de-DE" + } + }, + "PT_BR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pt-BR" + } + } + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsLanguageIdentification": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageWithScore" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsLanguageWithScore": { + "type": "structure", + "members": { + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

The language code of the identified language.

" + } + }, + "Score": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The confidence score associated with the identified language code. Confidence scores are values between zero and one; larger values indicate a higher confidence in the identified language.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The language code that represents the language identified in your audio, including the associated\n confidence score.

" + } + }, + "com.amazonaws.transcribestreaming#CallAnalyticsTranscriptResultStream": { + "type": "union", + "members": { + "UtteranceEvent": { + "target": "com.amazonaws.transcribestreaming#UtteranceEvent", + "traits": { + "smithy.api#documentation": "

Contains set of transcription results from one or more audio segments, along with additional \n information per your request parameters. This can include information relating to channel definitions,\n partial result stabilization, sentiment, issue detection, and other transcription-related data.

" + } + }, + "CategoryEvent": { + "target": "com.amazonaws.transcribestreaming#CategoryEvent", + "traits": { + "smithy.api#documentation": "

Provides information on matched categories that were used to generate real-time supervisor \n alerts.

" + } + }, + "BadRequestException": { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + "LimitExceededException": { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + "InternalFailureException": { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + "ConflictException": { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + "ServiceUnavailableException": { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + }, + "traits": { + "smithy.api#documentation": "

Contains detailed information about your real-time Call Analytics session. These details are \n provided in the UtteranceEvent and CategoryEvent objects.

", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#CategoryEvent": { + "type": "structure", + "members": { + "MatchedCategories": { + "target": "com.amazonaws.transcribestreaming#StringList", + "traits": { + "smithy.api#documentation": "

Lists the categories that were matched in your audio segment.

" + } + }, + "MatchedDetails": { + "target": "com.amazonaws.transcribestreaming#MatchedCategoryDetails", + "traits": { + "smithy.api#documentation": "

Contains information about the matched categories, including category names and timestamps.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Provides information on any TranscriptFilterType categories that matched your \n transcription output. Matches are identified for each segment upon completion of that segment.

" + } + }, + "com.amazonaws.transcribestreaming#ChannelDefinition": { + "type": "structure", + "members": { + "ChannelId": { + "target": "com.amazonaws.transcribestreaming#ChannelId", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

Specify the audio channel you want to define.

", + "smithy.api#required": {} + } + }, + "ParticipantRole": { + "target": "com.amazonaws.transcribestreaming#ParticipantRole", + "traits": { + "smithy.api#documentation": "

Specify the speaker you want to define. Omitting this parameter is equivalent to\n specifying both participants.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Makes it possible to specify which speaker is on which audio channel. For example, if your\n agent is the first participant to speak, you would set ChannelId to\n 0 (to indicate the first channel) and ParticipantRole to\n AGENT (to indicate that it's the agent speaking).

" + } + }, + "com.amazonaws.transcribestreaming#ChannelDefinitions": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#ChannelDefinition" + }, + "traits": { + "smithy.api#length": { + "min": 2, + "max": 2 + } + } + }, + "com.amazonaws.transcribestreaming#ChannelId": { + "type": "integer", + "traits": { + "smithy.api#default": 0, + "smithy.api#range": { + "min": 0, + "max": 1 + } + } + }, + "com.amazonaws.transcribestreaming#CharacterOffsets": { + "type": "structure", + "members": { + "Begin": { + "target": "com.amazonaws.transcribestreaming#Integer", + "traits": { + "smithy.api#documentation": "

Provides the character count of the first character where a match is identified. For example, the first\n character associated with an issue or a category match in a segment transcript.

" + } + }, + "End": { + "target": "com.amazonaws.transcribestreaming#Integer", + "traits": { + "smithy.api#documentation": "

Provides the character count of the last character where a match is identified. For example, the last \n character associated with an issue or a category match in a segment transcript.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Provides the location, using character count, in your transcript where a match is identified. For example, \n the location of an issue or a category match within a segment.

" + } + }, + "com.amazonaws.transcribestreaming#ClinicalNoteGenerationResult": { + "type": "structure", + "members": { + "ClinicalNoteOutputLocation": { + "target": "com.amazonaws.transcribestreaming#Uri", + "traits": { + "smithy.api#documentation": "

Holds the Amazon S3 URI for the output Clinical Note.

" + } + }, + "TranscriptOutputLocation": { + "target": "com.amazonaws.transcribestreaming#Uri", + "traits": { + "smithy.api#documentation": "

Holds the Amazon S3 URI for the output Transcript.

" + } + }, + "Status": { + "target": "com.amazonaws.transcribestreaming#ClinicalNoteGenerationStatus", + "traits": { + "smithy.api#documentation": "

The status of the clinical note generation.

\n

Possible Values:

\n
    \n
  • \n

    \n IN_PROGRESS\n

    \n
  • \n
  • \n

    \n FAILED\n

    \n
  • \n
  • \n

    \n COMPLETED\n

    \n
  • \n
\n

\n After audio streaming finishes, and you send a MedicalScribeSessionControlEvent event (with END_OF_SESSION as the Type),\n the status is set to IN_PROGRESS.\n If the status is COMPLETED, the analytics completed successfully, and you can find the\n results at the locations specified in ClinicalNoteOutputLocation and TranscriptOutputLocation.\n If the status is FAILED, FailureReason provides details about the failure.\n

" + } + }, + "FailureReason": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

If ClinicalNoteGenerationResult is FAILED, information about why it failed.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The details for clinical note generation,\n including status, and output locations for clinical note and aggregated transcript if the analytics completed,\n or failure reason if the analytics failed.\n

" + } + }, + "com.amazonaws.transcribestreaming#ClinicalNoteGenerationSettings": { + "type": "structure", + "members": { + "OutputBucketName": { + "target": "com.amazonaws.transcribestreaming#BucketName", + "traits": { + "smithy.api#documentation": "

The name of the Amazon S3 bucket where you want the output of Amazon Web Services HealthScribe post-stream analytics stored. Don't include the S3:// prefix of the specified bucket.

\n

HealthScribe outputs transcript and clinical note files under the prefix:\n S3://$output-bucket-name/healthscribe-streaming/session-id/post-stream-analytics/clinical-notes\n

\n

The role ResourceAccessRoleArn specified in the MedicalScribeConfigurationEvent must have\n permission to use the specified location. You can change Amazon S3 permissions using the \n Amazon Web Services Management Console\n . See also Permissions Required for IAM User Roles .

", + "smithy.api#required": {} + } + }, + "NoteTemplate": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeNoteTemplate", + "traits": { + "smithy.api#documentation": "

Specify one of the following templates to use for the clinical note summary. The default is HISTORY_AND_PHYSICAL.

\n
    \n
  • \n

    HISTORY_AND_PHYSICAL: Provides summaries for key sections of the clinical documentation. Examples of sections include Chief Complaint, History of Present Illness, Review of Systems, Past Medical History, Assessment, and Plan.\n

    \n
  • \n
  • \n

    GIRPP: Provides summaries based on the patients progress toward goals. Examples of sections include Goal, Intervention,\n Response, Progress, and Plan.

    \n
  • \n
  • \n

    BIRP: Focuses on the patient's behavioral patterns and responses. Examples of sections include Behavior, Intervention, Response, and Plan.

    \n
  • \n
  • \n

    SIRP: Emphasizes the situational context of therapy. Examples of sections include Situation, Intervention, Response, and Plan.

    \n
  • \n
  • \n

    DAP: Provides a simplified format for clinical documentation. Examples of sections include Data, Assessment, and Plan.

    \n
  • \n
  • \n

    BEHAVIORAL_SOAP: Behavioral health focused documentation format. Examples of sections include Subjective, Objective, Assessment, and Plan.

    \n
  • \n
  • \n

    PHYSICAL_SOAP: Physical health focused documentation format. Examples of sections include Subjective, Objective, Assessment, and Plan.

    \n
  • \n
" + } + } + }, + "traits": { + "smithy.api#documentation": "

The output configuration for aggregated transcript and clinical note generation.

" + } + }, + "com.amazonaws.transcribestreaming#ClinicalNoteGenerationStatus": { + "type": "enum", + "members": { + "IN_PROGRESS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "IN_PROGRESS" + } + }, + "FAILED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "FAILED" + } + }, + "COMPLETED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "COMPLETED" + } + } + } + }, + "com.amazonaws.transcribestreaming#Confidence": { + "type": "double" + }, + "com.amazonaws.transcribestreaming#ConfigurationEvent": { + "type": "structure", + "members": { + "ChannelDefinitions": { + "target": "com.amazonaws.transcribestreaming#ChannelDefinitions", + "traits": { + "smithy.api#documentation": "

Indicates which speaker is on which audio channel.

" + } + }, + "PostCallAnalyticsSettings": { + "target": "com.amazonaws.transcribestreaming#PostCallAnalyticsSettings", + "traits": { + "smithy.api#documentation": "

Provides additional optional settings for your Call Analytics post-call request, including \n encryption and output locations for your redacted transcript.

\n

\n PostCallAnalyticsSettings provides you with the same insights as a \n Call Analytics post-call transcription. Refer to Post-call analytics for more information \n on this feature.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Allows you to set audio channel definitions and post-call analytics settings.

" + } + }, + "com.amazonaws.transcribestreaming#ConflictException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

A new stream started with the same session ID. The current stream has been terminated.

", + "smithy.api#error": "client", + "smithy.api#httpError": 409 + } + }, + "com.amazonaws.transcribestreaming#ContentIdentificationType": { + "type": "enum", + "members": { + "PII": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PII" + } + } + } + }, + "com.amazonaws.transcribestreaming#ContentRedactionOutput": { + "type": "enum", + "members": { + "REDACTED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "redacted" + } + }, + "REDACTED_AND_UNREDACTED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "redacted_and_unredacted" + } + } + } + }, + "com.amazonaws.transcribestreaming#ContentRedactionType": { + "type": "enum", + "members": { + "PII": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PII" + } + } + } + }, + "com.amazonaws.transcribestreaming#DateTime": { + "type": "timestamp" + }, + "com.amazonaws.transcribestreaming#Double": { + "type": "double", + "traits": { + "smithy.api#default": 0 + } + }, + "com.amazonaws.transcribestreaming#Entity": { + "type": "structure", + "members": { + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time of the utterance that was identified as PII in seconds, with millisecond precision (e.g., 1.056)

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time of the utterance that was identified as PII in seconds, with millisecond precision (e.g., 1.056)

" + } + }, + "Category": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The category of information identified. The only category is PII.

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The type of PII identified. For example, NAME or \n CREDIT_DEBIT_NUMBER.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or words identified as PII.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with the identified PII entity in your audio.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified entity correctly matches the entity spoken in your\n media.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains entities identified as personally identifiable information (PII) in your\n transcription output, along with various associated attributes. Examples include category,\n confidence score, type, stability score, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#EntityList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#Entity" + } + }, + "com.amazonaws.transcribestreaming#GetMedicalScribeStream": { + "type": "operation", + "input": { + "target": "com.amazonaws.transcribestreaming#GetMedicalScribeStreamRequest" + }, + "output": { + "target": "com.amazonaws.transcribestreaming#GetMedicalScribeStreamResponse" + }, + "errors": [ + { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + { + "target": "com.amazonaws.transcribestreaming#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Provides details about the specified Amazon Web Services HealthScribe streaming session.\n To view the status of the streaming session, check the StreamStatus field in the response. To get the\n details of post-stream analytics, including its status, check the PostStreamAnalyticsResult field in the response.\n

", + "smithy.api#http": { + "method": "GET", + "uri": "/medical-scribe-stream/{SessionId}", + "code": 200 + } + } + }, + "com.amazonaws.transcribestreaming#GetMedicalScribeStreamRequest": { + "type": "structure", + "members": { + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

The identifier of the HealthScribe streaming session you want information about.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.transcribestreaming#GetMedicalScribeStreamResponse": { + "type": "structure", + "members": { + "MedicalScribeStreamDetails": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeStreamDetails", + "traits": { + "smithy.api#documentation": "

Provides details about a HealthScribe streaming session.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.transcribestreaming#IamRoleArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 20, + "max": 2048 + }, + "smithy.api#pattern": "^arn:(aws|aws-cn|aws-us-gov|aws-iso-{0,1}[a-z]{0,1}):iam::[0-9]{0,63}:role/[A-Za-z0-9:_/+=,@.-]{0,1024}$" + } + }, + "com.amazonaws.transcribestreaming#Integer": { + "type": "integer" + }, + "com.amazonaws.transcribestreaming#InternalFailureException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

A problem occurred while processing the audio. Amazon Transcribe terminated \n processing.

", + "smithy.api#error": "server", + "smithy.api#httpError": 500 + } + }, + "com.amazonaws.transcribestreaming#IssueDetected": { + "type": "structure", + "members": { + "CharacterOffsets": { + "target": "com.amazonaws.transcribestreaming#CharacterOffsets", + "traits": { + "smithy.api#documentation": "

Provides the timestamps that identify when in an audio segment the specified issue occurs.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Lists the issues that were identified in your audio segment.

" + } + }, + "com.amazonaws.transcribestreaming#IssuesDetected": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#IssueDetected" + } + }, + "com.amazonaws.transcribestreaming#Item": { + "type": "structure", + "members": { + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time of the transcribed item in seconds, with millisecond precision (e.g., 1.056)

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time of the transcribed item in seconds, with millisecond precision (e.g., 1.056)

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#ItemType", + "traits": { + "smithy.api#documentation": "

The type of item identified. Options are: PRONUNCIATION (spoken words) and\n PUNCTUATION.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or punctuation that was transcribed.

" + } + }, + "VocabularyFilterMatch": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates whether the specified item matches a word in the vocabulary filter included in\n your request. If true, there is a vocabulary filter match.

" + } + }, + "Speaker": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

If speaker partitioning is enabled, Speaker labels the speaker of the\n specified item.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with a word or phrase in your transcript.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified item correctly matches the item spoken in your media.

" + } + }, + "Stable": { + "target": "com.amazonaws.transcribestreaming#Stable", + "traits": { + "smithy.api#documentation": "

If partial result stabilization is enabled, Stable indicates whether the specified \n item is stable (true) or if it may change when the segment is complete \n (false).

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A word, phrase, or punctuation mark in your transcription output, along with various associated\n attributes, such as confidence score, type, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#ItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#Item" + } + }, + "com.amazonaws.transcribestreaming#ItemType": { + "type": "enum", + "members": { + "PRONUNCIATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pronunciation" + } + }, + "PUNCTUATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "punctuation" + } + } + } + }, + "com.amazonaws.transcribestreaming#KMSEncryptionContextMap": { + "type": "map", + "key": { + "target": "com.amazonaws.transcribestreaming#NonEmptyString" + }, + "value": { + "target": "com.amazonaws.transcribestreaming#NonEmptyString" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 10 + } + } + }, + "com.amazonaws.transcribestreaming#KMSKeyId": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + }, + "smithy.api#pattern": "^[A-Za-z0-9][A-Za-z0-9:_/+=,@.-]{0,2048}$" + } + }, + "com.amazonaws.transcribestreaming#LanguageCode": { + "type": "enum", + "members": { + "EN_US": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-US" + } + }, + "EN_GB": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-GB" + } + }, + "ES_US": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "es-US" + } + }, + "FR_CA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fr-CA" + } + }, + "FR_FR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fr-FR" + } + }, + "EN_AU": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-AU" + } + }, + "IT_IT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "it-IT" + } + }, + "DE_DE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "de-DE" + } + }, + "PT_BR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pt-BR" + } + }, + "JA_JP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ja-JP" + } + }, + "KO_KR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ko-KR" + } + }, + "ZH_CN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "zh-CN" + } + }, + "TH_TH": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "th-TH" + } + }, + "ES_ES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "es-ES" + } + }, + "AR_SA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ar-SA" + } + }, + "PT_PT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pt-PT" + } + }, + "CA_ES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ca-ES" + } + }, + "AR_AE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ar-AE" + } + }, + "HI_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "hi-IN" + } + }, + "ZH_HK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "zh-HK" + } + }, + "NL_NL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "nl-NL" + } + }, + "NO_NO": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "no-NO" + } + }, + "SV_SE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sv-SE" + } + }, + "PL_PL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pl-PL" + } + }, + "FI_FI": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fi-FI" + } + }, + "ZH_TW": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "zh-TW" + } + }, + "EN_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-IN" + } + }, + "EN_IE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-IE" + } + }, + "EN_NZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-NZ" + } + }, + "EN_AB": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-AB" + } + }, + "EN_ZA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-ZA" + } + }, + "EN_WL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-WL" + } + }, + "DE_CH": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "de-CH" + } + }, + "AF_ZA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "af-ZA" + } + }, + "EU_ES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "eu-ES" + } + }, + "HR_HR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "hr-HR" + } + }, + "CS_CZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "cs-CZ" + } + }, + "DA_DK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "da-DK" + } + }, + "FA_IR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fa-IR" + } + }, + "GL_ES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "gl-ES" + } + }, + "EL_GR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "el-GR" + } + }, + "HE_IL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "he-IL" + } + }, + "ID_ID": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "id-ID" + } + }, + "LV_LV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "lv-LV" + } + }, + "MS_MY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ms-MY" + } + }, + "RO_RO": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ro-RO" + } + }, + "RU_RU": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ru-RU" + } + }, + "SR_RS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sr-RS" + } + }, + "SK_SK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sk-SK" + } + }, + "SO_SO": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "so-SO" + } + }, + "TL_PH": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "tl-PH" + } + }, + "UK_UA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "uk-UA" + } + }, + "VI_VN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "vi-VN" + } + }, + "ZU_ZA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "zu-ZA" + } + }, + "AM_ET": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "am-ET" + } + }, + "BE_BY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "be-BY" + } + }, + "BG_BG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "bg-BG" + } + }, + "BN_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "bn-IN" + } + }, + "BS_BA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "bs-BA" + } + }, + "CKB_IQ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ckb-IQ" + } + }, + "CKB_IR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ckb-IR" + } + }, + "CY_WL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "cy-WL" + } + }, + "ES_MX": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "es-MX" + } + }, + "ET_ET": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "et-ET" + } + }, + "FA_AF": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "fa-AF" + } + }, + "GU_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "gu-IN" + } + }, + "HT_HT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ht-HT" + } + }, + "HU_HU": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "hu-HU" + } + }, + "HY_AM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "hy-AM" + } + }, + "IS_IS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "is-IS" + } + }, + "JV_ID": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "jv-ID" + } + }, + "KA_GE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ka-GE" + } + }, + "KAB_DZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "kab-DZ" + } + }, + "KK_KZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "kk-KZ" + } + }, + "KM_KH": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "km-KH" + } + }, + "KN_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "kn-IN" + } + }, + "LG_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "lg-IN" + } + }, + "LT_LT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "lt-LT" + } + }, + "MK_MK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mk-MK" + } + }, + "ML_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ml-IN" + } + }, + "MR_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mr-IN" + } + }, + "MY_MM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "my-MM" + } + }, + "NE_NP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ne-NP" + } + }, + "OR_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "or-IN" + } + }, + "PA_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pa-IN" + } + }, + "PS_AF": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ps-AF" + } + }, + "SI_LK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "si-LK" + } + }, + "SL_SI": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sl-SI" + } + }, + "SQ_AL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sq-AL" + } + }, + "SU_ID": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "su-ID" + } + }, + "SW_BI": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sw-BI" + } + }, + "SW_KE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sw-KE" + } + }, + "SW_RW": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sw-RW" + } + }, + "SW_TZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sw-TZ" + } + }, + "SW_UG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "sw-UG" + } + }, + "TA_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ta-IN" + } + }, + "TE_IN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "te-IN" + } + }, + "TR_TR": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "tr-TR" + } + }, + "UZ_UZ": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "uz-UZ" + } + } + } + }, + "com.amazonaws.transcribestreaming#LanguageIdentification": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#LanguageWithScore" + } + }, + "com.amazonaws.transcribestreaming#LanguageOptions": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 200 + }, + "smithy.api#pattern": "^[a-zA-Z-,]+$" + } + }, + "com.amazonaws.transcribestreaming#LanguageWithScore": { + "type": "structure", + "members": { + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

The language code of the identified language.

" + } + }, + "Score": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The confidence score associated with the identified language code. Confidence scores are values\n between zero and one; larger values indicate a higher confidence in the identified language.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The language code that represents the language identified in your audio, including the associated\n confidence score. If you enabled channel identification in your request and each channel contained a \n different language, you will have more than one LanguageWithScore result.

" + } + }, + "com.amazonaws.transcribestreaming#LimitExceededException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

Your client has exceeded one of the Amazon Transcribe limits. This is typically the audio length\n limit. Break your audio stream into smaller chunks and try your request again.

", + "smithy.api#error": "client", + "smithy.api#httpError": 429 + } + }, + "com.amazonaws.transcribestreaming#Long": { + "type": "long" + }, + "com.amazonaws.transcribestreaming#MatchedCategoryDetails": { + "type": "map", + "key": { + "target": "com.amazonaws.transcribestreaming#String" + }, + "value": { + "target": "com.amazonaws.transcribestreaming#PointsOfInterest" + } + }, + "com.amazonaws.transcribestreaming#MediaEncoding": { + "type": "enum", + "members": { + "PCM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pcm" + } + }, + "OGG_OPUS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ogg-opus" + } + }, + "FLAC": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "flac" + } + } + } + }, + "com.amazonaws.transcribestreaming#MediaSampleRateHertz": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 8000, + "max": 48000 + } + } + }, + "com.amazonaws.transcribestreaming#MedicalAlternative": { + "type": "structure", + "members": { + "Transcript": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Contains transcribed text.

" + } + }, + "Items": { + "target": "com.amazonaws.transcribestreaming#MedicalItemList", + "traits": { + "smithy.api#documentation": "

Contains words, phrases, or punctuation marks in your transcription output.

" + } + }, + "Entities": { + "target": "com.amazonaws.transcribestreaming#MedicalEntityList", + "traits": { + "smithy.api#documentation": "

Contains entities identified as personal health information (PHI) in your transcription \n output.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A list of possible alternative transcriptions for the input audio. Each alternative may\n contain one or more of Items, Entities, or\n Transcript.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalAlternativeList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalAlternative" + } + }, + "com.amazonaws.transcribestreaming#MedicalContentIdentificationType": { + "type": "enum", + "members": { + "PHI": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PHI" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalEntity": { + "type": "structure", + "members": { + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time, in seconds, of the utterance that was identified as PHI.

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time, in seconds, of the utterance that was identified as PHI.

" + } + }, + "Category": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The category of information identified. The only category is PHI.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or words identified as PHI.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with the identified PHI entity in your audio.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified entity correctly matches the entity spoken in your\n media.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains entities identified as personal health information (PHI) in your\n transcription output, along with various associated attributes. Examples include\n category, confidence score, type, stability score, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalEntityList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalEntity" + } + }, + "com.amazonaws.transcribestreaming#MedicalItem": { + "type": "structure", + "members": { + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time, in seconds, of the transcribed item.

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time, in seconds, of the transcribed item.

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#ItemType", + "traits": { + "smithy.api#documentation": "

The type of item identified. Options are: PRONUNCIATION (spoken \n words) and PUNCTUATION.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word or punctuation that was transcribed.

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with a word or phrase in your transcript.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified item correctly matches the item spoken in your\n media.

" + } + }, + "Speaker": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

If speaker partitioning is enabled, Speaker labels the speaker of the\n specified item.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A word, phrase, or punctuation mark in your transcription output, along with various \n associated attributes, such as confidence score, type, and start and end times.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalItem" + } + }, + "com.amazonaws.transcribestreaming#MedicalResult": { + "type": "structure", + "members": { + "ResultId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Provides a unique identifier for the Result.

" + } + }, + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time, in seconds, of the Result.

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time, in seconds, of the Result.

" + } + }, + "IsPartial": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates if the segment is complete.

\n

If IsPartial is true, the segment is not complete. If\n IsPartial is false, the segment is complete.

" + } + }, + "Alternatives": { + "target": "com.amazonaws.transcribestreaming#MedicalAlternativeList", + "traits": { + "smithy.api#documentation": "

A list of possible alternative transcriptions for the input audio. Each alternative may \n contain one or more of Items, Entities, or\n Transcript.

" + } + }, + "ChannelId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Indicates the channel identified for the Result.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The Result associated with a \n .

\n

Contains a set of transcription results from one or more audio segments, along with\n additional information per your request parameters. This can include information relating to\n alternative transcriptions, channel identification, partial result stabilization, language \n identification, and other transcription-related data.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalResultList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalResult" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeAudioEvent": { + "type": "structure", + "members": { + "AudioChunk": { + "target": "com.amazonaws.transcribestreaming#AudioChunk", + "traits": { + "smithy.api#documentation": "

\n An audio blob containing the next segment of audio from your application,\n with a maximum duration of 1 second. \n The maximum size in bytes varies based on audio properties.\n

\n

Find recommended size in Transcribing streaming best practices.\n

\n

\n Size calculation: Duration (s) * Sample Rate (Hz) * Number of Channels * 2 (Bytes per Sample)\n

\n

\n For example, a 1-second chunk of 16 kHz, 2-channel, 16-bit audio would be \n 1 * 16000 * 2 * 2 = 64000 bytes.\n

\n

\n For 8 kHz, 1-channel, 16-bit audio, a 1-second chunk would be \n 1 * 8000 * 1 * 2 = 16000 bytes.\n

", + "smithy.api#eventPayload": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A wrapper for your audio chunks

\n

For more information, see Event stream encoding.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeChannelDefinition": { + "type": "structure", + "members": { + "ChannelId": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeChannelId", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

Specify the audio channel you want to define.

", + "smithy.api#required": {} + } + }, + "ParticipantRole": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeParticipantRole", + "traits": { + "smithy.api#documentation": "

Specify the participant that you want to flag.\n The allowed options are CLINICIAN and\n PATIENT.\n

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Makes it possible to specify which speaker is on which channel.\n For example, if the clinician is the first participant to speak, you would set the ChannelId of the first\n ChannelDefinition\n in the list to 0 (to indicate the first channel) and ParticipantRole to\n CLINICIAN\n (to indicate that it's the clinician speaking).\n Then you would set the ChannelId of the second ChannelDefinition in the list to\n 1\n (to indicate the second channel) and ParticipantRole to PATIENT (to indicate that it's the patient speaking).\n

\n

If you don't specify a channel definition, HealthScribe will diarize the transcription and identify speaker roles for each speaker.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeChannelDefinitions": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeChannelDefinition" + }, + "traits": { + "smithy.api#length": { + "min": 2, + "max": 2 + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeChannelId": { + "type": "integer", + "traits": { + "smithy.api#default": 0, + "smithy.api#range": { + "min": 0, + "max": 1 + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeConfigurationEvent": { + "type": "structure", + "members": { + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary you want to use for your streaming session.\n Custom vocabulary names are case-sensitive.\n

" + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary filter you want to include in your streaming session.\n Custom vocabulary filter names are case-sensitive.\n

\n

If you include VocabularyFilterName in the MedicalScribeConfigurationEvent,\n you must also include VocabularyFilterMethod.\n

" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeVocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

Specify how you want your custom vocabulary filter applied to the streaming session.

\n

To replace words with ***, specify mask.\n

\n

To delete words, specify remove.\n

\n

To flag words without changing them, specify tag.\n

" + } + }, + "ResourceAccessRoleArn": { + "target": "com.amazonaws.transcribestreaming#IamRoleArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of an IAM role that has permissions to access the Amazon S3 output\n bucket you specified, and use your KMS key if supplied. If the role that you specify doesn\u2019t have the\n appropriate permissions, your request fails.

\n

\n IAM\n role ARNs have the format\n arn:partition:iam::account:role/role-name-with-path.\n For example: arn:aws:iam::111122223333:role/Admin.\n

\n

For more information, see Amazon Web Services HealthScribe.

", + "smithy.api#required": {} + } + }, + "ChannelDefinitions": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeChannelDefinitions", + "traits": { + "smithy.api#documentation": "

Specify which speaker is on which audio channel.

" + } + }, + "EncryptionSettings": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeEncryptionSettings", + "traits": { + "smithy.api#documentation": "

Specify the encryption settings for your streaming session.

" + } + }, + "PostStreamAnalyticsSettings": { + "target": "com.amazonaws.transcribestreaming#MedicalScribePostStreamAnalyticsSettings", + "traits": { + "smithy.api#documentation": "

Specify settings for post-stream analytics.

", + "smithy.api#required": {} + } + }, + "MedicalScribeContext": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeContext", + "traits": { + "smithy.api#documentation": "

The MedicalScribeContext object that contains contextual information used to generate\n customized clinical notes.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Specify details to configure the streaming session, including channel definitions, encryption settings, post-stream analytics\n settings, resource access role ARN and vocabulary settings.\n

\n

Whether you are starting a new session or resuming an existing session, \n your first event must be a MedicalScribeConfigurationEvent.\n If you are resuming a session, then this event must have the same configurations that you provided to start the session.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeContext": { + "type": "structure", + "members": { + "PatientContext": { + "target": "com.amazonaws.transcribestreaming#MedicalScribePatientContext", + "traits": { + "smithy.api#documentation": "

Contains patient-specific information used to customize the clinical note generation.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The MedicalScribeContext object that contains contextual information which is used during clinical note generation\n to add relevant context to the note.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeEncryptionSettings": { + "type": "structure", + "members": { + "KmsEncryptionContext": { + "target": "com.amazonaws.transcribestreaming#KMSEncryptionContextMap", + "traits": { + "smithy.api#documentation": "

A map of plain text, non-secret key:value pairs, known as encryption context pairs, that provide an added layer of\n security for your data. For more information, see KMSencryption context and Asymmetric keys in KMS\n .

" + } + }, + "KmsKeyId": { + "target": "com.amazonaws.transcribestreaming#KMSKeyId", + "traits": { + "smithy.api#documentation": "

The ID of the KMS key you want to use for your streaming session. You\n can specify its KMS key ID, key Amazon Resource Name (ARN), alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". \n To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

    \n
  • \n
  • \n

    \n Alias name: alias/ExampleAlias

    \n
  • \n
  • \n

    \n Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias \n

    \n
  • \n
\n

\n To get the key ID and key ARN for a KMS key, use the ListKeys or DescribeKey KMS API operations. \n To get the alias name and alias ARN, use ListKeys API operation. \n

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains encryption related settings to be used for data encryption with Key Management Service, including KmsEncryptionContext and KmsKeyId.\n The KmsKeyId is required, while KmsEncryptionContext is optional for additional layer of security.\n

\n

By default, Amazon Web Services HealthScribe provides encryption at rest to protect sensitive customer data using Amazon S3-managed keys. HealthScribe uses the KMS key you specify as a second layer of\n encryption.

\n

\n Your ResourceAccessRoleArn\n must permission to use your KMS key.\n For more information, see Data Encryption at rest for Amazon Web Services HealthScribe.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeInputStream": { + "type": "union", + "members": { + "AudioEvent": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeAudioEvent" + }, + "SessionControlEvent": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeSessionControlEvent", + "traits": { + "smithy.api#documentation": "

Specify the lifecycle of your streaming session, such as ending the session.

" + } + }, + "ConfigurationEvent": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeConfigurationEvent", + "traits": { + "smithy.api#documentation": "

Specify additional streaming session configurations beyond those provided in your initial start request headers. For example, specify\n channel definitions, encryption settings, and post-stream analytics settings.\n

\n

Whether you are starting a new session or resuming an existing session, \n your first event must be a MedicalScribeConfigurationEvent.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

An encoded stream of events. The stream is encoded as HTTP/2 data frames.

\n

An input stream consists of the following types of events. The first element of the input stream must be the MedicalScribeConfigurationEvent event type.

\n
    \n
  • \n

    \n MedicalScribeConfigurationEvent\n

    \n
  • \n
  • \n

    \n MedicalScribeAudioEvent\n

    \n
  • \n
  • \n

    \n MedicalScribeSessionControlEvent\n

    \n
  • \n
", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeLanguageCode": { + "type": "enum", + "members": { + "EN_US": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "en-US" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeMediaEncoding": { + "type": "enum", + "members": { + "PCM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pcm" + } + }, + "OGG_OPUS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ogg-opus" + } + }, + "FLAC": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "flac" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeMediaSampleRateHertz": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 16000, + "max": 48000 + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeNoteTemplate": { + "type": "enum", + "members": { + "HISTORY_AND_PHYSICAL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "HISTORY_AND_PHYSICAL" + } + }, + "GIRPP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "GIRPP" + } + }, + "DAP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DAP" + } + }, + "SIRP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SIRP" + } + }, + "BIRP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "BIRP" + } + }, + "BEHAVIORAL_SOAP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "BEHAVIORAL_SOAP" + } + }, + "PHYSICAL_SOAP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PHYSICAL_SOAP" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeParticipantRole": { + "type": "enum", + "members": { + "PATIENT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PATIENT" + } + }, + "CLINICIAN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CLINICIAN" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribePatientContext": { + "type": "structure", + "members": { + "Pronouns": { + "target": "com.amazonaws.transcribestreaming#Pronouns", + "traits": { + "smithy.api#documentation": "

The patient's preferred pronouns that the user wants to provide as a context for clinical note generation .

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains patient-specific information.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribePostStreamAnalyticsResult": { + "type": "structure", + "members": { + "ClinicalNoteGenerationResult": { + "target": "com.amazonaws.transcribestreaming#ClinicalNoteGenerationResult", + "traits": { + "smithy.api#documentation": "

Provides the Clinical Note Generation result for post-stream analytics.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains details for the result of post-stream analytics.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribePostStreamAnalyticsSettings": { + "type": "structure", + "members": { + "ClinicalNoteGenerationSettings": { + "target": "com.amazonaws.transcribestreaming#ClinicalNoteGenerationSettings", + "traits": { + "smithy.api#documentation": "

Specify settings for the post-stream clinical note generation.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

The settings for post-stream analytics.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeResultStream": { + "type": "union", + "members": { + "TranscriptEvent": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeTranscriptEvent", + "traits": { + "smithy.api#documentation": "

The transcript event that contains real-time transcription results.\n

" + } + }, + "BadRequestException": { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + "LimitExceededException": { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + "InternalFailureException": { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + "ConflictException": { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + "ServiceUnavailableException": { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + }, + "traits": { + "smithy.api#documentation": "

Result stream where you will receive the output events.\n The details are provided in the MedicalScribeTranscriptEvent object.\n

", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeSessionControlEvent": { + "type": "structure", + "members": { + "Type": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeSessionControlEventType", + "traits": { + "smithy.api#documentation": "

The type of MedicalScribeSessionControlEvent.\n

\n

Possible Values:

\n
    \n
  • \n

    \n END_OF_SESSION - Indicates the audio streaming is complete. After you\n send an END_OF_SESSION event, Amazon Web Services HealthScribe starts the post-stream analytics.\n The session can't be resumed after this event is sent. After Amazon Web Services HealthScribe processes the event, the real-time StreamStatus is COMPLETED.\n You get the StreamStatus and other stream details with the GetMedicalScribeStream API operation.\n For more information about different streaming statuses, see the StreamStatus description in the MedicalScribeStreamDetails. \n

    \n
  • \n
", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Specify the lifecycle of your streaming session.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeSessionControlEventType": { + "type": "enum", + "members": { + "END_OF_SESSION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "END_OF_SESSION" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeStreamDetails": { + "type": "structure", + "members": { + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

The identifier of the HealthScribe streaming session.

" + } + }, + "StreamCreatedAt": { + "target": "com.amazonaws.transcribestreaming#DateTime", + "traits": { + "smithy.api#documentation": "

The date and time when the HealthScribe streaming session was created.

" + } + }, + "StreamEndedAt": { + "target": "com.amazonaws.transcribestreaming#DateTime", + "traits": { + "smithy.api#documentation": "

The date and time when the HealthScribe streaming session was ended.

" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeLanguageCode", + "traits": { + "smithy.api#documentation": "

The Language Code of the HealthScribe streaming session.

" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

The sample rate (in hertz) of the HealthScribe streaming session.

" + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaEncoding", + "traits": { + "smithy.api#documentation": "

The Media Encoding of the HealthScribe streaming session.

" + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

The vocabulary name of the HealthScribe streaming session.

" + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

The name of the vocabulary filter used for the HealthScribe streaming session .

" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeVocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

The method of the vocabulary filter for the HealthScribe streaming session.

" + } + }, + "ResourceAccessRoleArn": { + "target": "com.amazonaws.transcribestreaming#IamRoleArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the role used in the HealthScribe streaming session.

" + } + }, + "ChannelDefinitions": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeChannelDefinitions", + "traits": { + "smithy.api#documentation": "

The Channel Definitions of the HealthScribe streaming session.

" + } + }, + "EncryptionSettings": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeEncryptionSettings", + "traits": { + "smithy.api#documentation": "

The Encryption Settings of the HealthScribe streaming session.

" + } + }, + "StreamStatus": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeStreamStatus", + "traits": { + "smithy.api#documentation": "

The streaming status of the HealthScribe streaming session.

\n

Possible Values:

\n
    \n
  • \n

    \n IN_PROGRESS\n

    \n
  • \n
  • \n

    \n PAUSED\n

    \n
  • \n
  • \n

    \n FAILED\n

    \n
  • \n
  • \n

    \n COMPLETED\n

    \n
  • \n
\n \n

This status is specific to real-time streaming.\n A COMPLETED status doesn't mean that the post-stream analytics is complete.\n To get status of an analytics result, check the Status field for the analytics result within the\n MedicalScribePostStreamAnalyticsResult. For example, you can view the status of the \n ClinicalNoteGenerationResult.\n

\n
" + } + }, + "PostStreamAnalyticsSettings": { + "target": "com.amazonaws.transcribestreaming#MedicalScribePostStreamAnalyticsSettings", + "traits": { + "smithy.api#documentation": "

The post-stream analytics settings of the HealthScribe streaming session.

" + } + }, + "PostStreamAnalyticsResult": { + "target": "com.amazonaws.transcribestreaming#MedicalScribePostStreamAnalyticsResult", + "traits": { + "smithy.api#documentation": "

The result of post-stream analytics for the HealthScribe streaming session.

" + } + }, + "MedicalScribeContextProvided": { + "target": "com.amazonaws.transcribestreaming#NullableBoolean", + "traits": { + "smithy.api#documentation": "

Indicates whether the MedicalScribeContext object was provided when the stream was started.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains details about a Amazon Web Services HealthScribe streaming session.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeStreamStatus": { + "type": "enum", + "members": { + "IN_PROGRESS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "IN_PROGRESS" + } + }, + "PAUSED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PAUSED" + } + }, + "FAILED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "FAILED" + } + }, + "COMPLETED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "COMPLETED" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeTranscriptEvent": { + "type": "structure", + "members": { + "TranscriptSegment": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeTranscriptSegment", + "traits": { + "smithy.api#documentation": "

The TranscriptSegment associated with a MedicalScribeTranscriptEvent.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The event associated with MedicalScribeResultStream.\n

\n

Contains MedicalScribeTranscriptSegment, which contains segment related information.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItem": { + "type": "structure", + "members": { + "BeginAudioTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time, in milliseconds, of the transcribed item.

" + } + }, + "EndAudioTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time, in milliseconds, of the transcribed item.

" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItemType", + "traits": { + "smithy.api#documentation": "

The type of item identified. Options are: PRONUNCIATION (spoken words)\n and PUNCTUATION.\n

" + } + }, + "Confidence": { + "target": "com.amazonaws.transcribestreaming#Confidence", + "traits": { + "smithy.api#documentation": "

The confidence score associated with a word or phrase in your transcript.

\n

Confidence scores are values between 0 and 1. A larger value indicates a higher\n probability that the identified item correctly matches the item spoken in your media.\n

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The word, phrase or punctuation mark that was transcribed.

" + } + }, + "VocabularyFilterMatch": { + "target": "com.amazonaws.transcribestreaming#NullableBoolean", + "traits": { + "smithy.api#documentation": "

Indicates whether the specified item matches a word in the vocabulary filter included in\n your configuration event. If true, there is a vocabulary filter match.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A word, phrase, or punctuation mark in your transcription output, along with various associated\n attributes, such as confidence score, type, and start and end times.\n

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItem" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItemType": { + "type": "enum", + "members": { + "PRONUNCIATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pronunciation" + } + }, + "PUNCTUATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "punctuation" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeTranscriptSegment": { + "type": "structure", + "members": { + "SegmentId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The identifier of the segment.

" + } + }, + "BeginAudioTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time, in milliseconds, of the segment.

" + } + }, + "EndAudioTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time, in milliseconds, of the segment.

" + } + }, + "Content": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Contains transcribed text of the segment.

" + } + }, + "Items": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeTranscriptItemList", + "traits": { + "smithy.api#documentation": "

Contains words, phrases, or punctuation marks in your segment.

" + } + }, + "IsPartial": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates if the segment is complete.

\n

If IsPartial is true, the segment is not complete.\n If IsPartial is false, the segment is complete.\n

" + } + }, + "ChannelId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Indicates which audio channel is associated with the MedicalScribeTranscriptSegment.\n

\n

If MedicalScribeChannelDefinition is not provided in the MedicalScribeConfigurationEvent,\n then this field will not be included.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains a set of transcription results, along with additional information of the segment.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalScribeVocabularyFilterMethod": { + "type": "enum", + "members": { + "REMOVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "remove" + } + }, + "MASK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mask" + } + }, + "TAG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "tag" + } + } + } + }, + "com.amazonaws.transcribestreaming#MedicalTranscript": { + "type": "structure", + "members": { + "Results": { + "target": "com.amazonaws.transcribestreaming#MedicalResultList", + "traits": { + "smithy.api#documentation": "

Contains a set of transcription results from one or more audio segments, along with \n additional information per your request parameters. This can include information relating to \n alternative transcriptions, channel identification, partial result stabilization, language \n identification, and other transcription-related data.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The MedicalTranscript associated with a \n .

\n

\n MedicalTranscript contains Results, which contains a set of \n transcription results from one or more audio segments, along with additional information per your \n request parameters.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalTranscriptEvent": { + "type": "structure", + "members": { + "Transcript": { + "target": "com.amazonaws.transcribestreaming#MedicalTranscript", + "traits": { + "smithy.api#documentation": "

Contains Results, which contains a set of transcription results from one or \n more audio segments, along with additional information per your request parameters. This can\n include information relating to alternative transcriptions, channel identification, partial result \n stabilization, language identification, and other transcription-related data.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The MedicalTranscriptEvent associated with a \n MedicalTranscriptResultStream.

\n

Contains a set of transcription results from one or more audio segments, along with additional \n information per your request parameters.

" + } + }, + "com.amazonaws.transcribestreaming#MedicalTranscriptResultStream": { + "type": "union", + "members": { + "TranscriptEvent": { + "target": "com.amazonaws.transcribestreaming#MedicalTranscriptEvent", + "traits": { + "smithy.api#documentation": "

The MedicalTranscriptEvent associated with a \n MedicalTranscriptResultStream.

\n

Contains a set of transcription results from one or more audio segments, along with \n additional information per your request parameters. This can include information relating to\n alternative transcriptions, channel identification, partial result stabilization, language \n identification, and other transcription-related data.

" + } + }, + "BadRequestException": { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + "LimitExceededException": { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + "InternalFailureException": { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + "ConflictException": { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + "ServiceUnavailableException": { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + }, + "traits": { + "smithy.api#documentation": "

Contains detailed information about your streaming session.

", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#ModelName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 200 + }, + "smithy.api#pattern": "^[0-9a-zA-Z._-]+$" + } + }, + "com.amazonaws.transcribestreaming#NonEmptyString": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2000 + }, + "smithy.api#pattern": "\\S" + } + }, + "com.amazonaws.transcribestreaming#NullableBoolean": { + "type": "boolean" + }, + "com.amazonaws.transcribestreaming#NumberOfChannels": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 2 + } + } + }, + "com.amazonaws.transcribestreaming#PartialResultsStability": { + "type": "enum", + "members": { + "HIGH": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "high" + } + }, + "MEDIUM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "medium" + } + }, + "LOW": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "low" + } + } + } + }, + "com.amazonaws.transcribestreaming#ParticipantRole": { + "type": "enum", + "members": { + "AGENT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AGENT" + } + }, + "CUSTOMER": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CUSTOMER" + } + } + } + }, + "com.amazonaws.transcribestreaming#PiiEntityTypes": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 300 + }, + "smithy.api#pattern": "^[A-Z_, ]+$" + } + }, + "com.amazonaws.transcribestreaming#PointsOfInterest": { + "type": "structure", + "members": { + "TimestampRanges": { + "target": "com.amazonaws.transcribestreaming#TimestampRanges", + "traits": { + "smithy.api#documentation": "

Contains the timestamp ranges (start time through end time) of matched categories and rules.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains the timestamps of matched categories.

" + } + }, + "com.amazonaws.transcribestreaming#PostCallAnalyticsSettings": { + "type": "structure", + "members": { + "OutputLocation": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The Amazon S3 location where you want your Call Analytics post-call \n transcription output stored. You can use any of the following formats to specify the output \n location:

\n
    \n
  1. \n

    s3://DOC-EXAMPLE-BUCKET

    \n
  2. \n
  3. \n

    s3://DOC-EXAMPLE-BUCKET/my-output-folder/

    \n
  4. \n
  5. \n

    s3://DOC-EXAMPLE-BUCKET/my-output-folder/my-call-analytics-job.json

    \n
  6. \n
", + "smithy.api#required": {} + } + }, + "DataAccessRoleArn": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of an IAM role that has permissions to\n access the Amazon S3 bucket that contains your input files. If the role that you\n specify doesn\u2019t have the appropriate permissions to access the specified Amazon S3 \n location, your request fails.

\n

IAM role ARNs have the format\n arn:partition:iam::account:role/role-name-with-path. For example:\n arn:aws:iam::111122223333:role/Admin. For more information, see IAM\n ARNs.

", + "smithy.api#required": {} + } + }, + "ContentRedactionOutput": { + "target": "com.amazonaws.transcribestreaming#ContentRedactionOutput", + "traits": { + "smithy.api#documentation": "

Specify whether you want only a redacted transcript or both a redacted and an unredacted \n transcript. If you choose redacted and unredacted, two JSON files are generated and stored in the \n Amazon S3 output location you specify.

\n

Note that to include ContentRedactionOutput in your request, you must \n enable content redaction (ContentRedactionType).

" + } + }, + "OutputEncryptionKMSKeyId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The KMS key you want to use to encrypt your Call Analytics post-call\n output.

\n

If using a key located in the current\n Amazon Web Services account, you can specify your KMS key in one of four\n ways:

\n
    \n
  1. \n

    Use the KMS key ID itself. For example,\n 1234abcd-12ab-34cd-56ef-1234567890ab.

    \n
  2. \n
  3. \n

    Use an alias for the KMS key ID. For example,\n alias/ExampleAlias.

    \n
  4. \n
  5. \n

    Use the Amazon Resource Name (ARN) for the KMS key ID. For\n example,\n arn:aws:kms:region:account-ID:key/1234abcd-12ab-34cd-56ef-1234567890ab.

    \n
  6. \n
  7. \n

    Use the ARN for the KMS key alias. For example,\n arn:aws:kms:region:account-ID:alias/ExampleAlias.

    \n
  8. \n
\n

If using a key located in a different\n Amazon Web Services account than the current Amazon Web Services account, you can specify\n your KMS key in one of two ways:

\n
    \n
  1. \n

    Use the ARN for the KMS key ID. For example,\n arn:aws:kms:region:account-ID:key/1234abcd-12ab-34cd-56ef-1234567890ab.

    \n
  2. \n
  3. \n

    Use the ARN for the KMS key alias. For example,\n arn:aws:kms:region:account-ID:alias/ExampleAlias.

    \n
  4. \n
\n

Note that the role making the \n request must have permission to use the specified KMS key.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Allows you to specify additional settings for your Call Analytics post-call request, \n including output locations for your redacted transcript, which IAM role to use, \n and which encryption key to use.

\n

\n DataAccessRoleArn and OutputLocation are required \n fields.

\n

\n PostCallAnalyticsSettings provides you with the same insights as a \n Call Analytics post-call transcription. Refer to Post-call analytics for more information \n on this feature.

" + } + }, + "com.amazonaws.transcribestreaming#Pronouns": { + "type": "enum", + "members": { + "HE_HIM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "HE_HIM" + } + }, + "SHE_HER": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SHE_HER" + } + }, + "THEY_THEM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "THEY_THEM" + } + } + }, + "traits": { + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.transcribestreaming#RequestId": { + "type": "string" + }, + "com.amazonaws.transcribestreaming#ResourceNotFoundException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

The request references a resource which doesn't exist.

", + "smithy.api#error": "client", + "smithy.api#httpError": 404 + } + }, + "com.amazonaws.transcribestreaming#Result": { + "type": "structure", + "members": { + "ResultId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Provides a unique identifier for the Result.

" + } + }, + "StartTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The start time of the Result in seconds, with millisecond precision (e.g., 1.056).

" + } + }, + "EndTime": { + "target": "com.amazonaws.transcribestreaming#Double", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The end time of the Result in seconds, with millisecond precision (e.g., 1.056).

" + } + }, + "IsPartial": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates if the segment is complete.

\n

If IsPartial is true, the segment is not complete. If\n IsPartial is false, the segment is complete.

" + } + }, + "Alternatives": { + "target": "com.amazonaws.transcribestreaming#AlternativeList", + "traits": { + "smithy.api#documentation": "

A list of possible alternative transcriptions for the input audio. Each alternative may contain\n one or more of Items, Entities, or Transcript.

" + } + }, + "ChannelId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Indicates which audio channel is associated with the Result.

" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

The language code that represents the language spoken in your audio stream.

" + } + }, + "LanguageIdentification": { + "target": "com.amazonaws.transcribestreaming#LanguageIdentification", + "traits": { + "smithy.api#documentation": "

The language code of the dominant language identified in your stream.

\n

If you enabled channel identification and each channel of your audio contains a different language,\n you may have more than one result.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The Result associated with a \n .

\n

Contains a set of transcription results from one or more audio segments, along with additional \n information per your request parameters. This can include information relating to alternative\n transcriptions, channel identification, partial result stabilization, language identification, and other\n transcription-related data.

" + } + }, + "com.amazonaws.transcribestreaming#ResultList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#Result" + } + }, + "com.amazonaws.transcribestreaming#Sentiment": { + "type": "enum", + "members": { + "POSITIVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "POSITIVE" + } + }, + "NEGATIVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NEGATIVE" + } + }, + "MIXED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "MIXED" + } + }, + "NEUTRAL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NEUTRAL" + } + } + } + }, + "com.amazonaws.transcribestreaming#ServiceUnavailableException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "traits": { + "smithy.api#documentation": "

The service is currently unavailable. Try your request later.

", + "smithy.api#error": "server", + "smithy.api#httpError": 503 + } + }, + "com.amazonaws.transcribestreaming#SessionId": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 36, + "max": 36 + }, + "smithy.api#pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + } + }, + "com.amazonaws.transcribestreaming#Specialty": { + "type": "enum", + "members": { + "PRIMARYCARE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PRIMARYCARE" + } + }, + "CARDIOLOGY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CARDIOLOGY" + } + }, + "NEUROLOGY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NEUROLOGY" + } + }, + "ONCOLOGY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ONCOLOGY" + } + }, + "RADIOLOGY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "RADIOLOGY" + } + }, + "UROLOGY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "UROLOGY" + } + } + } + }, + "com.amazonaws.transcribestreaming#Stable": { + "type": "boolean" + }, + "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscription": { + "type": "operation", + "input": { + "target": "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscriptionRequest" + }, + "output": { + "target": "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscriptionResponse" + }, + "errors": [ + { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + ], + "traits": { + "smithy.api#documentation": "

Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to \n Amazon Transcribe and the transcription results are streamed to your application. Use this operation\n for Call Analytics transcriptions.

\n

The following parameters are required:

\n
    \n
  • \n

    \n language-code or identify-language\n

    \n
  • \n
  • \n

    \n media-encoding\n

    \n
  • \n
  • \n

    \n sample-rate\n

    \n
  • \n
\n

For more information on streaming with Amazon Transcribe, see Transcribing streaming audio.

", + "smithy.api#http": { + "method": "POST", + "uri": "/call-analytics-stream-transcription", + "code": 200 + } + } + }, + "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscriptionRequest": { + "type": "structure", + "members": { + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

Specify the language code that represents the language spoken in your audio.

\n

For a list of languages supported with real-time Call Analytics, refer to the \n Supported \n languages table.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

The sample rate of the input audio (in hertz). Low-quality audio, such as telephone audio,\n is typically around 8,000 Hz. High-quality audio typically ranges from 16,000 Hz to 48,000 Hz.\n Note that the sample rate you specify must match that of your audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate", + "smithy.api#required": {} + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Specify the encoding of your input audio. Supported formats are:

\n
    \n
  • \n

    FLAC

    \n
  • \n
  • \n

    OPUS-encoded audio in an Ogg container

    \n
  • \n
  • \n

    PCM (only signed 16-bit little-endian audio formats, which does not include WAV)

    \n
  • \n
\n

For more information, see Media formats.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding", + "smithy.api#required": {} + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary that you want to use when processing your\n transcription. Note that vocabulary names are case sensitive.

\n

If the language of the specified custom vocabulary doesn't match the language identified in\n your media, the custom vocabulary is not applied to your transcription.

\n

For more information, see Custom vocabularies.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Specify a name for your Call Analytics transcription session. If you don't include this parameter\n in your request, Amazon Transcribe generates an ID and returns it in the response.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "AudioStream": { + "target": "com.amazonaws.transcribestreaming#AudioStream", + "traits": { + "smithy.api#documentation": "

An encoded stream of audio blobs. Audio streams are encoded as either HTTP/2 or WebSocket \n data frames.

\n

For more information, see Transcribing streaming audio.

", + "smithy.api#httpPayload": {}, + "smithy.api#required": {} + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary filter that you want to use when processing your\n transcription. Note that vocabulary filter names are case sensitive.

\n

If the language of the specified custom vocabulary filter doesn't match the language identified in\n your media, the vocabulary filter is not applied to your transcription.

\n

For more information, see Using vocabulary filtering with unwanted \n words.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-name" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

Specify how you want your vocabulary filter applied to your transcript.

\n

To replace words with ***, choose mask.

\n

To delete words, choose remove.

\n

To flag words without changing them, choose tag.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-method" + } + }, + "LanguageModelName": { + "target": "com.amazonaws.transcribestreaming#ModelName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom language model that you want to use when processing your\n transcription. Note that language model names are case sensitive.

\n

The language of the specified language model must match the language code you specify\n in your transcription request. If the languages don't match, the custom language model isn't applied. \n There are no errors or warnings associated with a language mismatch.

\n

For more information, see Custom language models.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-model-name" + } + }, + "IdentifyLanguage": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables automatic language identification for your Call Analytics transcription.

\n

If you include IdentifyLanguage, you must include a list of\n language codes, using LanguageOptions, that you think may be present in \n your audio stream. You must provide a minimum of two language selections.

\n

You can also include a preferred language using PreferredLanguage. Adding a \n preferred language can help Amazon Transcribe identify the language faster than if you omit this \n parameter.

\n

Note that you must include either LanguageCode or \n IdentifyLanguage in your request. If you include both parameters, your transcription job\n fails.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-language" + } + }, + "LanguageOptions": { + "target": "com.amazonaws.transcribestreaming#LanguageOptions", + "traits": { + "smithy.api#documentation": "

Specify two or more language codes that represent the languages you think may be present \n in your media.

\n

Including language options can improve the accuracy of language identification.

\n

If you include LanguageOptions in your request, you must also include \n IdentifyLanguage.

\n

For a list of languages supported with Call Analytics streaming, refer to the \n Supported \n languages table.

\n \n

You can only include one language dialect per language per stream. For example, you\n cannot include en-US and en-AU in the same request.

\n
", + "smithy.api#httpHeader": "x-amzn-transcribe-language-options" + } + }, + "PreferredLanguage": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

Specify a preferred language from the subset of languages codes you specified in \n LanguageOptions.

\n

You can only use this parameter if you've included IdentifyLanguage and\n LanguageOptions in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-preferred-language" + } + }, + "VocabularyNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyNames", + "traits": { + "smithy.api#documentation": "

Specify the names of the custom vocabularies that you want to use when processing your\n Call Analytics transcription. Note that vocabulary names are case sensitive.

\n

If the custom vocabulary's language doesn't match the identified media language, it won't be applied to the transcription.

\n \n

This parameter is only intended for use with the\n IdentifyLanguage parameter. If you're not\n including IdentifyLanguage in your request and want to use a custom vocabulary\n with your transcription, use the VocabularyName parameter instead.

\n
\n

For more information, see Custom vocabularies.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-names" + } + }, + "VocabularyFilterNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterNames", + "traits": { + "smithy.api#documentation": "

Specify the names of the custom vocabulary filters that you want to use when processing\n your Call Analytics transcription. Note that vocabulary filter names are case sensitive.

\n

These filters serve to customize the transcript output.

\n \n

This parameter is only intended for use with \n the IdentifyLanguage parameter. If you're not \n including IdentifyLanguage in your request and want to use a custom vocabulary filter \n with your transcription, use the VocabularyFilterName parameter instead.

\n
\n

For more information, see Using vocabulary filtering with unwanted \n words.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-names" + } + }, + "EnablePartialResultsStabilization": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables partial result stabilization for your transcription. Partial result stabilization can reduce\n latency in your output, but may impact accuracy. For more information, see \n Partial-result \n stabilization.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-partial-results-stabilization" + } + }, + "PartialResultsStability": { + "target": "com.amazonaws.transcribestreaming#PartialResultsStability", + "traits": { + "smithy.api#documentation": "

Specify the level of stability to use when you enable partial results stabilization \n (EnablePartialResultsStabilization).

\n

Low stability provides the highest accuracy. High stability transcribes faster, but with slightly\n lower accuracy.

\n

For more information, see Partial-result \n stabilization.

", + "smithy.api#httpHeader": "x-amzn-transcribe-partial-results-stability" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#ContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Labels all personally identifiable information (PII) identified in your transcript.

\n

Content identification is performed at the segment level; PII specified in \n PiiEntityTypes is flagged upon complete transcription of an audio segment. If you don't\n include PiiEntityTypes in your request, all PII is identified.

\n

You can\u2019t set ContentIdentificationType and ContentRedactionType\n in the same request. If you set both, your request returns a\n BadRequestException.

\n

For more information, see Redacting or identifying personally identifiable\n information.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + }, + "ContentRedactionType": { + "target": "com.amazonaws.transcribestreaming#ContentRedactionType", + "traits": { + "smithy.api#documentation": "

Redacts all personally identifiable information (PII) identified in your transcript.

\n

Content redaction is performed at the segment level; PII specified in \n PiiEntityTypes is redacted upon complete transcription of an audio segment. If you don't\n include PiiEntityTypes in your request, all PII is redacted.

\n

You can\u2019t set ContentRedactionType and ContentIdentificationType\n in the same request. If you set both, your request returns a BadRequestException.

\n

For more information, see Redacting or identifying personally identifiable\n information.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-redaction-type" + } + }, + "PiiEntityTypes": { + "target": "com.amazonaws.transcribestreaming#PiiEntityTypes", + "traits": { + "smithy.api#documentation": "

Specify which types of personally identifiable information (PII) you want to redact in your \n transcript. You can include as many types as you'd like, or you can select \n ALL.

\n

Values must be comma-separated and can include: ADDRESS, \n BANK_ACCOUNT_NUMBER, BANK_ROUTING,\n CREDIT_DEBIT_CVV, CREDIT_DEBIT_EXPIRY,\n CREDIT_DEBIT_NUMBER, EMAIL, \n NAME, PHONE, PIN, \n SSN, or ALL.

\n

Note that if you include PiiEntityTypes in your request, you must also include \n ContentIdentificationType or ContentRedactionType.

\n

If you include ContentRedactionType or \n ContentIdentificationType in your request, but do not include \n PiiEntityTypes, all PII is redacted or identified.

", + "smithy.api#httpHeader": "x-amzn-transcribe-pii-entity-types" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscriptionResponse": { + "type": "structure", + "members": { + "RequestId": { + "target": "com.amazonaws.transcribestreaming#RequestId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your real-time Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-request-id" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

Provides the language code that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

Provides the sample rate that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate" + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Provides the media encoding you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding" + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom vocabulary that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your Call Analytics transcription session.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "CallAnalyticsTranscriptResultStream": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsTranscriptResultStream", + "traits": { + "smithy.api#documentation": "

Provides detailed information about your real-time Call Analytics session.

", + "smithy.api#httpPayload": {} + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom vocabulary filter that you specified in your Call Analytics\n request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-name" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

Provides the vocabulary filtering method used in your Call Analytics transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-method" + } + }, + "LanguageModelName": { + "target": "com.amazonaws.transcribestreaming#ModelName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom language model that you specified in your Call Analytics \n request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-model-name" + } + }, + "IdentifyLanguage": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether automatic language identification was enabled for your Call Analytics transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-language" + } + }, + "LanguageOptions": { + "target": "com.amazonaws.transcribestreaming#LanguageOptions", + "traits": { + "smithy.api#documentation": "

Provides the language codes that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-options" + } + }, + "PreferredLanguage": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

Provides the preferred language that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-preferred-language" + } + }, + "VocabularyNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyNames", + "traits": { + "smithy.api#documentation": "

Provides the names of the custom vocabularies that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-names" + } + }, + "VocabularyFilterNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterNames", + "traits": { + "smithy.api#documentation": "

Provides the names of the custom vocabulary filters that you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-names" + } + }, + "EnablePartialResultsStabilization": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether partial results stabilization was enabled for your Call Analytics transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-partial-results-stabilization" + } + }, + "PartialResultsStability": { + "target": "com.amazonaws.transcribestreaming#PartialResultsStability", + "traits": { + "smithy.api#documentation": "

Provides the stabilization level used for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-partial-results-stability" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#ContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Shows whether content identification was enabled for your Call Analytics transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + }, + "ContentRedactionType": { + "target": "com.amazonaws.transcribestreaming#ContentRedactionType", + "traits": { + "smithy.api#documentation": "

Shows whether content redaction was enabled for your Call Analytics transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-redaction-type" + } + }, + "PiiEntityTypes": { + "target": "com.amazonaws.transcribestreaming#PiiEntityTypes", + "traits": { + "smithy.api#documentation": "

Lists the PII entity types you specified in your Call Analytics request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-pii-entity-types" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.transcribestreaming#StartMedicalScribeStream": { + "type": "operation", + "input": { + "target": "com.amazonaws.transcribestreaming#StartMedicalScribeStreamRequest" + }, + "output": { + "target": "com.amazonaws.transcribestreaming#StartMedicalScribeStreamResponse" + }, + "errors": [ + { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + ], + "traits": { + "smithy.api#documentation": "

Starts a bidirectional HTTP/2 stream, where audio is streamed to\n Amazon Web Services HealthScribe\n and the transcription results are streamed to your application.

\n

When you start a stream, you first specify the stream configuration in a MedicalScribeConfigurationEvent. \n This event includes channel definitions, encryption settings, medical scribe context, and post-stream analytics settings, such as the output configuration for aggregated transcript and clinical note generation. These are additional\n streaming session configurations beyond those provided in your initial start request headers. Whether you are starting a new session or resuming an existing session, \n your first event must be a MedicalScribeConfigurationEvent.

\n

\n After you send a MedicalScribeConfigurationEvent, you start AudioEvents and Amazon Web Services HealthScribe \n responds with real-time transcription results. When you are finished, to start processing the results with the post-stream analytics, send a MedicalScribeSessionControlEvent with a Type of \n END_OF_SESSION and Amazon Web Services HealthScribe starts the analytics.\n

\n

You can pause or resume streaming.\n To pause streaming, complete the input stream without sending the\n MedicalScribeSessionControlEvent.\n To resume streaming, call the StartMedicalScribeStream and specify the same SessionId you used to start the stream.\n

\n

The following parameters are required:

\n
    \n
  • \n

    \n language-code\n

    \n
  • \n
  • \n

    \n media-encoding\n

    \n
  • \n
  • \n

    \n media-sample-rate-hertz\n

    \n
  • \n
\n

\n

For more information on streaming with\n Amazon Web Services HealthScribe,\n see Amazon Web Services HealthScribe.\n

", + "smithy.api#http": { + "method": "POST", + "uri": "/medical-scribe-stream", + "code": 200 + } + } + }, + "com.amazonaws.transcribestreaming#StartMedicalScribeStreamRequest": { + "type": "structure", + "members": { + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Specify an identifier for your streaming session (in UUID format).\n If you don't include a SessionId in your request,\n Amazon Web Services HealthScribe generates an ID and returns it in the response.\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeLanguageCode", + "traits": { + "smithy.api#documentation": "

Specify the language code for your HealthScribe streaming session.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code", + "smithy.api#required": {} + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

Specify the sample rate of the input audio (in hertz).\n Amazon Web Services HealthScribe supports a range from 16,000 Hz to 48,000 Hz.\n The sample rate you specify must match that of your audio.\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate", + "smithy.api#required": {} + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaEncoding", + "traits": { + "smithy.api#documentation": "

Specify the encoding used for the input audio.

\n

Supported formats are:

\n
    \n
  • \n

    FLAC

    \n
  • \n
  • \n

    OPUS-encoded audio in an Ogg container

    \n
  • \n
  • \n

    PCM (only signed 16-bit little-endian audio formats, which does not include\n WAV)\n

    \n
  • \n
\n

For more information, see Media\n formats.\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding", + "smithy.api#required": {} + } + }, + "InputStream": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeInputStream", + "traits": { + "smithy.api#documentation": "

Specify the input stream where you will send events in real time.

\n

The first element of the input stream must be a MedicalScribeConfigurationEvent.\n

", + "smithy.api#httpPayload": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.transcribestreaming#StartMedicalScribeStreamResponse": { + "type": "structure", + "members": { + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

The identifier (in UUID format) for your streaming session.

\n

If you already started streaming, this is same ID as the one you specified in your initial StartMedicalScribeStreamRequest.\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "RequestId": { + "target": "com.amazonaws.transcribestreaming#RequestId", + "traits": { + "smithy.api#documentation": "

The unique identifier for your streaming request.\n

", + "smithy.api#httpHeader": "x-amzn-request-id" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeLanguageCode", + "traits": { + "smithy.api#documentation": "

The Language Code that you specified in your request.\n Same as provided in the StartMedicalScribeStreamRequest.\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

The sample rate (in hertz) that you specified in your request.\n Same as provided in the\n StartMedicalScribeStreamRequest\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate" + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeMediaEncoding", + "traits": { + "smithy.api#documentation": "

The Media Encoding you specified in your request.\n Same as provided in the\n StartMedicalScribeStreamRequest\n

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding" + } + }, + "ResultStream": { + "target": "com.amazonaws.transcribestreaming#MedicalScribeResultStream", + "traits": { + "smithy.api#documentation": "

The result stream where you will receive the output events.\n

", + "smithy.api#httpPayload": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.transcribestreaming#StartMedicalStreamTranscription": { + "type": "operation", + "input": { + "target": "com.amazonaws.transcribestreaming#StartMedicalStreamTranscriptionRequest" + }, + "output": { + "target": "com.amazonaws.transcribestreaming#StartMedicalStreamTranscriptionResponse" + }, + "errors": [ + { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + ], + "traits": { + "smithy.api#documentation": "

Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to \n Amazon Transcribe Medical and the transcription results are streamed to your\n application.

\n

The following parameters are required:

\n
    \n
  • \n

    \n language-code\n

    \n
  • \n
  • \n

    \n media-encoding\n

    \n
  • \n
  • \n

    \n sample-rate\n

    \n
  • \n
\n

For more information on streaming with Amazon Transcribe Medical, see \n Transcribing\n streaming audio.

", + "smithy.api#http": { + "method": "POST", + "uri": "/medical-stream-transcription", + "code": 200 + } + } + }, + "com.amazonaws.transcribestreaming#StartMedicalStreamTranscriptionRequest": { + "type": "structure", + "members": { + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Specify the language code that represents the language spoken in your audio.

\n \n

Amazon Transcribe Medical only supports US English (en-US).

\n
", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code", + "smithy.api#required": {} + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

The sample rate of the input audio (in hertz). Amazon Transcribe Medical supports a\n range from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must match that\n of your audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate", + "smithy.api#required": {} + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Specify the encoding used for the input audio. Supported formats are:

\n
    \n
  • \n

    FLAC

    \n
  • \n
  • \n

    OPUS-encoded audio in an Ogg container

    \n
  • \n
  • \n

    PCM (only signed 16-bit little-endian audio formats, which does not include\n WAV)

    \n
  • \n
\n

For more information, see Media formats.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding", + "smithy.api#required": {} + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary that you want to use when processing your\n transcription. Note that vocabulary names are case sensitive.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "Specialty": { + "target": "com.amazonaws.transcribestreaming#Specialty", + "traits": { + "smithy.api#documentation": "

Specify the medical specialty contained in your audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-specialty", + "smithy.api#required": {} + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#Type", + "traits": { + "smithy.api#documentation": "

Specify the type of input audio. For example, choose DICTATION for a \n provider dictating patient notes and CONVERSATION for a dialogue between a\n patient and a medical professional.

", + "smithy.api#httpHeader": "x-amzn-transcribe-type", + "smithy.api#required": {} + } + }, + "ShowSpeakerLabel": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables speaker partitioning (diarization) in your transcription output. Speaker\n partitioning labels the speech from individual speakers in your media file.

\n

For more information, see Partitioning speakers (diarization).

", + "smithy.api#httpHeader": "x-amzn-transcribe-show-speaker-label" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Specify a name for your transcription session. If you don't include this parameter in \n your request, Amazon Transcribe Medical generates an ID and returns it in the\n response.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "AudioStream": { + "target": "com.amazonaws.transcribestreaming#AudioStream", + "traits": { + "smithy.api#httpPayload": {}, + "smithy.api#required": {} + } + }, + "EnableChannelIdentification": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables channel identification in multi-channel audio.

\n

Channel identification transcribes the audio on each channel independently, then appends\n the output for each channel into one transcript.

\n

If you have multi-channel audio and do not enable channel identification, your audio is \n transcribed in a continuous manner and your transcript is not separated by channel.

\n

If you include EnableChannelIdentification in your request, you must also \n include NumberOfChannels.

\n

For more information, see Transcribing multi-channel audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-channel-identification" + } + }, + "NumberOfChannels": { + "target": "com.amazonaws.transcribestreaming#NumberOfChannels", + "traits": { + "smithy.api#documentation": "

Specify the number of channels in your audio stream. This value must be \n 2, as only two channels are supported. If your audio doesn't contain \n multiple channels, do not include this parameter in your request.

\n

If you include NumberOfChannels in your request, you must also \n include EnableChannelIdentification.

", + "smithy.api#httpHeader": "x-amzn-transcribe-number-of-channels" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#MedicalContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Labels all personal health information (PHI) identified in your transcript.

\n

Content identification is performed at the segment level; PHI is flagged upon complete\n transcription of an audio segment.

\n

For more information, see Identifying personal health information (PHI) in a\n transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.transcribestreaming#StartMedicalStreamTranscriptionResponse": { + "type": "structure", + "members": { + "RequestId": { + "target": "com.amazonaws.transcribestreaming#RequestId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your streaming request.

", + "smithy.api#httpHeader": "x-amzn-request-id" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Provides the language code that you specified in your request. This must be\n en-US.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

Provides the sample rate that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate" + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Provides the media encoding you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding" + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom vocabulary that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "Specialty": { + "target": "com.amazonaws.transcribestreaming#Specialty", + "traits": { + "smithy.api#documentation": "

Provides the medical specialty that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-specialty" + } + }, + "Type": { + "target": "com.amazonaws.transcribestreaming#Type", + "traits": { + "smithy.api#documentation": "

Provides the type of audio you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-type" + } + }, + "ShowSpeakerLabel": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether speaker partitioning was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-show-speaker-label" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your transcription session.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "TranscriptResultStream": { + "target": "com.amazonaws.transcribestreaming#MedicalTranscriptResultStream", + "traits": { + "smithy.api#documentation": "

Provides detailed information about your streaming session.

", + "smithy.api#httpPayload": {} + } + }, + "EnableChannelIdentification": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether channel identification was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-channel-identification" + } + }, + "NumberOfChannels": { + "target": "com.amazonaws.transcribestreaming#NumberOfChannels", + "traits": { + "smithy.api#documentation": "

Provides the number of channels that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-number-of-channels" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#MedicalContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Shows whether content identification was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.transcribestreaming#StartStreamTranscription": { + "type": "operation", + "input": { + "target": "com.amazonaws.transcribestreaming#StartStreamTranscriptionRequest" + }, + "output": { + "target": "com.amazonaws.transcribestreaming#StartStreamTranscriptionResponse" + }, + "errors": [ + { + "target": "com.amazonaws.transcribestreaming#BadRequestException" + }, + { + "target": "com.amazonaws.transcribestreaming#ConflictException" + }, + { + "target": "com.amazonaws.transcribestreaming#InternalFailureException" + }, + { + "target": "com.amazonaws.transcribestreaming#LimitExceededException" + }, + { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException" + } + ], + "traits": { + "smithy.api#documentation": "

Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to \n Amazon Transcribe and the transcription results are streamed to your application.

\n

The following parameters are required:

\n
    \n
  • \n

    \n language-code or identify-language or identify-multiple-language\n

    \n
  • \n
  • \n

    \n media-encoding\n

    \n
  • \n
  • \n

    \n sample-rate\n

    \n
  • \n
\n

For more information on streaming with Amazon Transcribe, see Transcribing streaming audio.

", + "smithy.api#http": { + "method": "POST", + "uri": "/stream-transcription", + "code": 200 + } + } + }, + "com.amazonaws.transcribestreaming#StartStreamTranscriptionRequest": { + "type": "structure", + "members": { + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Specify the language code that represents the language spoken in your audio.

\n

If you're unsure of the language spoken in your audio, consider using \n IdentifyLanguage to enable automatic language identification.

\n

For a list of languages supported with Amazon Transcribe streaming, refer to the \n Supported \n languages table.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

The sample rate of the input audio (in hertz). Low-quality audio, such as telephone audio,\n is typically around 8,000 Hz. High-quality audio typically ranges from 16,000 Hz to 48,000 Hz.\n Note that the sample rate you specify must match that of your audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate", + "smithy.api#required": {} + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Specify the encoding of your input audio. Supported formats are:

\n
    \n
  • \n

    FLAC

    \n
  • \n
  • \n

    OPUS-encoded audio in an Ogg container

    \n
  • \n
  • \n

    PCM (only signed 16-bit little-endian audio formats, which does not include WAV)

    \n
  • \n
\n

For more information, see Media formats.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding", + "smithy.api#required": {} + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary that you want to use when processing your\n transcription. Note that vocabulary names are case sensitive.

\n

If the language of the specified custom vocabulary doesn't match the language identified in\n your media, the custom vocabulary is not applied to your transcription.

\n \n

This parameter is not intended for use with the\n IdentifyLanguage parameter. If you're including IdentifyLanguage\n in your request and want to use one or more custom vocabularies with your transcription, use\n the VocabularyNames parameter instead.

\n
\n

For more information, see Custom vocabularies.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Specify a name for your transcription session. If you don't include this parameter in your request, \n Amazon Transcribe generates an ID and returns it in the response.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "AudioStream": { + "target": "com.amazonaws.transcribestreaming#AudioStream", + "traits": { + "smithy.api#documentation": "

An encoded stream of audio blobs. Audio streams are encoded as either HTTP/2 or WebSocket \n data frames.

\n

For more information, see Transcribing streaming audio.

", + "smithy.api#httpPayload": {}, + "smithy.api#required": {} + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom vocabulary filter that you want to use when processing your\n transcription. Note that vocabulary filter names are case sensitive.

\n

If the language of the specified custom vocabulary filter doesn't match the language identified in\n your media, the vocabulary filter is not applied to your transcription.

\n \n

This parameter is not intended for use with the\n IdentifyLanguage parameter. If you're including IdentifyLanguage\n in your request and want to use one or more vocabulary filters with your transcription, use\n the VocabularyFilterNames parameter instead.

\n
\n

For more information, see Using vocabulary filtering with unwanted \n words.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-name" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

Specify how you want your vocabulary filter applied to your transcript.

\n

To replace words with ***, choose mask.

\n

To delete words, choose remove.

\n

To flag words without changing them, choose tag.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-method" + } + }, + "ShowSpeakerLabel": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables speaker partitioning (diarization) in your transcription output. Speaker partitioning \n labels the speech from individual speakers in your media file.

\n

For more information, see Partitioning speakers (diarization).

", + "smithy.api#httpHeader": "x-amzn-transcribe-show-speaker-label" + } + }, + "EnableChannelIdentification": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables channel identification in multi-channel audio.

\n

Channel identification transcribes the audio on each channel independently, then appends the \n output for each channel into one transcript.

\n

If you have multi-channel audio and do not enable channel identification, your audio is \n transcribed in a continuous manner and your transcript is not separated by channel.

\n

If you include EnableChannelIdentification in your request, you must also \n include NumberOfChannels.

\n

For more information, see Transcribing multi-channel audio.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-channel-identification" + } + }, + "NumberOfChannels": { + "target": "com.amazonaws.transcribestreaming#NumberOfChannels", + "traits": { + "smithy.api#documentation": "

Specify the number of channels in your audio stream. This value must be \n 2, as only two channels are supported. If your audio doesn't contain \n multiple channels, do not include this parameter in your request.

\n

If you include NumberOfChannels in your request, you must also \n include EnableChannelIdentification.

", + "smithy.api#httpHeader": "x-amzn-transcribe-number-of-channels" + } + }, + "EnablePartialResultsStabilization": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables partial result stabilization for your transcription. Partial result stabilization can reduce\n latency in your output, but may impact accuracy. For more information, see \n Partial-result \n stabilization.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-partial-results-stabilization" + } + }, + "PartialResultsStability": { + "target": "com.amazonaws.transcribestreaming#PartialResultsStability", + "traits": { + "smithy.api#documentation": "

Specify the level of stability to use when you enable partial results stabilization \n (EnablePartialResultsStabilization).

\n

Low stability provides the highest accuracy. High stability transcribes faster, but with slightly\n lower accuracy.

\n

For more information, see Partial-result \n stabilization.

", + "smithy.api#httpHeader": "x-amzn-transcribe-partial-results-stability" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#ContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Labels all personally identifiable information (PII) identified in your transcript.

\n

Content identification is performed at the segment level; PII specified in \n PiiEntityTypes is flagged upon complete transcription of an audio segment. If you don't\n include PiiEntityTypes in your request, all PII is identified.

\n

You can\u2019t set ContentIdentificationType and ContentRedactionType\n in the same request. If you set both, your request returns a\n BadRequestException.

\n

For more information, see Redacting or identifying personally identifiable\n information.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + }, + "ContentRedactionType": { + "target": "com.amazonaws.transcribestreaming#ContentRedactionType", + "traits": { + "smithy.api#documentation": "

Redacts all personally identifiable information (PII) identified in your transcript.

\n

Content redaction is performed at the segment level; PII specified in \n PiiEntityTypes is redacted upon complete transcription of an audio segment. If you don't\n include PiiEntityTypes in your request, all PII is redacted.

\n

You can\u2019t set ContentRedactionType and ContentIdentificationType\n in the same request. If you set both, your request returns a BadRequestException.

\n

For more information, see Redacting or identifying personally identifiable\n information.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-redaction-type" + } + }, + "PiiEntityTypes": { + "target": "com.amazonaws.transcribestreaming#PiiEntityTypes", + "traits": { + "smithy.api#documentation": "

Specify which types of personally identifiable information (PII) you want to redact in your \n transcript. You can include as many types as you'd like, or you can select \n ALL.

\n

Values must be comma-separated and can include: ADDRESS, \n BANK_ACCOUNT_NUMBER, BANK_ROUTING,\n CREDIT_DEBIT_CVV, CREDIT_DEBIT_EXPIRY,\n CREDIT_DEBIT_NUMBER, EMAIL, \n NAME, PHONE, PIN, \n SSN, or ALL.

\n

Note that if you include PiiEntityTypes in your request, you must also include \n ContentIdentificationType or ContentRedactionType.

\n

If you include ContentRedactionType or \n ContentIdentificationType in your request, but do not include \n PiiEntityTypes, all PII is redacted or identified.

", + "smithy.api#httpHeader": "x-amzn-transcribe-pii-entity-types" + } + }, + "LanguageModelName": { + "target": "com.amazonaws.transcribestreaming#ModelName", + "traits": { + "smithy.api#documentation": "

Specify the name of the custom language model that you want to use when processing your\n transcription. Note that language model names are case sensitive.

\n

The language of the specified language model must match the language code you specify\n in your transcription request. If the languages don't match, the custom language model isn't applied. \n There are no errors or warnings associated with a language mismatch.

\n

For more information, see Custom language models.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-model-name" + } + }, + "IdentifyLanguage": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables automatic language identification for your transcription.

\n

If you include IdentifyLanguage, you must include a list of\n language codes, using LanguageOptions, that you think may be present in \n your audio stream.

\n

You can also include a preferred language using PreferredLanguage. Adding a \n preferred language can help Amazon Transcribe identify the language faster than if you omit this \n parameter.

\n

If you have multi-channel audio that contains different languages on each channel, and you've \n enabled channel identification, automatic language identification identifies the dominant language on \n each audio channel.

\n

Note that you must include either LanguageCode or \n IdentifyLanguage or IdentifyMultipleLanguages in your request. If you include more than one of these parameters, your transcription job\n fails.

\n

Streaming language identification can't be combined with custom language models or \n redaction.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-language" + } + }, + "LanguageOptions": { + "target": "com.amazonaws.transcribestreaming#LanguageOptions", + "traits": { + "smithy.api#documentation": "

Specify two or more language codes that represent the languages you think may be present \n in your media; including more than five is not recommended.

\n

Including language options can improve the accuracy of language identification.

\n

If you include LanguageOptions in your request, you must also include \n IdentifyLanguage or IdentifyMultipleLanguages.

\n

For a list of languages supported with Amazon Transcribe streaming, refer to the \n Supported \n languages table.

\n \n

You can only include one language dialect per language per stream. For example, you\n cannot include en-US and en-AU in the same request.

\n
", + "smithy.api#httpHeader": "x-amzn-transcribe-language-options" + } + }, + "PreferredLanguage": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Specify a preferred language from the subset of languages codes you specified in \n LanguageOptions.

\n

You can only use this parameter if you've included IdentifyLanguage and\n LanguageOptions in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-preferred-language" + } + }, + "IdentifyMultipleLanguages": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Enables automatic multi-language identification in your transcription job request. Use this parameter if your stream contains more than one language. If your stream contains only one language, use IdentifyLanguage instead.

\n

If you include IdentifyMultipleLanguages, you must include a list of language codes, using LanguageOptions, that you think may be present in your stream.

\n

If you want to apply a custom vocabulary or a custom vocabulary filter to your automatic multiple language identification request, include VocabularyNames or VocabularyFilterNames.

\n

Note that you must include one of LanguageCode, IdentifyLanguage, or IdentifyMultipleLanguages in your request. If you include more than one of these parameters, your transcription job fails.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-multiple-languages" + } + }, + "VocabularyNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyNames", + "traits": { + "smithy.api#documentation": "

Specify the names of the custom vocabularies that you want to use when processing your\n transcription. Note that vocabulary names are case sensitive.

\n

If none of the languages of the specified custom vocabularies match the language identified in \n your media, your job fails.

\n \n

This parameter is only intended for use with the\n IdentifyLanguage parameter. If you're not\n including IdentifyLanguage in your request and want to use a custom vocabulary\n with your transcription, use the VocabularyName parameter instead.

\n
\n

For more information, see Custom vocabularies.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-names" + } + }, + "VocabularyFilterNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterNames", + "traits": { + "smithy.api#documentation": "

Specify the names of the custom vocabulary filters that you want to use when processing\n your transcription. Note that vocabulary filter names are case sensitive.

\n

If none of the languages of the specified custom vocabulary filters match the language identified\n in your media, your job fails.

\n \n

This parameter is only intended for use with \n the IdentifyLanguage parameter. If you're not \n including IdentifyLanguage in your request and want to use a custom vocabulary filter \n with your transcription, use the VocabularyFilterName parameter instead.

\n
\n

For more information, see Using vocabulary filtering with unwanted \n words.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-names" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.transcribestreaming#StartStreamTranscriptionResponse": { + "type": "structure", + "members": { + "RequestId": { + "target": "com.amazonaws.transcribestreaming#RequestId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your streaming request.

", + "smithy.api#httpHeader": "x-amzn-request-id" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Provides the language code that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-code" + } + }, + "MediaSampleRateHertz": { + "target": "com.amazonaws.transcribestreaming#MediaSampleRateHertz", + "traits": { + "smithy.api#documentation": "

Provides the sample rate that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-sample-rate" + } + }, + "MediaEncoding": { + "target": "com.amazonaws.transcribestreaming#MediaEncoding", + "traits": { + "smithy.api#documentation": "

Provides the media encoding you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-media-encoding" + } + }, + "VocabularyName": { + "target": "com.amazonaws.transcribestreaming#VocabularyName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom vocabulary that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-name" + } + }, + "SessionId": { + "target": "com.amazonaws.transcribestreaming#SessionId", + "traits": { + "smithy.api#documentation": "

Provides the identifier for your transcription session.

", + "smithy.api#httpHeader": "x-amzn-transcribe-session-id" + } + }, + "TranscriptResultStream": { + "target": "com.amazonaws.transcribestreaming#TranscriptResultStream", + "traits": { + "smithy.api#documentation": "

Provides detailed information about your streaming session.

", + "smithy.api#httpPayload": {} + } + }, + "VocabularyFilterName": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom vocabulary filter that you specified in your\n request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-name" + } + }, + "VocabularyFilterMethod": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterMethod", + "traits": { + "smithy.api#documentation": "

Provides the vocabulary filtering method used in your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-method" + } + }, + "ShowSpeakerLabel": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether speaker partitioning was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-show-speaker-label" + } + }, + "EnableChannelIdentification": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether channel identification was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-channel-identification" + } + }, + "NumberOfChannels": { + "target": "com.amazonaws.transcribestreaming#NumberOfChannels", + "traits": { + "smithy.api#documentation": "

Provides the number of channels that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-number-of-channels" + } + }, + "EnablePartialResultsStabilization": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether partial results stabilization was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-enable-partial-results-stabilization" + } + }, + "PartialResultsStability": { + "target": "com.amazonaws.transcribestreaming#PartialResultsStability", + "traits": { + "smithy.api#documentation": "

Provides the stabilization level used for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-partial-results-stability" + } + }, + "ContentIdentificationType": { + "target": "com.amazonaws.transcribestreaming#ContentIdentificationType", + "traits": { + "smithy.api#documentation": "

Shows whether content identification was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-identification-type" + } + }, + "ContentRedactionType": { + "target": "com.amazonaws.transcribestreaming#ContentRedactionType", + "traits": { + "smithy.api#documentation": "

Shows whether content redaction was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-content-redaction-type" + } + }, + "PiiEntityTypes": { + "target": "com.amazonaws.transcribestreaming#PiiEntityTypes", + "traits": { + "smithy.api#documentation": "

Lists the PII entity types you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-pii-entity-types" + } + }, + "LanguageModelName": { + "target": "com.amazonaws.transcribestreaming#ModelName", + "traits": { + "smithy.api#documentation": "

Provides the name of the custom language model that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-model-name" + } + }, + "IdentifyLanguage": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether automatic language identification was enabled for your \n transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-language" + } + }, + "LanguageOptions": { + "target": "com.amazonaws.transcribestreaming#LanguageOptions", + "traits": { + "smithy.api#documentation": "

Provides the language codes that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-language-options" + } + }, + "PreferredLanguage": { + "target": "com.amazonaws.transcribestreaming#LanguageCode", + "traits": { + "smithy.api#documentation": "

Provides the preferred language that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-preferred-language" + } + }, + "IdentifyMultipleLanguages": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Shows whether automatic multi-language identification was enabled for your transcription.

", + "smithy.api#httpHeader": "x-amzn-transcribe-identify-multiple-languages" + } + }, + "VocabularyNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyNames", + "traits": { + "smithy.api#documentation": "

Provides the names of the custom vocabularies that you specified in your request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-names" + } + }, + "VocabularyFilterNames": { + "target": "com.amazonaws.transcribestreaming#VocabularyFilterNames", + "traits": { + "smithy.api#documentation": "

Provides the names of the custom vocabulary filters that you specified in your\n request.

", + "smithy.api#httpHeader": "x-amzn-transcribe-vocabulary-filter-names" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.transcribestreaming#String": { + "type": "string" + }, + "com.amazonaws.transcribestreaming#StringList": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#String" + } + }, + "com.amazonaws.transcribestreaming#TimestampRange": { + "type": "structure", + "members": { + "BeginOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the start of the category \n match.

" + } + }, + "EndOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the end of the category \n match.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains the timestamp range (start time through end time) of a matched category.

" + } + }, + "com.amazonaws.transcribestreaming#TimestampRanges": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribestreaming#TimestampRange" + } + }, + "com.amazonaws.transcribestreaming#Transcribe": { + "type": "service", + "version": "2017-10-26", + "operations": [ + { + "target": "com.amazonaws.transcribestreaming#GetMedicalScribeStream" + }, + { + "target": "com.amazonaws.transcribestreaming#StartCallAnalyticsStreamTranscription" + }, + { + "target": "com.amazonaws.transcribestreaming#StartMedicalScribeStream" + }, + { + "target": "com.amazonaws.transcribestreaming#StartMedicalStreamTranscription" + }, + { + "target": "com.amazonaws.transcribestreaming#StartStreamTranscription" + } + ], + "traits": { + "aws.api#service": { + "sdkId": "Transcribe Streaming", + "arnNamespace": "transcribe", + "cloudFormationName": "TranscribeStreaming", + "cloudTrailEventSource": "transcribestreaming.amazonaws.com", + "endpointPrefix": "transcribestreaming" + }, + "aws.auth#sigv4": { + "name": "transcribe" + }, + "aws.protocols#restJson1": { + "http": [ + "http/1.1", + "h2" + ], + "eventStreamHttp": [ + "h2" + ] + }, + "smithy.api#documentation": "

Amazon Transcribe streaming offers four main types of real-time transcription:\n Standard, Medical,\n Call Analytics,\n and Health Scribe.

\n
    \n
  • \n

    \n Standard transcriptions are the most common option. Refer\n to for details.

    \n
  • \n
  • \n

    \n Medical transcriptions are tailored to medical professionals \n and incorporate medical terms. A common use case for this service is transcribing doctor-patient \n dialogue in real time, so doctors can focus on their patient instead of taking notes. Refer to\n for details.

    \n
  • \n
  • \n

    \n Call Analytics transcriptions are designed for use with call\n center audio on two different channels; if you're looking for insight into customer service calls, use this \n option. Refer to for details.

    \n
  • \n
  • \n

    \n HealthScribe transcriptions are designed to\n automatically create clinical notes from patient-clinician conversations using generative AI.\n Refer to [here] for details.

    \n
  • \n
", + "smithy.api#title": "Amazon Transcribe Streaming Service", + "smithy.rules#endpointRuleSet": { + "version": "1.0", + "parameters": { + "Region": { + "builtIn": "AWS::Region", + "required": false, + "documentation": "The AWS region used to dispatch the request.", + "type": "string" + }, + "UseDualStack": { + "builtIn": "AWS::UseDualStack", + "required": true, + "default": false, + "documentation": "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.", + "type": "boolean" + }, + "UseFIPS": { + "builtIn": "AWS::UseFIPS", + "required": true, + "default": false, + "documentation": "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.", + "type": "boolean" + }, + "Endpoint": { + "builtIn": "SDK::Endpoint", + "required": false, + "documentation": "Override the endpoint used to send this request", + "type": "string" + } + }, + "rules": [ + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "Endpoint" + } + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + } + ], + "error": "Invalid Configuration: FIPS and custom endpoint are not supported", + "type": "error" + }, + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ], + "error": "Invalid Configuration: Dualstack and custom endpoint are not supported", + "type": "error" + }, + { + "conditions": [], + "endpoint": { + "url": { + "ref": "Endpoint" + }, + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "Region" + } + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "aws.partition", + "argv": [ + { + "ref": "Region" + } + ], + "assign": "PartitionResult" + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + }, + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + true, + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "supportsFIPS" + ] + } + ] + }, + { + "fn": "booleanEquals", + "argv": [ + true, + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "supportsDualStack" + ] + } + ] + } + ], + "rules": [ + { + "conditions": [], + "endpoint": { + "url": "https://transcribestreaming-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [], + "error": "FIPS and DualStack are enabled, but this partition does not support one or both", + "type": "error" + } + ], + "type": "tree" + }, + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "supportsFIPS" + ] + }, + true + ] + } + ], + "rules": [ + { + "conditions": [], + "endpoint": { + "url": "https://transcribestreaming-fips.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [], + "error": "FIPS is enabled but this partition does not support FIPS", + "type": "error" + } + ], + "type": "tree" + }, + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + true, + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "supportsDualStack" + ] + } + ] + } + ], + "rules": [ + { + "conditions": [], + "endpoint": { + "url": "https://transcribestreaming.{Region}.{PartitionResult#dualStackDnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [], + "error": "DualStack is enabled but this partition does not support DualStack", + "type": "error" + } + ], + "type": "tree" + }, + { + "conditions": [], + "endpoint": { + "url": "https://transcribestreaming.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + } + ], + "type": "tree" + }, + { + "conditions": [], + "error": "Invalid Configuration: Missing Region", + "type": "error" + } + ] + }, + "smithy.rules#endpointTests": { + "testCases": [ + { + "documentation": "For region ap-northeast-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.ap-northeast-1.amazonaws.com" + } + }, + "params": { + "Region": "ap-northeast-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region ap-northeast-2 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.ap-northeast-2.amazonaws.com" + } + }, + "params": { + "Region": "ap-northeast-2", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region ap-southeast-2 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.ap-southeast-2.amazonaws.com" + } + }, + "params": { + "Region": "ap-southeast-2", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region ca-central-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.ca-central-1.amazonaws.com" + } + }, + "params": { + "Region": "ca-central-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region eu-central-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.eu-central-1.amazonaws.com" + } + }, + "params": { + "Region": "eu-central-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region eu-west-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.eu-west-1.amazonaws.com" + } + }, + "params": { + "Region": "eu-west-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region eu-west-2 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.eu-west-2.amazonaws.com" + } + }, + "params": { + "Region": "eu-west-2", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region sa-east-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.sa-east-1.amazonaws.com" + } + }, + "params": { + "Region": "sa-east-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-east-1.amazonaws.com" + } + }, + "params": { + "Region": "us-east-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-2 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-east-2.amazonaws.com" + } + }, + "params": { + "Region": "us-east-2", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-west-2 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-west-2.amazonaws.com" + } + }, + "params": { + "Region": "us-west-2", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with FIPS enabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-east-1.api.aws" + } + }, + "params": { + "Region": "us-east-1", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with FIPS enabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-east-1.amazonaws.com" + } + }, + "params": { + "Region": "us-east-1", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with FIPS disabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-east-1.api.aws" + } + }, + "params": { + "Region": "us-east-1", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region cn-north-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.cn-north-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-northwest-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.cn-northwest-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-northwest-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with FIPS enabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.cn-north-1.api.amazonwebservices.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region cn-north-1 with FIPS enabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.cn-north-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with FIPS disabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.cn-north-1.api.amazonwebservices.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-gov-east-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-gov-east-1.amazonaws.com" + } + }, + "params": { + "Region": "us-gov-east-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-west-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-gov-west-1.amazonaws.com" + } + }, + "params": { + "Region": "us-gov-west-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-east-1 with FIPS enabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-gov-east-1.api.aws" + } + }, + "params": { + "Region": "us-gov-east-1", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region us-gov-east-1 with FIPS enabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-gov-east-1.amazonaws.com" + } + }, + "params": { + "Region": "us-gov-east-1", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-east-1 with FIPS disabled and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-gov-east-1.api.aws" + } + }, + "params": { + "Region": "us-gov-east-1", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-iso-east-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-iso-east-1.c2s.ic.gov" + } + }, + "params": { + "Region": "us-iso-east-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with FIPS enabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-iso-east-1.c2s.ic.gov" + } + }, + "params": { + "Region": "us-iso-east-1", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-isob-east-1 with FIPS enabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming-fips.us-isob-east-1.sc2s.sgov.gov" + } + }, + "params": { + "Region": "us-isob-east-1", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-isob-east-1 with FIPS disabled and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://transcribestreaming.us-isob-east-1.sc2s.sgov.gov" + } + }, + "params": { + "Region": "us-isob-east-1", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For custom endpoint with region set and fips disabled and dualstack disabled", + "expect": { + "endpoint": { + "url": "https://example.com" + } + }, + "params": { + "Region": "us-east-1", + "UseFIPS": false, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with region not set and fips disabled and dualstack disabled", + "expect": { + "endpoint": { + "url": "https://example.com" + } + }, + "params": { + "UseFIPS": false, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with fips enabled and dualstack disabled", + "expect": { + "error": "Invalid Configuration: FIPS and custom endpoint are not supported" + }, + "params": { + "Region": "us-east-1", + "UseFIPS": true, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with fips disabled and dualstack enabled", + "expect": { + "error": "Invalid Configuration: Dualstack and custom endpoint are not supported" + }, + "params": { + "Region": "us-east-1", + "UseFIPS": false, + "UseDualStack": true, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "Missing region", + "expect": { + "error": "Invalid Configuration: Missing Region" + } + } + ], + "version": "1.0" + } + } + }, + "com.amazonaws.transcribestreaming#Transcript": { + "type": "structure", + "members": { + "Results": { + "target": "com.amazonaws.transcribestreaming#ResultList", + "traits": { + "smithy.api#documentation": "

Contains a set of transcription results from one or more audio segments, along with additional \n information per your request parameters. This can include information relating to alternative\n transcriptions, channel identification, partial result stabilization, language identification, and other\n transcription-related data.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The Transcript associated with a \n .

\n

\n Transcript contains Results, which contains a set of transcription\n results from one or more audio segments, along with additional information per your request \n parameters.

" + } + }, + "com.amazonaws.transcribestreaming#TranscriptEvent": { + "type": "structure", + "members": { + "Transcript": { + "target": "com.amazonaws.transcribestreaming#Transcript", + "traits": { + "smithy.api#documentation": "

Contains Results, which contains a set of transcription results from one or\n more audio segments, along with additional information per your request parameters. This can\n include information relating to alternative transcriptions, channel identification, partial\n result stabilization, language identification, and other transcription-related data.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The TranscriptEvent associated with a \n TranscriptResultStream.

\n

Contains a set of transcription results from one or more audio segments, along with additional \n information per your request parameters.

" + } + }, + "com.amazonaws.transcribestreaming#TranscriptResultStream": { + "type": "union", + "members": { + "TranscriptEvent": { + "target": "com.amazonaws.transcribestreaming#TranscriptEvent", + "traits": { + "smithy.api#documentation": "

Contains Transcript, which contains Results. The \n object contains a set of transcription \n results from one or more audio segments, along with additional information per your request \n parameters.

" + } + }, + "BadRequestException": { + "target": "com.amazonaws.transcribestreaming#BadRequestException", + "traits": { + "smithy.api#documentation": "

A client error occurred when the stream was created. Check the parameters of the request\n and try your request again.

" + } + }, + "LimitExceededException": { + "target": "com.amazonaws.transcribestreaming#LimitExceededException", + "traits": { + "smithy.api#documentation": "

Your client has exceeded one of the Amazon Transcribe limits. This is typically the audio length\n limit. Break your audio stream into smaller chunks and try your request again.

" + } + }, + "InternalFailureException": { + "target": "com.amazonaws.transcribestreaming#InternalFailureException", + "traits": { + "smithy.api#documentation": "

A problem occurred while processing the audio. Amazon Transcribe terminated \n processing.

" + } + }, + "ConflictException": { + "target": "com.amazonaws.transcribestreaming#ConflictException", + "traits": { + "smithy.api#documentation": "

A new stream started with the same session ID. The current stream has been\n terminated.

" + } + }, + "ServiceUnavailableException": { + "target": "com.amazonaws.transcribestreaming#ServiceUnavailableException", + "traits": { + "smithy.api#documentation": "

The service is currently unavailable. Try your request later.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains detailed information about your streaming session.

", + "smithy.api#streaming": {} + } + }, + "com.amazonaws.transcribestreaming#Type": { + "type": "enum", + "members": { + "CONVERSATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CONVERSATION" + } + }, + "DICTATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DICTATION" + } + } + } + }, + "com.amazonaws.transcribestreaming#Uri": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2000 + }, + "smithy.api#pattern": "^(s3://|http(s*)://).+$" + } + }, + "com.amazonaws.transcribestreaming#UtteranceEvent": { + "type": "structure", + "members": { + "UtteranceId": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

The unique identifier that is associated with the specified UtteranceEvent.

" + } + }, + "IsPartial": { + "target": "com.amazonaws.transcribestreaming#Boolean", + "traits": { + "smithy.api#default": false, + "smithy.api#documentation": "

Indicates whether the segment in the UtteranceEvent is complete \n (FALSE) or partial (TRUE).

" + } + }, + "ParticipantRole": { + "target": "com.amazonaws.transcribestreaming#ParticipantRole", + "traits": { + "smithy.api#documentation": "

Provides the role of the speaker for each audio channel, either CUSTOMER or \n AGENT.

" + } + }, + "BeginOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the start of the\n UtteranceEvent.

" + } + }, + "EndOffsetMillis": { + "target": "com.amazonaws.transcribestreaming#Long", + "traits": { + "smithy.api#documentation": "

The time, in milliseconds, from the beginning of the audio stream to the start of the \n UtteranceEvent.

" + } + }, + "Transcript": { + "target": "com.amazonaws.transcribestreaming#String", + "traits": { + "smithy.api#documentation": "

Contains transcribed text.

" + } + }, + "Items": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsItemList", + "traits": { + "smithy.api#documentation": "

Contains words, phrases, or punctuation marks that are associated with the specified \n UtteranceEvent.

" + } + }, + "Entities": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsEntityList", + "traits": { + "smithy.api#documentation": "

Contains entities identified as personally identifiable information (PII) in your transcription \n output.

" + } + }, + "Sentiment": { + "target": "com.amazonaws.transcribestreaming#Sentiment", + "traits": { + "smithy.api#documentation": "

Provides the sentiment that was detected in the specified segment.

" + } + }, + "IssuesDetected": { + "target": "com.amazonaws.transcribestreaming#IssuesDetected", + "traits": { + "smithy.api#documentation": "

Provides the issue that was detected in the specified segment.

" + } + }, + "LanguageCode": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageCode", + "traits": { + "smithy.api#documentation": "

The language code that represents the language spoken in your audio stream.

" + } + }, + "LanguageIdentification": { + "target": "com.amazonaws.transcribestreaming#CallAnalyticsLanguageIdentification", + "traits": { + "smithy.api#documentation": "

The language code of the dominant language identified in your stream.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains set of transcription results from one or more audio segments, along with additional \n information about the parameters included in your request. For example, channel definitions, partial result \n stabilization, sentiment, and issue detection.

" + } + }, + "com.amazonaws.transcribestreaming#VocabularyFilterMethod": { + "type": "enum", + "members": { + "REMOVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "remove" + } + }, + "MASK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mask" + } + }, + "TAG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "tag" + } + } + } + }, + "com.amazonaws.transcribestreaming#VocabularyFilterName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 200 + }, + "smithy.api#pattern": "^[0-9a-zA-Z._-]+$" + } + }, + "com.amazonaws.transcribestreaming#VocabularyFilterNames": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 3000 + }, + "smithy.api#pattern": "^[a-zA-Z0-9,-._]+$" + } + }, + "com.amazonaws.transcribestreaming#VocabularyName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 200 + }, + "smithy.api#pattern": "^[0-9a-zA-Z._-]+$" + } + }, + "com.amazonaws.transcribestreaming#VocabularyNames": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 3000 + }, + "smithy.api#pattern": "^[a-zA-Z0-9,-._]+$" + } + } + } +} \ No newline at end of file diff --git a/examples/transcribestreaming-client/settings.gradle.kts b/examples/transcribestreaming-client/settings.gradle.kts new file mode 100644 index 000000000..459da732b --- /dev/null +++ b/examples/transcribestreaming-client/settings.gradle.kts @@ -0,0 +1,19 @@ +/** + * Generated client from Transcribestreaming service model + */ + +pluginManagement { + val smithyGradleVersion: String by settings + + plugins { + id("software.amazon.smithy.gradle.smithy-base").version(smithyGradleVersion) + } + + repositories { + mavenLocal() + mavenCentral() + gradlePluginPortal() + } +} + +rootProject.name = "Transcribestreaming-client" diff --git a/examples/transcribestreaming-client/smithy-build.json b/examples/transcribestreaming-client/smithy-build.json new file mode 100644 index 000000000..3bd02f4be --- /dev/null +++ b/examples/transcribestreaming-client/smithy-build.json @@ -0,0 +1,11 @@ +{ + "version": "1.0", + "plugins": { + "java-codegen": { + "service": "com.amazonaws.transcribestreaming#Transcribe", + "namespace": "software.amazon.smithy.java.example.transcribestreaming", + "protocol": "aws.protocols#restJson1", + "modes": ["client"] + } + } +} diff --git a/examples/transcribestreaming-client/src/it/java/software/amazon/smithy/java/example/transcribestreaming/client/TranscribeStreamingTest.java b/examples/transcribestreaming-client/src/it/java/software/amazon/smithy/java/example/transcribestreaming/client/TranscribeStreamingTest.java new file mode 100644 index 000000000..df650c70e --- /dev/null +++ b/examples/transcribestreaming-client/src/it/java/software/amazon/smithy/java/example/transcribestreaming/client/TranscribeStreamingTest.java @@ -0,0 +1,158 @@ +package software.amazon.smithy.java.example.transcribestreaming.client; + +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.URL; +import java.nio.ByteBuffer; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Objects; + +import org.junit.jupiter.api.Test; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; +import software.amazon.smithy.java.aws.client.core.settings.RegionSetting; +import software.amazon.smithy.java.aws.sdkv2.auth.SdkCredentialsResolver; +import software.amazon.smithy.java.core.serde.event.EventStream; +import software.amazon.smithy.java.core.serde.event.EventStreamReader; +import software.amazon.smithy.java.example.transcribestreaming.model.Alternative; +import software.amazon.smithy.java.example.transcribestreaming.model.AudioEvent; +import software.amazon.smithy.java.example.transcribestreaming.model.AudioStream; +import software.amazon.smithy.java.example.transcribestreaming.model.LanguageCode; +import software.amazon.smithy.java.example.transcribestreaming.model.MediaEncoding; +import software.amazon.smithy.java.example.transcribestreaming.model.StartStreamTranscriptionInput; +import software.amazon.smithy.java.example.transcribestreaming.model.TranscriptResultStream; +import software.amazon.smithy.java.logging.InternalLogger; +import javax.sound.sampled.AudioSystem; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + + +public class TranscribeStreamingTest { + + private static final InternalLogger LOGGER = InternalLogger.getLogger(TranscribeStreamingTest.class); + + @Test + public void testTranscribeStreaming() throws Exception { + var credentialsProvider = DefaultCredentialsProvider.builder().profileName("smithy-java-test").build(); + // The test will be skipped if we cannot find the AWS credentials under the `smithy-java-test` profile. + assumeTrue(canLoadAwsCredentials(credentialsProvider), "AWS credentials not available"); + LOGGER.info("Running testTranscribeStreaming"); + + var client = TranscribeClient.builder() + .putConfig(RegionSetting.REGION, "us-west-2") + .addIdentityResolver(new SdkCredentialsResolver(credentialsProvider)) + .build(); + + var eventStream = EventStream.newWriter(); + var req = StartStreamTranscriptionInput.builder() + .languageCode(LanguageCode.EN_US) + .mediaSampleRateHertz(22050) + .mediaEncoding(MediaEncoding.PCM) + .audioStream(eventStream) + .build(); + + Thread.ofVirtual() + .start(() -> streamAudio(eventStream)); + + LOGGER.info("Sending request transcript request"); + var res = client.startStreamTranscription(req); + + LOGGER.info("Got transcript response: {}, reading events", res); + var transcription = new StringBuilder(); + Thread.ofVirtual() + .start(() -> readTranscription(transcription, res.getTranscriptResultStream().asReader())) + .join(); + + LOGGER.info("Full transcription: {}", transcription); + assertTrue(transcription.toString().toLowerCase().startsWith("hello from the smithy"), + "full transcript: " + transcription); + } + + private boolean canLoadAwsCredentials(DefaultCredentialsProvider credentialsProvider) { + try { + credentialsProvider.resolveCredentials(); + return true; + } catch (Exception e) { + return false; + } + } + + static void readTranscription(StringBuilder result, EventStreamReader reader) { + reader.forEach(ev -> { + switch (ev) { + case TranscriptResultStream.TranscriptEventMember te -> { + for (var transcriptResult : te.transcriptEvent().getTranscript().getResults()) { + LOGGER.info("Transcription result: isPartial={}, {}", transcriptResult.isIsPartial(), transcriptResult); + if (!transcriptResult.isIsPartial()) { + var transcript = transcriptResult.getAlternatives().stream().map(Alternative::getTranscript).filter(Objects::nonNull).findFirst().orElse(null); + if (transcript != null) { + result.append(transcript); + } + } + } + } + default -> throw new IllegalStateException("Unexpected event " + ev); + } + }); + } + + static void streamAudio(EventStream eventStream) { + var audioUrl = TranscribeStreamingTest.class.getResource("hello-smithy-java-22050.wav"); + try (var writer = eventStream.asWriter()) { + for (var chunk : toIterableChunks(audioUrl)) { + LOGGER.debug("Sending audio chunk, size: {}", chunk.remaining()); + writer.write(AudioStream.builder() + .audioEvent(AudioEvent.builder() + .audioChunk(chunk) + .build()) + .build()); + } + } + } + + static Iterable toIterableChunks(URL audioUrl) { + try { + var audioFile = new File(audioUrl.toURI()); + var format = AudioSystem.getAudioFileFormat(audioUrl); + var audioInputStream = AudioSystem.getAudioInputStream(audioFile); + var bytesPerFrame = format.getFormat().getFrameSize(); + LOGGER.info("Audio stream format of {}: {}, bytesPerFrame: {}", audioFile.getName(), format, bytesPerFrame); + var framesPerChunk = 4096; + return () -> new Iterator<>() { + private byte[] buf; + private int len = -1; + private boolean done = false; + + @Override + public boolean hasNext() { + if (done) { + return false; + } + buf = new byte[framesPerChunk * bytesPerFrame]; + try { + len = audioInputStream.read(buf); + if (len == -1) { + done = true; + return false; + } + return true; + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public ByteBuffer next() { + if (done) { + throw new NoSuchElementException(); + } + return ByteBuffer.wrap(buf, 0, len); + } + }; + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/examples/transcribestreaming-client/src/it/resources/software/amazon/smithy/java/example/transcribestreaming/client/hello-smithy-java-22050.wav b/examples/transcribestreaming-client/src/it/resources/software/amazon/smithy/java/example/transcribestreaming/client/hello-smithy-java-22050.wav new file mode 100644 index 000000000..6ced0979e Binary files /dev/null and b/examples/transcribestreaming-client/src/it/resources/software/amazon/smithy/java/example/transcribestreaming/client/hello-smithy-java-22050.wav differ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e7b050ff2..b0f106462 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,6 +37,8 @@ smithy-utils = { module = "software.amazon.smithy:smithy-utils", version.ref = " smithy-traitcodegen = { module = "software.amazon.smithy:smithy-trait-codegen", version.ref = "smithy" } smithy-rules = { module = "software.amazon.smithy:smithy-rules-engine", version.ref = "smithy" } smithy-aws-endpoints = { module = "software.amazon.smithy:smithy-aws-endpoints", version.ref = "smithy" } +smithy-aws-smoke-test-model = { module = "software.amazon.smithy:smithy-aws-smoke-test-model", version.ref = "smithy" } +smithy-aws-smoke-test-traits = { module = "software.amazon.smithy:smithy-smoke-test-traits", version.ref = "smithy" } # AWS SDK for Java V2 adapters. aws-sdk-retries-spi = {module = "software.amazon.awssdk:retries-spi", version.ref = "aws-sdk"} diff --git a/settings.gradle.kts b/settings.gradle.kts index 05feda801..c54f2eb33 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -93,6 +93,7 @@ include(":aws:sdkv2:aws-sdkv2-auth") include(":examples") include(":examples:basic-server") include(":examples:dynamodb-client") +include(":examples:transcribestreaming-client") include(":examples:end-to-end") include(":examples:event-streaming-client") include(":examples:lambda")