Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Advanced Options' fields #833

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions Libraries/src/Amazon.Lambda.LexEvents/LexActiveContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Amazon.Lambda.LexEvents
{
/// <summary>
/// One or more contexts that are active during this turn of a conversation with the user.
/// </summary>
[DataContract]
public class LexActiveContext
{
/// <summary>
/// The length of time or number of turns in the conversation with the user that the context remains active.
/// </summary>
[DataMember(Name = "timeToLive", EmitDefaultValue = false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("timeToLive")]
#endif
public TimeToLive TimeToLive { get; set; }

/// <summary>
/// The name of the context.
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("name")]
#endif
public string Name { get; set; }

/// <summary>
/// A list of key/value pairs the contains the name and value of the slots from the intent that activated the context.
/// </summary>
[DataMember(Name = "parameters", EmitDefaultValue = false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("parameters")]
#endif
public IDictionary<string, string> Parameters { get; set; }
}

/// <summary>
/// The length of time or number of turns in the conversation with the user that the context remains active.
/// </summary>
[DataContract]
public class TimeToLive
{
/// <summary>
/// The length of time that the context remains active.
/// </summary>
[DataMember(Name = "timeToLiveInSeconds", EmitDefaultValue = false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("timeToLiveInSeconds")]
#endif
public int TimeToLiveInSeconds { get; set; }

/// <summary>
/// The number of turns in the conversation with the user that the context remains active.
/// </summary>
[DataMember(Name = "turnsToLive", EmitDefaultValue = false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("turnsToLive")]
#endif
public int TurnsToLive { get; set; }
}
}
30 changes: 30 additions & 0 deletions Libraries/src/Amazon.Lambda.LexEvents/LexEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Amazon.Lambda.LexEvents
{
Expand Down Expand Up @@ -66,6 +67,30 @@ public class LexEvent
/// </summary>
public LexCurrentIntent CurrentIntent { get; set; }

/// <summary>
/// A List of alternative intents that are returned when the bot is in advanced mode
/// </summary>
public IList<LexCurrentIntent> AlternativeIntents { get; set; }

/// <summary>
/// Gets and sets the property ActiveContexts.
/// A list of active contexts for the session.A context can be set when an intent is fulfilled or by calling the PostContent, PostText, or PutSession operation.
/// You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.
/// </summary>
public IList<LexActiveContext> ActiveContexts { get; set; }

/// <summary>
/// Gets and sets the property NluIntentConfidence.
/// Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent.
/// </summary>
public class LexNluIntentConfidence
{
/// <summary>
/// The score is between 0.0 and 1.0.
/// The score is a relative score, not an absolute score.The score may change based on improvements to Amazon Lex.
/// </summary>
public float Score { get; set; }
}

/// <summary>
/// The class representing the current intent for the Lambda function to process.
Expand All @@ -83,6 +108,11 @@ public class LexCurrentIntent
/// </summary>
public IDictionary<string, string> Slots { get; set; }

/// <summary>
/// Gets and sets the property NluIntentConfidence.
/// </summary>
public LexNluIntentConfidence NluIntentConfidence { get; set; }

/// <summary>
/// Provides additional information about a slot value.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Libraries/src/Amazon.Lambda.LexEvents/LexResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ public class LexResponse
#endif
public LexDialogAction DialogAction { get; set; }

/// <summary>
/// If included, sets the value for one or more contexts. This is an optional field
/// For example, you can include a context to make one or more intents that have that context as an input eligible for recognition in the next turn of the conversation.
/// </summary>
[DataMember(Name = "activeContexts", EmitDefaultValue=false)]
#if NETCOREAPP3_1
[System.Text.Json.Serialization.JsonPropertyName("activeContexts")]
#endif
public IList<LexActiveContext> ActiveContexts { get; set; }

/// <summary>
/// The class representing the dialog action.
/// </summary>
Expand Down