aws / aws-sdk-net

The official AWS SDK for .NET. For more information on the AWS SDK for .NET, see our web site:
http://aws.amazon.com/sdkfornet/
Apache License 2.0
2.02k stars 849 forks source link

How to call StartConversation on Lex V2 agent? #1981

Open ryan-motive opened 2 years ago

ryan-motive commented 2 years ago

We're very eager to use the StartConversation streaming API from LexV2 and were disappointed that it's not currently available in this SDK. We're trying to work out the most painless way of supporting it until it's natively supported in .NET.

Currently we're trying to call the endpoint directly using HttpClient. Although not optimal because it doesn't really support full duplex streaming, we're hoping this should suffice. The main issue is a lack of documentation for how the API should be called.

I've gotten to the point where I can make the call and I am properly serializing the first EventStreamMessage. However I cannot find any documentation for how to compute the :chunk-signature header. I keep getting:

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

The closest documentation I've found is for the Transcription service, but the description of how to handle this header is still a bit vague (in particular, how is the first "priorSig" computed?).

Any hints for how to tackle this would be very welcome. Alternatives at this point will be to link to the C++ library (vcpkg was throwing errors so was not able to test this) or to direct through a Java pod on the server. Best would be to keep it in C# of course. We're happy to take on experimental code if any is being worked on to support this.

ashishdhingra commented 2 years ago

Hi @ryan-motive,

Good morning.

Thanks for opening guidance issue. The specification for signing process could be found at Signing AWS API requests. You may refer AWS4Signer.cs for the internal SDK SigV4 signing process for reference. Please let me know if this helps.

Thanks, Ashish

ryan-motive commented 2 years ago

I am able to sign the requests properly, but I’m not convinced this works for the Event Stream messages. In particular I don’t know which signature to use for the prior signature.

ashishdhingra commented 2 years ago

I am able to sign the requests properly, but I’m not convinced this works for the Event Stream messages. In particular I don’t know which signature to use for the prior signature.

@ryan-motive Amazon Lex V2: Common Parameters provides the list of common parameters for Lex V2 SigV4 signing process. Identity and access management for Amazon Lex V2 also provides some useful information around it.

ryan-motive commented 2 years ago

Again this describes the request signing process. Event Stream messages have an additional parameter for prior signature and it’s not clear to me how this should work.

ashishdhingra commented 2 years ago

Again this describes the request signing process. Event Stream messages have an additional parameter for prior signature and it’s not clear to me how this should work.

@ryan-motive I discussed with the team. You can consume NuGet package https://www.nuget.org/packages/AWSSDK.LexRuntimeV2 to develop LexV2 service interactions with AWS .NET SDK. Somehow, the naming conventions changed with Lex V2 (which is controlled by service models, not the SDK teams).

ryan-motive commented 2 years ago

This is fantastic news!! Thank you!

ashishdhingra commented 2 years ago

This is fantastic news!! Thank you!

@ryan-motive Just checked the documentation https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/LexRuntimeV2/TLexRuntimeV2Client.html for LexRuntimeV2 client, there is no operation like Startconversation and looks like Event Streams are not supported (yet). Not sure if it would meet your needs. Probably this issue is a feature request.

ryan-motive commented 2 years ago

Release notes say this supports streaming though? Or is that not correct?

ryan-motive commented 2 years ago

“This release adds support for Amazon Lex V2 APIs for runtime, including Streaming APIs for conversation management.”

ashishdhingra commented 2 years ago

“This release adds support for Amazon Lex V2 APIs for runtime, including Streaming APIs for conversation management.”

@ryan-motive Thanks for pointing to the release notes. Please review if the LexV2RuntimeClient works for your scenario. Kindly test the scenarios in your test/staging environment and post here of any issues.

ryan-motive commented 2 years ago

We do not see these calls so it appears this is not supported. But given the release note just want to make sure we’re not missing something.

ryan-motive commented 2 years ago

If it is in fact not supported I would strongly recommend editing those notes since they are misleading.