AWS nova documentation change
Summary
Complete rewrite of the documentation page - removed all detailed content including code examples, SDK references, and implementation details, replacing it with a minimal single-line placeholder. The new content appears to be a corrupted or incomplete version with formatting issues.
Security assessment
This appears to be a documentation formatting or corruption issue rather than a security-related change. The diff shows removal of extensive technical documentation about the bidirectional streaming API and replacement with minimal content that has formatting problems (escaped characters like $1$1). There's no evidence of addressing security vulnerabilities, adding security features, or fixing security documentation.
Diff
diff --git a/nova/latest/userguide/speech-bidirection.md b/nova/latest/userguide/speech-bidirection.md index 24d6ddeee..d2631998d 100644 --- a//nova/latest/userguide/speech-bidirection.md +++ b//nova/latest/userguide/speech-bidirection.md @@ -1,482 +1 @@ -[View a markdown version of this page](speech-bidirection.md) - -[](/pdfs/nova/latest/userguide/nova-ug.pdf#speech-bidirection "Open PDF") - -[Documentation](/index.html)[Amazon Nova](/nova/index.html)[User Guide for Amazon Nova](what-is-nova.html) - -# Using the Bidirectional Streaming API - -###### Note - -This documentation is for Amazon Nova Version 1. For the Amazon Nova 2 Sonic guide, visit [Getting started](https://docs.aws.amazon.com/nova/latest/nova2-userguide/sonic-getting-started.html). - -The Amazon Nova Sonic model uses the `InvokeModelWithBidirectionalStream` API, which enables real-time bidirectional streaming conversations. This differs from traditional request-response patterns by maintaining an open channel for continuous audio streaming in both directions. - -The following AWS SDKs support the new bidirectional streaming API: - - * [AWS SDK for .NET](https://aws.amazon.com/sdk-for-net/) - - * [AWS SDK for C++](https://aws.amazon.com/sdk-for-cpp/) - - * [AWS SDK for Java](https://aws.amazon.com/sdk-for-java/) - - * [AWS SDK for JavaScript](https://aws.amazon.com/sdk-for-javascript/) - - * [AWS SDK for Kotlin](https://aws.amazon.com/sdk-for-kotlin/) - - * [AWS SDK for Ruby](https://aws.amazon.com/sdk-for-ruby/) - - * [AWS SDK for Rust](https://aws.amazon.com/sdk-for-rust/) - - * [AWS SDK for Swift](https://aws.amazon.com/sdk-for-swift/) - - - - -Python developers can use this [new experimental SDK](https://github.com/awslabs/aws-sdk-python) that makes it easier to use the bidirectional streaming capabilities of Amazon Nova Sonic. - -The following code examples will help you get started with the bidirectional API. For a complete list of examples, see the Amazon Nova Sonic [Github Samples](https://github.com/aws-samples/amazon-nova-samples/tree/main/speech-to-speech) page. - -The following examples can be used to set up the client and begin using the bidirectional API. - -Python - - - - def _initialize_client(self): - """Initialize the Bedrock client.""" - config = Config( - endpoint_uri=f"https://bedrock-runtime.{self.region}.amazonaws.com", - region=self.region, - aws_credentials_identity_resolver=EnvironmentCredentialsResolver(), - http_auth_scheme_resolver=HTTPAuthSchemeResolver(), - http_auth_schemes={"aws.auth#sigv4": SigV4AuthScheme()} - ) - self.bedrock_client = BedrockRuntimeClient(config=config) - -Java - - - - // The nettyBuilder is optional and mentioned here for clarity, all our APIs support http2 - // and will default to the protocol if the netty builder is not specified. - NettyNioAsyncHttpClient.Builder nettyBuilder = NettyNioAsyncHttpClient.builder() - .readTimeout(Duration.of(180, ChronoUnit.SECONDS)) - .maxConcurrency(20) - .protocol(Protocol.HTTP2) - .protocolNegotiation(ProtocolNegotiation.ALPN); - - - BedrockRuntimeAsyncClient client = BedrockRuntimeAsyncClient.builder() - .region(Region.US_EAST_1) - .credentialsProvider(ProfileCredentialsProvider.create("NOVA-PROFILE")) - .httpClientBuilder(nettyBuilder) - .build(); - -Node.js - - - - const { BedrockRuntimeClient } = require("@aws-sdk/client-bedrock-runtime"); - const { NodeHttp2Handler } = require("@smithy/node-http-handler"); - const { fromIni } = require("@aws-sdk/credential-provider-ini"); - - // Configure HTTP/2 client for bidirectional streaming - // (This is optional, all our APIs support http2 so we will default to http2 if handler is not specified) - const nodeHttp2Handler = new NodeHttp2Handler({ - requestTimeout: 300000, - sessionTimeout: 300000, - disableConcurrentStreams: false, - maxConcurrentStreams: 20, - }); - - // Create a Bedrock client - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentials: fromIni({ profile: "NOVA-PROFILE" }), // Or use other credential providers - requestHandler: nodeHttp2Handler, - }); - -The following examples can be used to handle events with the bidirectional API. - -Python - - - - self.stream_response = await self.bedrock_client.invoke_model_with_bidirectional_stream( - InvokeModelWithBidirectionalStreamInput(model_id=self.model_id) - ) - self.is_active = True - - - async def _process_responses(self): - """Process incoming responses from Bedrock.""" - try: - while self.is_active: - try: - output = await self.stream_response.await_output() - result = await output[1].receive() - if result.value and result.value.bytes_: - try: - response_data = result.value.bytes_.decode('utf-8') - json_data = json.loads(response_data) - - # Handle different response types - if 'event' in json_data: - if 'contentStart' in json_data['event']: - content_start = json_data['event']['contentStart'] - # set role - self.role = content_start['role'] - # Check for speculative content - if 'additionalModelFields' in content_start: - try: - additional_fields = json.loads(content_start['additionalModelFields']) - if additional_fields.get('generationStage') == 'SPECULATIVE': - self.display_assistant_text = True - else: - self.display_assistant_text = False - except json.JSONDecodeError: - print("Error parsing additionalModelFields") - elif 'textOutput' in json_data['event']: - text_content = json_data['event']['textOutput']['content'] - role = json_data['event']['textOutput']['role'] - # Check if there is a barge-in - if '{ "interrupted" : true }' in text_content: - self.barge_in = True - - if (self.role == "ASSISTANT" and self.display_assistant_text): - print(f"Assistant: {text_content}") - elif (self.role == "USER"): - print(f"User: {text_content}") - - elif 'audioOutput' in json_data['event']: - audio_content = json_data['event']['audioOutput']['content'] - audio_bytes = base64.b64decode(audio_content) - await self.audio_output_queue.put(audio_bytes) - elif 'toolUse' in json_data['event']: - self.toolUseContent = json_data['event']['toolUse'] - self.toolName = json_data['event']['toolUse']['toolName'] - self.toolUseId = json_data['event']['toolUse']['toolUseId'] - elif 'contentEnd' in json_data['event'] and json_data['event'].get('contentEnd', {}).get('type') == 'TOOL': - toolResult = await self.processToolUse(self.toolName, self.toolUseContent) - toolContent = str(uuid.uuid4()) - await self.send_tool_start_event(toolContent) - await self.send_tool_result_event(toolContent, toolResult) - await self.send_tool_content_end_event(toolContent) - elif 'completionEnd' in json_data['event']: - # Handle end of conversation, no more response will be generated - print("End of response sequence") - - - # Put the response in the output queue for other components - await self.output_queue.put(json_data) - except json.JSONDecodeError: - await self.output_queue.put({"raw_data": response_data}) - except StopAsyncIteration: - # Stream has ended - break - except Exception as e: - # Handle ValidationException properly - if "ValidationException" in str(e): - error_message = str(e) - print(f"Validation error: {error_message}") - else: - print(f"Error receiving response: {e}") - break - - except Exception as e: - print(f"Response processing error: {e}") - finally: - self.is_active = False - -Java - - -