Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
feat(dotnet): add PredictLong, ported from ONNXAgent.predict_long
kevin-gatimu283ec0667b82
diff --git a/laya-dotnet/CHANGELOG.md b/laya-dotnet/CHANGELOG.mdindex 88f395a6..a3a0ebd0 100644--- a/laya-dotnet/CHANGELOG.md+++ b/laya-dotnet/CHANGELOG.md@@ -6,10 +6,14 @@ All notable changes to the `Laya.Onnx` NuGet package are documented here. The fo## [0.1.0] - unreleased-First release: a port of the Laya Python SDK, tested against laya (Python) 0.3.24.+First release: a port of the Laya Python SDK, tested against laya (Python) 0.4.11 (routing+goldens: 0.4.0).### Added+- `LayaEngine.PredictLong` and `LayaRouter.PredictLong`, ported from Python+ `ONNXAgent.predict_long`: overlapping token windows, batched inference, deciding-window+ attribution, per-type aggregation and summed scan diagnostics.- `LayaEngine`: `choice`, `score` and `noul` predictions over the exported ONNX checkpoints(english, multilingual, typed-decisions); all questions for a state run in one batched forward pass.- Loads both ONNX layouts: the fused `model.onnx` and the split `encoder.onnx` + `head.onnx`.@@ -34,9 +38,9 @@ First release: a port of the Laya Python SDK, tested against laya (Python) 0.3.2### Known gaps-- Python-only opt-in features are not yet ported: abstention (`min_confidence`), `predict_long`,+- Python-only opt-in features are not yet ported: abstention (`min_confidence`),`lang_temperatures`, hooks, batching APIs, question option ordering and digest controls.- `LayaEmail.State` does not expose Python's `max_chars` keyword; use `CleanBody` with a custombudget and pass the cleaned body with `clean: false`.- New Python usage diagnostics (`state_tokens`, `truncated`, `state_tokens_dropped` and- `truncated_questions`) are not exposed by the .NET `Usage` record.+ `truncated_questions`) are populated for `PredictLong`, but not ordinary `Predict`.diff --git a/laya-dotnet/README.md b/laya-dotnet/README.mdindex c74fc58b..fe44bbc3 100644--- a/laya-dotnet/README.md+++ b/laya-dotnet/README.md@@ -31,6 +31,7 @@ hallucinate.- [Quickstart](#quickstart)- [Writing questions](#writing-questions)- [Supplying state](#supplying-state)+- [Long prediction](#long-prediction)- [Reading results](#reading-results)- [Confidence gating](#confidence-gating)- [Built-in presets](#built-in-presets)@@ -291,6 +292,55 @@ engine.Predict(new[] // a---+## Long prediction++`Predict` keeps only the state tokens that fit one sequence. To scan an entire long document,+use the port of Python **`ONNXAgent.predict_long`** (there is no long-prediction API in `laya-ts`):++```csharp+LayaResult result = engine.PredictLong(document, questions, batchSize: 2);+Console.WriteLine(result.Usage.Windows);+if (result["churn_risk"].Window is { } deciding)+ Console.WriteLine($"window {deciding.Index}: tokens {deciding.TokenStart}..{deciding.TokenEnd}");++// The router routes the original document once, then scans it on that checkpoint.+using var router = new LayaRouter();+LayaResult routed = router.PredictLong(document, questions, model: "english", batchSize: 2);+```++- `window` is a state-token count, defaulting to `max(64, max_len - head_max_len - 8)`,+ capped at the smallest state budget left by the questions. `stride` defaults to half the+ effective window (at least 1). Nonpositive values select the defaults, as in Python.+- Tokens are decoded back to text and scored as ordinary states, with the same overlapping+ windows and re-tokenization as Python. `batchSize` caps windows per forward pass; without+ a positive cap they share a run, except for Python's automatic cap when a small window+ multiplies the batch by more than 2x.+- `noul` takes the greatest rounded P(true). `choice` and `score` take the greatest rounded+ `AnswerConfidence`. Ties use the first window. The complete deciding answer (including+ probabilities, score legend and action) is preserved; it is **not** a calibrated probability+ for the whole document.+- `Answer.Window` reports zero-based index, start/end offsets into the original tokenized state+ (end exclusive), and total window count. A state that fits the room the questions leave+ (or, with an explicit `window`, that window) is scored unchanged by one `Predict` pass,+ with `Usage.Windows == 1` and no answer attribution.+- Scan usage sums `InputTokens`, `StateTokens`, `StateTokensDropped` and `Truncated`+ (a window count, including 0/1 for a single window). `TruncatedQuestions` is the last+ window's list; `Options` merges collapsed-option records by question id. These additional+ diagnostics are currently populated only by `PredictLong`, not ordinary `Predict`.+- `aggregate` accepts only `"auto"`. Null state, unsupported aggregation, no state room, or a+ gap-causing stride throws `ArgumentException` (`ArgumentNullException` for null state).+ A stride valid for a requested window that gets clamped is reduced to half its new size.+ Window/stride clamps emit `System.Diagnostics.Trace` warnings; install a listener to see them.+- The router's usual `model`, `task` and `lang` hints select a checkpoint. Attached predictors+ must implement `ILayaLongPredictor`; otherwise the router throws `NotSupportedException`.+ Language-temperature and hook arguments remain unported.++The .NET adaptations are typed records instead of Python dictionaries, trace warnings instead of+`RuntimeWarning`, and .NET argument/capability exceptions. The existing `"laya-rl-agent"` model+identifier is kept, rather than Python ONNXAgent's `"laya-rl-agent-onnx"` suffix.++---+## Reading results`LayaResult` is indexed by question id. `Ids` returns the ids in the order they were asked.@@ -524,6 +574,7 @@ Python's `laya.Agent`.| `static LayaEngine Create(LayaOptions? options = null)` | Finds the artifacts (see [resolution order](https://github.com/NandhaKishorM/laya/blob/main/laya-dotnet/MODELS.md#5-where-the-engine-looks)), loads the config, and builds the ONNX session and tokenizer. May download if `AllowDownload` is set. || `static LayaEngine FromDirectory(string directory)` | Shorthand for `Create(new LayaOptions { ModelDirectory = directory })`. || `LayaResult Predict(object? state, QuestionSet questions)` | Answers every question about `state` in a single batched inference call. See [Supplying state](#supplying-state). |+| `LayaResult PredictLong(object state, QuestionSet questions, int? window = null, int? stride = null, string aggregate = "auto", int? batchSize = null)` | Scans overlapping token windows. See [Long prediction](#long-prediction). || `LayaConfig Config { get; }` | The loaded checkpoint's `rl_agent_config.json`. || `ModelArtifacts Artifacts { get; }` | The paths the artifacts were loaded from. || `void Dispose()` | Releases the session and tokenizer. Safe to call more than once. |@@ -670,6 +721,7 @@ embedding.| `double Confidence` | 0..1. Entropy-based for choice and score, `max(p, 1-p)` for noul. || `double AnswerConfidence` | 0..1. `max(p)`, the same quantity on every question type. || `ActionInfo Action` | The action head's output. |+| `WindowInfo? Window` | Deciding window for a multi-window scan; otherwise null. Token end is exclusive. || `ChoiceAnswer AsChoice()` / `ScoreAnswer AsScore()` / `NoulAnswer AsNoul()` | Narrows to the typed answer. Throws `InvalidOperationException` on a mismatch. |- **`ChoiceAnswer`**: `string Choice`, `IReadOnlyList<KeyValuePair<string, double>> Probabilities`@@ -684,6 +736,12 @@ embedding.acted on directly rather than escalated. It corresponds to Python's `action.act_probability`.- `Usage(int InputTokens, int OutputTokens)`: non-padding input tokens across the batch.`OutputTokens` is always 0.+ Optional scan properties are `Windows`, `StateTokens`, `StateTokensDropped`, `Truncated`+ (all `int?`), `TruncatedQuestions` (`IReadOnlyList<string>?`) and+ `Options` (`IReadOnlyDictionary<string, OptionUsage>?`).+- `WindowInfo(int Index, int TokenStart, int TokenEnd, int Count)` and+ `OptionUsage(int Total, int Distinct, int? TokensPerOption)` are immutable record structs.+ See [Long prediction](#long-prediction) for their semantics.### `LayaPresets` (static)@@ -863,21 +921,22 @@ with `--solution` rather than as a positional argument.## Known gaps-Default predictions and routing are verified against goldens regenerated from Python-**0.3.24**. Language detection uses current script and mixed-language rules; `MixedSegment`+Default and long predictions are verified against goldens regenerated from Python+**0.4.11**, and routing against goldens from Python **0.4.0**. Language detection uses current script and mixed-language rules; `MixedSegment`identifies the foreign line or field that overrides a mostly-English state. UndeterminedLatin text uses the router's configured default. Email cleaning follows current request,disclaimer, signature and reply-header rules, including Portuguese, Spanish and French markers.- **Opt-in features added in Python 0.3.21 are not ported yet:** abstention (`min_confidence`),- `predict_long`, and per-language temperatures (`lang_temperatures`). They are off by default in+ and per-language temperatures (`lang_temperatures`). They are off by default inPython, so default predictions are unaffected. They are planned as follow-ups.- **Other Python-only APIs are not ported:** hooks, batching APIs, question option ordering anddigest controls.- **Custom email-state body budgets:** `LayaEmail.State` does not expose Python's `max_chars`keyword. Call `LayaEmail.CleanBody(body, maxChars)` and pass its result with `clean: false`.- **Usage diagnostics:** Python's `state_tokens`, `truncated`, `state_tokens_dropped` and- `truncated_questions` are not yet exposed by .NET's `Usage` record.+ `truncated_questions` are exposed for `PredictLong` only; ordinary `Predict` still reports+ just input/output tokens.---diff --git a/laya-dotnet/src/Laya/Answers.cs b/laya-dotnet/src/Laya/Answers.csindex 9ed97df7..5da1a9b9 100644--- a/laya-dotnet/src/Laya/Answers.cs+++ b/laya-dotnet/src/Laya/Answers.cs@@ -3,7 +3,72 @@ namespace Laya;/// <summary>Token accounting for one <c>Predict</c> call. Laya emits no tokens, so output is 0.</summary>/// <param name="InputTokens">Non-padding tokens across every question in the batch.</param>/// <param name="OutputTokens">Always 0: a System 1 pass generates nothing.</param>-public readonly record struct Usage(int InputTokens, int OutputTokens);+public readonly record struct Usage(int InputTokens, int OutputTokens)+{+ /// <summary>Windows scored by PredictLong; null for a plain Predict call.</summary>+ public int? Windows { get; init; }++ /// <summary>State tokens read across scan windows, before per-question truncation.</summary>+ public int? StateTokens { get; init; }++ /// <summary>Sum of each window's worst per-question dropped-state count.</summary>+ public int? StateTokensDropped { get; init; }++ /// <summary>Number of scan windows with any truncated question (0 or 1 for a single window).</summary>+ public int? Truncated { get; init; }++ /// <summary>The last window's truncated question ids, matching Python's scan aggregation.</summary>+ public IReadOnlyList<string>? TruncatedQuestions { get; init; }++ /// <summary>Collapsed option spans, merged by question id across scan windows; null if none.</summary>+ public IReadOnlyDictionary<string, OptionUsage>? Options { get; init; }++ /// <summary>Value equality, including the contents of <see cref="TruncatedQuestions"/> and <see cref="Options"/>.</summary>+ public bool Equals(Usage other) =>+ InputTokens == other.InputTokens && OutputTokens == other.OutputTokens+ && Windows == other.Windows && StateTokens == other.StateTokens+ && StateTokensDropped == other.StateTokensDropped && Truncated == other.Truncated+ && SameList(TruncatedQuestions, other.TruncatedQuestions) && SameMap(Options, other.Options);++ /// <inheritdoc/>+ public override int GetHashCode()+ {+ var hash = new HashCode();+ hash.Add(InputTokens);+ hash.Add(OutputTokens);+ hash.Add(Windows);+ hash.Add(StateTokens);+ hash.Add(StateTokensDropped);+ hash.Add(Truncated);+ if (TruncatedQuestions is { } ids)+ foreach (var id in ids) hash.Add(id, StringComparer.Ordinal);+ // Order-independent, so equal maps hash equally whatever their enumeration order.+ if (Options is { } options)+ hash.Add(options.Aggregate(options.Count,+ (acc, pair) => acc ^ HashCode.Combine(StringComparer.Ordinal.GetHashCode(pair.Key), pair.Value)));+ return hash.ToHashCode();+ }++ private static bool SameList(IReadOnlyList<string>? a, IReadOnlyList<string>? b) =>+ ReferenceEquals(a, b) || (a is not null && b is not null && a.SequenceEqual(b, StringComparer.Ordinal));++ private static bool SameMap(IReadOnlyDictionary<string, OptionUsage>? a, IReadOnlyDictionary<string, OptionUsage>? b) =>+ ReferenceEquals(a, b) || (a is not null && b is not null && a.Count == b.Count+ && a.All(pair => b.TryGetValue(pair.Key, out var value) && value == pair.Value));+}++/// <summary>Option-span diagnostics from Python's common.collapsed_options.</summary>+/// <param name="Total">Number of declared options.</param>+/// <param name="Distinct">Number of distinct capped token spans.</param>+/// <param name="TokensPerOption">Cap including the marker, or null when no head-budget cap was needed.</param>+public readonly record struct OptionUsage(int Total, int Distinct, int? TokensPerOption);++/// <summary>The deciding window in the tokenized state; offsets are exclusive-end token indices.</summary>+/// <param name="Index">Zero-based deciding window index.</param>+/// <param name="TokenStart">First state token in the window.</param>+/// <param name="TokenEnd">One past the last state token in the window.</param>+/// <param name="Count">Total windows scored.</param>+public readonly record struct WindowInfo(int Index, int TokenStart, int TokenEnd, int Count);/// <summary>/// The action head's read on whether the answer can be acted on directly.@@ -48,6 +113,19 @@ public abstract class Answer/// <summary>The action head's output.</summary>public ActionInfo Action { get; }+ /// <summary>+ /// Deciding scan window, or null for Predict and the single-window PredictLong fast path.+ /// Probabilities describe this window, not a calibrated whole-document probability.+ /// </summary>+ public WindowInfo? Window { get; private set; }++ internal Answer WithWindow(WindowInfo window)+ {+ var answer = (Answer)MemberwiseClone();+ answer.Window = window;+ return answer;+ }+/// <summary>This answer as a choice answer.</summary>/// <exception cref="InvalidOperationException">If the question was not a choice question.</exception>public ChoiceAnswer AsChoice() => this as ChoiceAnswerdiff --git a/laya-dotnet/src/Laya/ILayaLongPredictor.cs b/laya-dotnet/src/Laya/ILayaLongPredictor.csnew file mode 100644index 00000000..38b62f8e--- /dev/null+++ b/laya-dotnet/src/Laya/ILayaLongPredictor.cs@@ -0,0 +1,9 @@+namespace Laya;++/// <summary>Optional scan capability, mirroring Python Router's predict_long capability check.</summary>+public interface ILayaLongPredictor : ILayaPredictor+{+ /// <summary>Scan overlapping state-token windows and select one answer per question.</summary>+ LayaResult PredictLong(object state, QuestionSet questions, int? window = null, int? stride = null,+ string aggregate = "auto", int? batchSize = null);+}diff --git a/laya-dotnet/src/Laya/LayaEngine.cs b/laya-dotnet/src/Laya/LayaEngine.csindex 42d5e2d5..dde42275 100644--- a/laya-dotnet/src/Laya/LayaEngine.cs+++ b/laya-dotnet/src/Laya/LayaEngine.cs@@ -27,7 +27,7 @@ namespace Laya;/// layout is loaded./// </para>/// </remarks>-public sealed class LayaEngine : IDisposable, ILayaPredictor+public sealed class LayaEngine : IDisposable, ILayaLongPredictor{private const string ModelName = "laya-rl-agent";@@ -36,14 +36,14 @@ public sealed class LayaEngine : IDisposable, ILayaPredictorprivate readonly InferenceSession? _fusedSession;private readonly InferenceSession? _encoderSession;private readonly InferenceSession? _headSession;- private readonly ILayaTokenizer _tokenizer;+ private readonly HfTokenizer _tokenizer;private readonly bool _ownsTokenizer;private readonly Lock _tokenizerGate = new();// 0 = live, 1 = disposed; int so Interlocked.Exchange can operate on it.private int _disposed;private LayaEngine(InferenceSession? fusedSession, InferenceSession? encoderSession,- InferenceSession? headSession, ILayaTokenizer tokenizer, bool ownsTokenizer,+ InferenceSession? headSession, HfTokenizer tokenizer, bool ownsTokenizer,LayaConfig config, ModelArtifacts artifacts){_fusedSession = fusedSession;@@ -195,36 +195,106 @@ public sealed class LayaEngine : IDisposable, ILayaPredictorArgumentNullException.ThrowIfNull(questions);ObjectDisposedException.ThrowIf(Volatile.Read(ref _disposed) == 1, this);if (questions.Count == 0) throw new ArgumentException("no questions to answer", nameof(questions));+ return PredictStates([state], questions, diagnostics: false)[0];+ }+ /// <summary>+ /// Scan a long state in overlapping token windows. Ports Python ONNXAgent.predict_long:+ /// noul selects the greatest P(true); choice and score select the greatest answer confidence.+ /// Ties select the first window. A state within the room the questions leave (or within an+ /// explicit <paramref name="window"/>) takes the normal prediction path.+ /// </summary>+ /// <param name="state">Text, a JSON-shaped object, or a chronological conversation list; not null.</param>+ /// <param name="questions">Questions in declaration order.</param>+ /// <param name="window">State tokens per window; nonpositive or null uses the checkpoint default.+ /// Capped at the smallest state room left by these questions.</param>+ /// <param name="stride">Token step; nonpositive or null uses half the effective window.+ /// A step past the requested window is rejected; a valid step past a clamped window is reduced.</param>+ /// <param name="aggregate">Only "auto" is supported.</param>+ /// <param name="batchSize">Maximum windows per forward pass; nonpositive or null uses Python's automatic cap.</param>+ /// <returns>The deciding window's answers and summed usage, including the number of windows.</returns>+ /// <exception cref="ArgumentException">Unsupported aggregation, a gap-causing stride, or no state room.</exception>+ public LayaResult PredictLong(object state, QuestionSet questions, int? window = null, int? stride = null,+ string aggregate = "auto", int? batchSize = null)+ {+ ArgumentNullException.ThrowIfNull(state);+ ArgumentNullException.ThrowIfNull(questions);+ ObjectDisposedException.ThrowIf(Volatile.Read(ref _disposed) == 1, this);+ if (aggregate != "auto")+ throw new ArgumentException("predict_long: only aggregate='auto' is supported", nameof(aggregate));++ int budget, step, room;+ int[] stateIds;+ lock (_tokenizerGate)+ {+ (budget, step, room) = LongPrediction.Budget(+ _tokenizer, questions, Config.MaxLen, Config.HeadMaxLen, window, stride);+ stateIds = _tokenizer.Encode(PythonJson.State(state).Replace(_tokenizer.MaskToken, " ", StringComparison.Ordinal));+ }+ // Predict reads the whole room the questions leave, so the default window must not+ // force a scan there; an explicit window still bounds the single pass (Python 3e9bda30).+ if (stateIds.Length <= (window is > 0 ? budget : room))+ {+ var single = PredictStates([state], questions, diagnostics: true)[0];+ return new LayaResult(ModelName, [.. single.Ids],+ single.Ids.ToDictionary(id => id, id => single[id], StringComparer.Ordinal),+ single.Usage with { Windows = 1 });+ }+ var spans = LongPrediction.Spans(stateIds.Length, budget, step);+ var windows = new List<object?>(spans.Count);+ lock (_tokenizerGate)+ foreach (var span in spans)+ windows.Add(_tokenizer.Decode(stateIds[span.TokenStart..span.TokenEnd]));+ var cap = LongPrediction.BatchCap(spans.Count, budget,+ Math.Max(64, Config.MaxLen - Config.HeadMaxLen - 8), batchSize) ?? spans.Count;+ var results = new List<LayaResult>(spans.Count);+ for (var i = 0; i < windows.Count; i += cap)+ results.AddRange(PredictStates(windows.GetRange(i, Math.Min(cap, windows.Count - i)),+ questions, diagnostics: true));+ return LongPrediction.Aggregate(questions, results, spans);+ }++ private IReadOnlyList<LayaResult> PredictStates(+ IReadOnlyList<object?> states, QuestionSet questions, bool diagnostics)+ {+ if (questions.Count == 0)+ return states.Select(_ => new LayaResult(ModelName, [], new(StringComparer.Ordinal), new Usage(0, 0))).ToArray();var ids = questions.Ids;- var items = new List<SequenceItem>(questions.Count);+ var items = new List<SequenceItem>(questions.Count * states.Count);+ var details = new List<SequenceBuilder.SequenceDetails>(questions.Count * states.Count);// A chronological conversation list is serialized newest-last, so right-truncation// (the default) would silently drop the newest turn. Matches Agent._encode_state's// `truncate_left = isinstance(state, list)`: only a list-shaped state truncates from the// left; string and dict states keep the existing right-truncation.- var truncateLeft = PythonJson.IsListState(state);// The tokenizer wraps a native handle whose thread safety is not documented, so// tokenization is serialized. Inference is not: it is the expensive part and// InferenceSession.Run is thread-safe.lock (_tokenizerGate){- foreach (var id in ids)+ foreach (var state in states){- var question = questions[id];- var (seq, markers) = SequenceBuilder.Build(- _tokenizer, state, question, Config.MaxLen, Config.HeadMaxLen, truncateLeft);-- // A marker dropped for landing past max_len means an option is not in the sequence- // at all, so its logit would score whatever token happens to sit at position 0.- if (markers.Length != SequenceBuilder.RenderOptions(question).Count)- throw new ArgumentException(- $"question '{id}': only {markers.Length} of its {SequenceBuilder.RenderOptions(question).Count} "- + $"option markers fit in max_len={Config.MaxLen} with head_max_len={Config.HeadMaxLen} "- + "spent on the question; lower head_max_len, raise max_len, or use fewer options", nameof(questions));-- items.Add(new SequenceItem(seq, markers, question.Type));+ var truncateLeft = PythonJson.IsListState(state);+ var stateIds = _tokenizer.Encode(+ PythonJson.State(state).Replace(_tokenizer.MaskToken, " ", StringComparison.Ordinal));+ foreach (var id in ids)+ {+ var question = questions[id];+ var built = SequenceBuilder.BuildDetailed(+ _tokenizer, state, question, Config.MaxLen, Config.HeadMaxLen, truncateLeft, stateIds);+ var (seq, markers) = (built.Ids, built.Markers);++ // A dropped marker would score an unrelated token at position 0.+ if (markers.Length != SequenceBuilder.RenderOptions(question).Count)+ throw new ArgumentException(+ $"question '{id}': only {markers.Length} of its {SequenceBuilder.RenderOptions(question).Count} "+ + $"option markers fit in max_len={Config.MaxLen} with head_max_len={Config.HeadMaxLen} "+ + "spent on the question; lower head_max_len, raise max_len, or use fewer options", nameof(questions));++ items.Add(new SequenceItem(seq, markers, question.Type));+ details.Add(built);+ }}}@@ -235,21 +305,45 @@ public sealed class LayaEngine : IDisposable, ILayaPredictor// hardcoded so the code stays correct if the graph is re-exported with a wider action head.var nAct = actLogits.Length / batch.Count;- var answers = new Dictionary<string, Answer>(questions.Count, StringComparer.Ordinal);- for (var row = 0; row < ids.Count; row++)+ var results = new List<LayaResult>(states.Count);+ for (var stateIndex = 0; stateIndex < states.Count; stateIndex++){- var question = questions[ids[row]];- var k = batch.MarkerCounts[row];- var temperature = Calibration.ResolveTemperature(Config, question.Type, k);- var rowLogits = logits.AsSpan(row * batch.MarkerCount, batch.MarkerCount);- var p = Calibration.Probabilities(rowLogits, k, temperature);-- var action = new ActionInfo(- Calibration.Round4(Calibration.Softmax(actLogits.AsSpan(row * nAct, nAct))[0]));- answers[ids[row]] = BuildAnswer(question, p, k, action);+ var answers = new Dictionary<string, Answer>(questions.Count, StringComparer.Ordinal);+ var offset = stateIndex * ids.Count;+ for (var q = 0; q < ids.Count; q++)+ {+ var row = offset + q;+ var question = questions[ids[q]];+ var k = batch.MarkerCounts[row];+ var temperature = Calibration.ResolveTemperature(Config, question.Type, k);+ var rowLogits = logits.AsSpan(row * batch.MarkerCount, batch.MarkerCount);+ var p = Calibration.Probabilities(rowLogits, k, temperature);++ var action = new ActionInfo(+ Calibration.Round4(Calibration.Softmax(actLogits.AsSpan(row * nAct, nAct))[0]));+ answers[ids[q]] = BuildAnswer(question, p, k, action);+ }+ var stateDetails = details.GetRange(offset, ids.Count);+ var usage = new Usage(stateDetails.Sum(d => d.Ids.Length), 0);+ if (diagnostics)+ {+ var dropped = stateDetails.Max(d => d.StateTokensDropped);+ var collapsed = new Dictionary<string, OptionUsage>(StringComparer.Ordinal);+ for (var q = 0; q < ids.Count; q++)+ if (stateDetails[q].Options.Distinct < stateDetails[q].Options.Total)+ collapsed[ids[q]] = stateDetails[q].Options;+ usage = usage with+ {+ StateTokens = stateDetails[0].StateTokens,+ StateTokensDropped = dropped,+ Truncated = dropped > 0 ? 1 : 0,+ TruncatedQuestions = ids.Where((_, q) => stateDetails[q].StateTokensDropped > 0).ToArray(),+ Options = collapsed.Count == 0 ? null : collapsed,+ };+ }+ results.Add(new LayaResult(ModelName, [.. ids], answers, usage));}-- return new LayaResult(ModelName, [.. ids], answers, new Usage(batch.InputTokens, 0));+ return results;}private static Answer BuildAnswer(Question question, double[] p, int k, ActionInfo action)diff --git a/laya-dotnet/src/Laya/LayaRouter.cs b/laya-dotnet/src/Laya/LayaRouter.csindex 7a649a30..942bbf0a 100644--- a/laya-dotnet/src/Laya/LayaRouter.cs+++ b/laya-dotnet/src/Laya/LayaRouter.cs@@ -93,7 +93,7 @@ public sealed class LayaRouterOptions/// <see cref="Attach"/> to hand the router an instance you own and will dispose yourself./// </para>/// </remarks>-public sealed class LayaRouter : ILayaPredictor, IDisposable+public sealed class LayaRouter : ILayaLongPredictor, IDisposable{// Checkpoint keys people are likely to type, mapped to their canonical name. Matches// Python's _ALIASES exactly.@@ -475,6 +475,33 @@ public sealed class LayaRouter : ILayaPredictor, IDisposablepublic LayaResult Predict(object? state, QuestionSet questions,string? model = null, string? task = null, string? lang = null)+ => PredictRouted(state, questions, model, task, lang,+ predictor => predictor.Predict(state, questions));++ LayaResult ILayaLongPredictor.PredictLong(+ object state, QuestionSet questions, int? window, int? stride, string aggregate, int? batchSize) =>+ PredictLong(state, questions, window, stride, aggregate, batchSize);++ /// <summary>+ /// Route using the usual model/task/lang hints, then scan the entire state. An attached predictor+ /// must implement ILayaLongPredictor; unsupported predictors are never silently truncated.+ /// </summary>+ public LayaResult PredictLong(+ object state, QuestionSet questions, int? window = null, int? stride = null,+ string aggregate = "auto", int? batchSize = null,+ string? model = null, string? task = null, string? lang = null)+ {+ ArgumentNullException.ThrowIfNull(state);+ return PredictRouted(state, questions, model, task, lang, predictor =>+ predictor is ILayaLongPredictor scanner+ ? scanner.PredictLong(state, questions, window, stride, aggregate, batchSize)+ : throw new NotSupportedException(+ $"{predictor.GetType().Name} has no PredictLong, so a state longer than its window cannot be scanned"));+ }++ private LayaResult PredictRouted(+ object? state, QuestionSet questions, string? model, string? task, string? lang,+ Func<ILayaPredictor, LayaResult> predict){ArgumentNullException.ThrowIfNull(questions);var decision = Route(state, questions, model, task, lang);@@ -492,7 +519,7 @@ public sealed class LayaRouter : ILayaPredictor, IDisposable// Inference runs outside the lock, exactly as Python's predict() calls// agent.system_one after load() has already returned and released the lock — so// concurrent predictions on a shared checkpoint are not serialised by the router.- var result = slot.Predictor.Predict(state, questions);+ var result = predict(slot.Predictor);return result.WithRouting(decision);}finallydiff --git a/laya-dotnet/src/Laya/LongPrediction.cs b/laya-dotnet/src/Laya/LongPrediction.csnew file mode 100644index 00000000..216cb5b0--- /dev/null+++ b/laya-dotnet/src/Laya/LongPrediction.cs@@ -0,0 +1,100 @@+using System.Diagnostics;+using Laya.Tokenization;++namespace Laya;++internal static class LongPrediction+{+ internal static (int Window, int Stride, int Room) Budget(+ ILayaTokenizer tokenizer, QuestionSet questions, int maxLen, int headMaxLen,+ int? window, int? stride)+ {+ var requested = window is > 0 ? window.Value : Math.Max(64, maxLen - headMaxLen - 8);+ var room = questions.Count == 0 ? requested : questions.Ids.Min(+ id => SequenceBuilder.StateRoom(tokenizer, questions[id], maxLen, headMaxLen));+ if (room <= 0)+ throw new ArgumentException(+ $"predict_long: the questions' options fill the whole sequence (max_len={maxLen},"+ + $" head_max_len={headMaxLen}), leaving no room for the state; no window can carry any of it."+ + " A label set this large is what laya.shortlist.predict_shortlist is for", nameof(questions));+ var size = Math.Min(requested, room);+ if (size < requested && (window is > 0 || requested >= room * 2L))+ Trace.TraceWarning(+ $"laya: predict_long: scan window capped {requested} -> {size} to fit these questions"+ + $" inside max_len={maxLen}; fewer or shorter options or shortlisting reduce scan cost");+ var step = stride is > 0 ? stride.Value : Math.Max(1, size / 2);+ if (step > size)+ {+ if (size < requested && stride <= requested)+ {+ step = Math.Max(1, size / 2);+ Trace.TraceWarning($"laya: predict_long: stride={stride} reduced to {step} after window clamp");+ }+ else+ throw new ArgumentException(+ $"predict_long: stride={step} steps past the {size}-token window"+ + (size < requested ? " these questions leave room for" : "")+ + $", so {step - size} tokens between every pair of windows would be read by no window at all;"+ + $" pass stride <= {size}", nameof(stride));+ }+ return (size, step, room);+ }++ internal static IReadOnlyList<WindowInfo> Spans(int tokens, int window, int stride)+ {+ var starts = new List<int>();+ for (var i = 0; i < tokens;)+ {+ starts.Add(i);+ if ((long)i + window >= tokens) break;+ i += stride;+ }+ return starts.Select((start, index) =>+ new WindowInfo(index, start, (int)Math.Min((long)start + window, tokens), starts.Count)).ToArray();+ }++ internal static int? BatchCap(int count, int window, int configBudget, int? batchSize)+ {+ if (batchSize is > 0) return batchSize;+ if (window >= configBudget) return null;+ var step = Math.Max(1, window / 2);+ var configStep = Math.Max(1, configBudget / 2);+ var unclamped = Math.Max(1, (int)(((long)count * step + configStep - 1) / configStep));+ return count <= unclamped * 2L ? null : unclamped;+ }++ internal static LayaResult Aggregate(+ QuestionSet questions, IReadOnlyList<LayaResult> results, IReadOnlyList<WindowInfo> spans)+ {+ var answers = new Dictionary<string, Answer>(StringComparer.Ordinal);+ foreach (var id in questions.Ids)+ {+ var best = 0;+ double Evidence(int index) => questions[id].Type == QuestionType.Noul+ ? results[index][id].AsNoul().Probability : results[index][id].AnswerConfidence;+ for (var i = 1; i < results.Count; i++)+ if (Evidence(i) > Evidence(best)) best = i;+ answers[id] = results[best][id].WithWindow(spans[best]);+ }+ Dictionary<string, OptionUsage>? options = null;+ foreach (var result in results)+ if (result.Usage.Options is { } records)+ {+ options ??= new(StringComparer.Ordinal);+ foreach (var (id, stats) in records) options[id] = stats;+ }+ var usage = new Usage(results.Sum(r => r.Usage.InputTokens), 0)+ {+ Windows = results.Count,+ StateTokens = results.Any(r => r.Usage.StateTokens.HasValue)+ ? results.Sum(r => r.Usage.StateTokens ?? 0) : null,+ StateTokensDropped = results.Any(r => r.Usage.StateTokensDropped.HasValue)+ ? results.Sum(r => r.Usage.StateTokensDropped ?? 0) : null,+ Truncated = results.Any(r => r.Usage.Truncated.HasValue)+ ? results.Sum(r => r.Usage.Truncated ?? 0) : null,+ TruncatedQuestions = results.Count == 0 ? null : results[^1].Usage.TruncatedQuestions,+ Options = options,+ };+ return new LayaResult("laya-rl-agent", [.. questions.Ids], answers, usage);+ }+}diff --git a/laya-dotnet/src/Laya/SequenceBuilder.cs b/laya-dotnet/src/Laya/SequenceBuilder.csindex 1c551d6d..bf6bb84c 100644--- a/laya-dotnet/src/Laya/SequenceBuilder.cs+++ b/laya-dotnet/src/Laya/SequenceBuilder.cs@@ -101,6 +101,35 @@ public static class SequenceBuilderpublic static (int[] Ids, int[] Markers) Build(ILayaTokenizer tokenizer, object? state, Question question,int maxLen, int headMaxLen, bool truncateLeft = false)+ {+ var built = BuildDetailed(tokenizer, state, question, maxLen, headMaxLen, truncateLeft);+ return (built.Ids, built.Markers);+ }++ internal readonly record struct SequenceDetails(+ int[] Ids, int[] Markers, int StateTokens, int StateTokensDropped, OptionUsage Options);++ internal static SequenceDetails BuildDetailed(+ ILayaTokenizer tokenizer, object? state, Question question,+ int maxLen, int headMaxLen, bool truncateLeft = false, int[]? stateIds = null)+ {+ var (ids, markers, options) = BuildHead(tokenizer, question, headMaxLen);+ var room = Math.Max(0, maxLen - ids.Count - 1);+ stateIds ??= tokenizer.Encode(Scrub(PythonJson.State(state), tokenizer.MaskToken));+ ids.AddRange(SliceState(stateIds, room, truncateLeft));+ ids.Add(tokenizer.SepId);++ if (ids.Count > maxLen) ids = ids[..maxLen];+ markers.RemoveAll(m => m >= maxLen);+ return new(ids.ToArray(), markers.ToArray(), stateIds.Length,+ Math.Max(0, stateIds.Length - room), options);+ }++ internal static int StateRoom(ILayaTokenizer tokenizer, Question question, int maxLen, int headMaxLen) =>+ Math.Max(0, maxLen - BuildHead(tokenizer, question, headMaxLen).Ids.Count - 1);++ private static (List<int> Ids, List<int> Markers, OptionUsage Options) BuildHead(+ ILayaTokenizer tokenizer, Question question, int headMaxLen){ArgumentNullException.ThrowIfNull(tokenizer);ArgumentNullException.ThrowIfNull(question);@@ -124,9 +153,11 @@ public static class SequenceBuilder}var optBudget = headMaxLen - optionIds.Sum(o => o.Count);+ int? perOption = null;if (optBudget < 16){var per = Math.Max(4, FloorDiv(headMaxLen - 16, Math.Max(1, optionIds.Count)));+ perOption = per;for (var i = 0; i < optionIds.Count; i++)if (optionIds[i].Count > per)optionIds[i] = optionIds[i][..per];@@ -136,7 +167,7 @@ public static class SequenceBuildervar headTake = Math.Max(MinHeadTokens, optBudget);if (headIds.Count > headTake) headIds = headIds[..headTake];- var ids = new List<int>(maxLen) { tokenizer.ClsId };+ var ids = new List<int> { tokenizer.ClsId };ids.AddRange(headIds);ids.Add(tokenizer.SepId);@@ -148,14 +179,8 @@ public static class SequenceBuilder}ids.Add(tokenizer.SepId);- var room = Math.Max(0, maxLen - ids.Count - 1);- var stateIds = tokenizer.Encode(Scrub(PythonJson.State(state), mask));- ids.AddRange(SliceState(stateIds, room, truncateLeft));- ids.Add(tokenizer.SepId);-- if (ids.Count > maxLen) ids = ids[..maxLen];- markers.RemoveAll(m => m >= maxLen);- return (ids.ToArray(), markers.ToArray());+ var distinct = optionIds.Select(o => string.Join(",", o)).Distinct(StringComparer.Ordinal).Count();+ return (ids, markers, new OptionUsage(options.Count, distinct, perOption));}private static string Scrub(string text, string maskToken) =>diff --git a/laya-dotnet/src/Laya/Tokenization/HfTokenizer.cs b/laya-dotnet/src/Laya/Tokenization/HfTokenizer.csindex aac29363..aef0e31c 100644--- a/laya-dotnet/src/Laya/Tokenization/HfTokenizer.cs+++ b/laya-dotnet/src/Laya/Tokenization/HfTokenizer.cs@@ -43,6 +43,8 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposable{private readonly Tokenizer _inner;private readonly string _maskToken;+ private readonly string _sourcePath;+ private Tokenizer? _decoder;/// <inheritdoc/>public int PadId { get; }@@ -81,6 +83,7 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposablepublic HfTokenizer(string tokenizerJsonPath){ArgumentException.ThrowIfNullOrEmpty(tokenizerJsonPath);+ _sourcePath = Path.GetFullPath(tokenizerJsonPath);var strippedPath = EnsureStrippedTokenizer(tokenizerJsonPath);_inner = new Tokenizer(vocabPath: strippedPath);@@ -101,8 +104,24 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposablereturn Array.ConvertAll(tokens, t => (int)t);}+ // Not self-synchronized: the lazy decoder relies on callers serializing use of this+ // instance, as LayaEngine does under its tokenizer gate.+ internal string Decode(int[] ids)+ {+ // Tokenizers.DotNet hardcodes skip_special_tokens=true. A decoder-only copy with+ // added tokens marked non-special gives Python's default decode(..., false) instead.+ // Encoding must keep using the original special-token metadata.+ _decoder ??= new Tokenizer(vocabPath: EnsureStrippedTokenizer(_sourcePath, forDecode: true));+ // The pinned transformers TokenizersBackend disables WordPiece space cleanup for BPE.+ return _decoder.Decode(Array.ConvertAll(ids, id => (uint)id));+ }+/// <inheritdoc/>- public void Dispose() => _inner.Dispose();+ public void Dispose()+ {+ _decoder?.Dispose();+ _inner.Dispose();+ }// ── post-processor stripping ───────────────────────────────────────────────@@ -112,7 +131,7 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposable/// Returns the path to a cached copy of the tokenizer with <c>post_processor</c> set/// to <see langword="null"/>. Regenerates the cache when the source file has changed./// </summary>- private static string EnsureStrippedTokenizer(string sourcePath)+ private static string EnsureStrippedTokenizer(string sourcePath, bool forDecode = false){sourcePath = Path.GetFullPath(sourcePath);var srcInfo = new FileInfo(sourcePath);@@ -123,7 +142,8 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposable// Primary cache: alongside the original.var primaryDir = Path.GetDirectoryName(sourcePath)!;- var primaryPath = Path.Combine(primaryDir, "tokenizer.nopost.json");+ var cacheName = forDecode ? "tokenizer.decode.json" : "tokenizer.nopost.json";+ var primaryPath = Path.Combine(primaryDir, cacheName);if (IsCacheValid(primaryPath, fingerprint))return primaryPath;@@ -133,7 +153,7 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposableif (IsCacheValid(primaryPath, fingerprint))return primaryPath;- if (TryWriteStripped(sourcePath, primaryPath, fingerprint))+ if (TryWriteStripped(sourcePath, primaryPath, fingerprint, forDecode))return primaryPath;// Fallback: a per-source temp directory when the artifact directory is read-only.@@ -141,12 +161,12 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposablePath.GetTempPath(), "laya", FingerprintToSafeName(sourcePath));System.IO.Directory.CreateDirectory(fallbackDir);- var fallbackPath = Path.Combine(fallbackDir, "tokenizer.nopost.json");+ var fallbackPath = Path.Combine(fallbackDir, cacheName);if (IsCacheValid(fallbackPath, fingerprint))return fallbackPath;- if (TryWriteStripped(sourcePath, fallbackPath, fingerprint))+ if (TryWriteStripped(sourcePath, fallbackPath, fingerprint, forDecode))return fallbackPath;throw new IOException(@@ -166,11 +186,11 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposablecatch (IOException) { return false; }}- private static bool TryWriteStripped(string sourcePath, string destPath, string fingerprint)+ private static bool TryWriteStripped(string sourcePath, string destPath, string fingerprint, bool forDecode){try{- WriteStrippedTokenizer(sourcePath, destPath);+ WriteStrippedTokenizer(sourcePath, destPath, forDecode);var info = new FileInfo(destPath);if (!info.Exists || info.Length == 0)return false;@@ -189,7 +209,7 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposable/// <paramref name="destPath"/> via a unique <c>.part</c> temp file so an interrupted write/// or concurrent writer never leaves a partial or colliding cache./// </summary>- private static void WriteStrippedTokenizer(string sourcePath, string destPath)+ private static void WriteStrippedTokenizer(string sourcePath, string destPath, bool forDecode){JsonObject root;using (var stream = File.OpenRead(sourcePath))@@ -198,6 +218,9 @@ public sealed class HfTokenizer : ILayaTokenizer, IDisposable// Setting to null writes "post_processor": null in the output, which the// underlying Rust tokenizers library treats identically to the key being absent.root["post_processor"] = null;+ if (forDecode && root["added_tokens"] is JsonArray added)+ foreach (var token in added)+ if (token is JsonObject obj) obj["special"] = false;var partPath = $"{destPath}.{Guid.NewGuid():N}.part";trydiff --git a/laya-dotnet/tests/Laya.Tests/GoldenData.cs b/laya-dotnet/tests/Laya.Tests/GoldenData.csindex 75913a16..a17724fc 100644--- a/laya-dotnet/tests/Laya.Tests/GoldenData.cs+++ b/laya-dotnet/tests/Laya.Tests/GoldenData.cs@@ -5,7 +5,8 @@ namespace Laya.Tests;/// <summary>One entry of <c>index.json</c>.</summary>/// <param name="Kind">/// <see langword="null"/> for a standard parity case; <c>"shortlist"</c> for a case recorded-/// through <c>predict_shortlist</c> rather than <c>system_one</c> directly. Standard case+/// through <c>predict_shortlist</c>, or <c>"long"</c> through ONNXAgent.predict_long.+/// Standard case/// enumeration excludes non-null kinds, since their <c>result</c> shape and recording flow differ/// from the plain parity cases <see cref="CheckpointGoldenData.SuccessCases"/> //// <see cref="CheckpointGoldenData.ErrorCases"/> are meant for.diff --git a/laya-dotnet/tests/Laya.Tests/HfTokenizerFallbackTests.cs b/laya-dotnet/tests/Laya.Tests/HfTokenizerFallbackTests.csindex 9a5873c3..31d3e3c2 100644--- a/laya-dotnet/tests/Laya.Tests/HfTokenizerFallbackTests.cs+++ b/laya-dotnet/tests/Laya.Tests/HfTokenizerFallbackTests.cs@@ -60,6 +60,38 @@ public sealed class HfTokenizerFallbackTests : IDisposableFile.WriteAllText(Path.Combine(_dir, "tokenizer.json"), json);}+ [Fact]+ public void DecodePreservesSpecialTokensAsPythonDoesForScanWindows()+ {+ var added = string.Join(",", [+ AddedToken("[PAD]", 0), AddedToken("[UNK]", 1), AddedToken("[CLS]", 2),+ AddedToken("[SEP]", 3), AddedToken("[MASK]", 4),+ ]);+ WriteTokenizerJson(added, BracketedVocab);+ using var tok = new HfTokenizer(Path.Combine(_dir, "tokenizer.json"));+ Assert.Equal("[CLS] hello [SEP]", tok.Decode([2, 5, 3]));+ Assert.Equal("", tok.Decode([]));+ }++ [Fact]+ public void DecoderCachesCanInitializeConcurrentlyWithoutChangingTheSourceOrEncoding()+ {+ var added = string.Join(",", [+ AddedToken("[PAD]", 0), AddedToken("[UNK]", 1), AddedToken("[CLS]", 2),+ AddedToken("[SEP]", 3), AddedToken("[MASK]", 4),+ ]);+ WriteTokenizerJson(added, BracketedVocab);+ var path = Path.Combine(_dir, "tokenizer.json");+ var original = File.ReadAllText(path);+ using var first = new HfTokenizer(path);+ using var second = new HfTokenizer(path);+ Parallel.Invoke(+ () => Assert.Equal("[CLS] hello [SEP]", first.Decode([2, 5, 3])),+ () => Assert.Equal("[CLS] hello [SEP]", second.Decode([2, 5, 3])));+ Assert.Equal(new[] { 2, 5, 3 }, first.Encode("[CLS] hello [SEP]"));+ Assert.Equal(original, File.ReadAllText(path));+ }+[Fact]public void NoTokenizerConfig_ResolvesBracketedSpecialTokensFromAddedTokens(){diff --git a/laya-dotnet/tests/Laya.Tests/LongPredictionTests.cs b/laya-dotnet/tests/Laya.Tests/LongPredictionTests.csnew file mode 100644index 00000000..4f90aefd--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/LongPredictionTests.cs@@ -0,0 +1,296 @@+namespace Laya.Tests;++public sealed class LongPredictionTests+{+ private static QuestionSet Questions() => new()+ {+ ["choice"] = Question.Choice("Pick a topic.", "a", "b"),+ ["score"] = Question.Score("How urgent?", "low", "high"),+ ["noul"] = Question.Noul("Customer cancels."),+ };++ [Theory]+ [InlineData(64, 64, 32, 1, 0, 64)]+ [InlineData(65, 64, 32, 2, 32, 65)]+ [InlineData(128, 64, 32, 3, 64, 128)]+ [InlineData(129, 64, 32, 4, 96, 129)]+ [InlineData(129, 64, 64, 3, 128, 129)]+ [InlineData(5, 1, 1, 5, 4, 5)]+ public void SpansCoverEveryTokenAndStopAtFirstCompleteWindow(+ int tokens, int window, int stride, int count, int lastStart, int lastEnd)+ {+ var spans = LongPrediction.Spans(tokens, window, stride);+ Assert.Equal(count, spans.Count);+ Assert.Equal(new WindowInfo(count - 1, lastStart, lastEnd, count), spans[^1]);+ Assert.Equal(0, spans[0].TokenStart);+ for (var i = 0; i < spans.Count; i++)+ {+ Assert.Equal(i, spans[i].Index);+ Assert.Equal(count, spans[i].Count);+ if (i > 0) Assert.True(spans[i].TokenStart <= spans[i - 1].TokenEnd);+ }+ }++ [Fact]+ public void SpansOfAnEmptyStateAreEmptyAndAShortStateIsOneSpan()+ {+ Assert.Empty(LongPrediction.Spans(0, 64, 32)); // `while i < n` never enters+ Assert.Equal(new WindowInfo(0, 0, 10, 1), Assert.Single(LongPrediction.Spans(10, 64, 32)));+ }++ [Fact]+ public void SpansEndAtTheStateLengthNotPastIt()+ {+ // i + budget >= n breaks after the window that reaches the end; token_end = min(start + budget, n).+ var spans = LongPrediction.Spans(100, 64, 48);+ Assert.Equal([new WindowInfo(0, 0, 64, 2), new WindowInfo(1, 48, 100, 2)], spans);+ }++ [Theory]+ [InlineData(null, null, 312, 156)]+ [InlineData(0, -1, 312, 156)]+ [InlineData(-5, 0, 312, 156)]+ [InlineData(32, 32, 32, 32)]+ [InlineData(1, null, 1, 1)]+ public void BudgetUsesPythonDefaults(int? window, int? stride, int size, int step)+ {+ var (got, gotStep, _) = LongPrediction.Budget(new StubTokenizer(), Questions(), 512, 192, window, stride);+ Assert.Equal((size, step), (got, gotStep));+ }++ [Fact]+ public void BudgetCapsAtSmallestQuestionRoomAndAdjustsAValidRequestedStride()+ {+ var tok = new StubTokenizer();+ var questions = Questions();+ questions["many"] = Question.Choice("Pick.",+ Enumerable.Range(0, 25).Select(i => new KeyValuePair<string, object?>($"label{i}", "four word description here")));+ var room = questions.Ids.Min(id => SequenceBuilder.StateRoom(tok, questions[id], 160, 192));+ Assert.Equal((room, Math.Max(1, room / 2), room), LongPrediction.Budget(tok, questions, 160, 192, 1000, 500));+ }++ // window_budget returns `room = min(rooms) if rooms else size` (common.py:403); the single-pass+ // condition in predict_long reads it back (onnx_agent.py:553).+ [Fact]+ public void BudgetRoomIsTheSmallestQuestionRoomAndMayExceedTheDefaultWindow()+ {+ var tok = new StubTokenizer();+ var questions = Questions();+ var room = questions.Ids.Min(id => SequenceBuilder.StateRoom(tok, questions[id], 512, 192));+ var (size, _, got) = LongPrediction.Budget(tok, questions, 512, 192, null, null);+ Assert.Equal(room, got);+ Assert.Equal(312, size);+ Assert.True(got > size);+ // An explicit window below the room leaves the room untouched too.+ var (small, _, same) = LongPrediction.Budget(tok, questions, 512, 192, 100, null);+ Assert.Equal((100, room), (small, same));+ }++ [Theory]+ [InlineData(null, 312)]+ [InlineData(0, 312)]+ [InlineData(-3, 312)]+ [InlineData(40, 40)]+ [InlineData(2000, 2000)]+ public void BudgetWithNoQuestionsHasRoomEqualToTheRequestedWindow(int? window, int expected)+ {+ var (size, step, room) = LongPrediction.Budget(new StubTokenizer(), new QuestionSet(), 512, 192, window, null);+ Assert.Equal((expected, Math.Max(1, expected / 2), expected), (size, step, room));+ }++ [Fact]+ public void BudgetWithNoQuestionsUsesTheDefaultWindowFloorAndStillRefusesAStrideGap()+ {+ // max(64, max_len - head_max_len - 8): the 64 floor holds when head_max_len is widened.+ var (size, _, room) = LongPrediction.Budget(new StubTokenizer(), new QuestionSet(), 200, 192, null, null);+ Assert.Equal((64, 64), (size, room));+ // Nothing clamps the window, so a stride past it is the caller's error, not a library clamp.+ Assert.Throws<ArgumentException>(() =>+ LongPrediction.Budget(new StubTokenizer(), new QuestionSet(), 512, 192, 40, 41));+ }++ [Fact]+ public void BudgetRoomEqualsTheWindowWhenTheRoomCapsIt()+ {+ var tok = new StubTokenizer();+ var questions = Questions();+ questions["many"] = Question.Choice("Pick.",+ Enumerable.Range(0, 25).Select(i => new KeyValuePair<string, object?>($"label{i}", "four word description here")));+ var room = questions.Ids.Min(id => SequenceBuilder.StateRoom(tok, questions[id], 160, 192));+ Assert.InRange(room, 1, 311);+ foreach (int? window in new int?[] { null, 1000 })+ {+ var (size, _, got) = LongPrediction.Budget(tok, questions, 160, 192, window, null);+ Assert.Equal((room, room), (size, got));+ }+ }++ [Fact]+ public void BudgetRefusesAStrideThatOvershotTheRequestedWindowEvenWhenTheWindowWasClamped()+ {+ var tok = new StubTokenizer();+ var questions = Questions();+ questions["many"] = Question.Choice("Pick.",+ Enumerable.Range(0, 25).Select(i => new KeyValuePair<string, object?>($"label{i}", "four word description here")));+ // stride > requested window: the caller's mistake (common.py:441), reported against the clamped window.+ var error = Assert.Throws<ArgumentException>(() => LongPrediction.Budget(tok, questions, 160, 192, 1000, 1001));+ Assert.Contains("these questions leave room for", error.Message);+ // stride == requested window is valid for it, so it is clamped to half the effective window instead.+ var room = questions.Ids.Min(id => SequenceBuilder.StateRoom(tok, questions[id], 160, 192));+ Assert.Equal((room, Math.Max(1, room / 2), room), LongPrediction.Budget(tok, questions, 160, 192, 1000, 1000));+ }++ [Fact]+ public void BudgetRejectsGapsAndZeroStateRoom()+ {+ var error = Assert.Throws<ArgumentException>(() =>+ LongPrediction.Budget(new StubTokenizer(), Questions(), 512, 192, 32, 33));+ Assert.StartsWith("predict_long: stride=33 steps past the 32-token window", error.Message);+ Assert.Throws<ArgumentException>(() =>+ LongPrediction.Budget(new StubTokenizer(), Questions(), 10, 192, null, null));+ Assert.Throws<ArgumentException>(() =>+ LongPrediction.Budget(new StubTokenizer(), Questions(), 100, 192, 1000, 1001));+ }++ [Theory]+ [InlineData(100, 312, 312, null, null)]+ [InlineData(100, 200, 312, null, null)]+ [InlineData(100, 50, 312, null, 17)]+ [InlineData(100, 50, 312, 0, 17)]+ [InlineData(100, 50, 312, -1, 17)]+ [InlineData(100, 50, 312, 3, 3)]+ public void AutomaticBatchCapMatchesPython(int count, int window, int defaultBudget, int? batch, int? expected) =>+ Assert.Equal(expected, LongPrediction.BatchCap(count, window, defaultBudget, batch));++ // window_batch_cap: unclamped = ceil(n * max(1, w // 2) / max(1, budget // 2)); None when n <= 2 * unclamped.+ [Theory]+ [InlineData(100, 312, 312, 7, 7)] // explicit batch_size is honoured even when the window is not capped+ [InlineData(100, 50, 1, null, null)] // window >= budget: not capped, and budget // 2 floors at 1+ [InlineData(1, 1, 312, null, null)] // unclamped 1; 1 <= 2+ [InlineData(2, 50, 312, null, null)] // unclamped ceil(50/156) = 1; n == 2 * unclamped keeps the single pass+ [InlineData(3, 50, 312, null, 1)] // one past the blow-up factor chunks at unclamped+ [InlineData(12, 50, 312, null, 2)] // ceil(300/156) = 2; 12 > 4+ [InlineData(34, 50, 312, null, 6)] // ceil(850/156) = 6; 34 > 12+ [InlineData(5, 200, 312, null, null)] // ceil(500/156) = 4; 5 <= 8: a mild cap+ [InlineData(100, 1, 312, null, 1)] // window // 2 floors at 1: ceil(100/156) = 1+ public void BatchCapEdgeCasesMatchPython(int count, int window, int defaultBudget, int? batch, int? expected) =>+ Assert.Equal(expected, LongPrediction.BatchCap(count, window, defaultBudget, batch));++ private static LayaResult Result(double choiceConfidence, double scoreConfidence, double noul, int tokens,+ IReadOnlyDictionary<string, OptionUsage>? options = null) =>+ new("laya-rl-agent", ["choice", "score", "noul"], new(StringComparer.Ordinal)+ {+ ["choice"] = new ChoiceAnswer("a", [new("a", choiceConfidence), new("b", 1 - choiceConfidence)],+ 0.1, choiceConfidence, new ActionInfo(choiceConfidence)),+ ["score"] = new ScoreAnswer(scoreConfidence, ["low", "high"], [1 - scoreConfidence, scoreConfidence],+ 0.2, scoreConfidence, new ActionInfo(scoreConfidence)),+ ["noul"] = new NoulAnswer(noul, Math.Max(noul, 1 - noul), Math.Max(noul, 1 - noul), new ActionInfo(noul)),+ }, new Usage(tokens, 0)+ {+ StateTokens = tokens - 10, StateTokensDropped = 1, Truncated = 1,+ TruncatedQuestions = tokens == 20 ? ["score"] : [], Options = options,+ });++ [Fact]+ public void AggregationSelectsEvidenceNotEntropyAndPreservesFirstTiesAndWholeAnswer()+ {+ var first = Result(0.8, 0.6, 0.05, 20, new Dictionary<string, OptionUsage> { ["choice"] = new(2, 1, 4) });+ var second = Result(0.8, 0.9, 0.7, 30, new Dictionary<string, OptionUsage> { ["score"] = new(2, 1, 4) });+ var spans = LongPrediction.Spans(65, 64, 32);+ var got = LongPrediction.Aggregate(Questions(), [first, second], spans);+ Assert.Equal(new[] { "choice", "score", "noul" }, got.Ids);+ Assert.Equal(spans[0], got["choice"].Window);+ Assert.Equal(spans[1], got["score"].Window);+ Assert.Equal(spans[1], got["noul"].Window);+ Assert.Equal(first["choice"].Action, got["choice"].Action);+ Assert.Equal(second["score"].AsScore().Score, got["score"].AsScore().Score);+ Assert.Equal(0.7, got["noul"].AsNoul().Probability);+ Assert.Null(first["choice"].Window);+ Assert.Equal(50, got.Usage.InputTokens);+ Assert.Equal(30, got.Usage.StateTokens);+ Assert.Equal(2, got.Usage.StateTokensDropped);+ Assert.Equal(2, got.Usage.Truncated);+ Assert.Empty(got.Usage.TruncatedQuestions!);+ Assert.Equal(new[] { "choice", "score" }, got.Usage.Options!.Keys);+ }++ [Fact]+ public void AggregationKeepsTheFirstWindowOnTiesAndLetsALaterOptionsRecordWin()+ {+ var a = Result(0.8, 0.6, 0.7, 20, new Dictionary<string, OptionUsage> { ["choice"] = new(2, 1, 4) });+ var b = Result(0.8, 0.6, 0.7, 30, new Dictionary<string, OptionUsage> { ["choice"] = new(5, 3, 9) });+ var spans = LongPrediction.Spans(65, 64, 32);+ var got = LongPrediction.Aggregate(Questions(), [a, b], spans);+ foreach (var id in new[] { "choice", "score", "noul" }) Assert.Equal(spans[0], got[id].Window);+ // Python merges `{**prev, **val}`: the later window's record for the same id replaces the earlier.+ Assert.Equal(new OptionUsage(5, 3, 9), got.Usage.Options!["choice"]);+ Assert.Equal(2, got.Usage.Windows);+ }++ [Fact]+ public void AggregationOfOneWindowAndOfUsageWithoutTruncationFields()+ {+ var one = new LayaResult("laya-rl-agent", ["choice", "score", "noul"], Result(0.8, 0.6, 0.7, 20).Answers.ToDictionary(+ p => p.Key, p => p.Value, StringComparer.Ordinal), new Usage(20, 5));+ var got = LongPrediction.Aggregate(Questions(), [one], LongPrediction.Spans(10, 64, 32));+ Assert.Equal(new WindowInfo(0, 0, 10, 1), got["noul"].Window);+ Assert.Equal(20, got.Usage.InputTokens);+ Assert.Equal(0, got.Usage.OutputTokens); // usage["output_tokens"] = 0 (onnx_agent.py:659)+ Assert.Equal(1, got.Usage.Windows);+ Assert.Null(got.Usage.StateTokens);+ Assert.Null(got.Usage.StateTokensDropped);+ Assert.Null(got.Usage.Truncated);+ Assert.Null(got.Usage.Options);+ }++ [Fact]+ public void AggregationCarriesTheLastWindowsTruncatedQuestions()+ {+ var spans = LongPrediction.Spans(65, 64, 32);+ var got = LongPrediction.Aggregate(Questions(), [Result(0.8, 0.6, 0.7, 20), Result(0.8, 0.6, 0.7, 30)], spans);+ Assert.Empty(got.Usage.TruncatedQuestions!); // the last window's list, though the first named "score"+ Assert.Equal(2, got.Usage.Truncated);+ }++ private sealed class Scanner : ILayaLongPredictor+ {+ public bool Called;+ public object? State;+ public (int?, int?, string, int?) Options;+ public LayaResult Predict(object? state, QuestionSet questions) => throw new InvalidOperationException("plain path used");+ public LayaResult PredictLong(object state, QuestionSet questions, int? window = null, int? stride = null,+ string aggregate = "auto", int? batchSize = null)+ {+ Called = true;+ State = state;+ Options = (window, stride, aggregate, batchSize);+ return Result(0.7, 0.8, 0.6, 20);+ }+ }++ [Fact]+ public void RouterRoutesOriginalStateAndForwardsTheScanArguments()+ {+ var scanner = new Scanner();+ using var router = new LayaRouter(null, _ => scanner);+ var got = router.PredictLong("Mein Konto wurde zweimal belastet.", Questions(),+ model: null, window: 32, stride: 16, batchSize: 2);+ Assert.True(scanner.Called);+ Assert.Equal("Mein Konto wurde zweimal belastet.", scanner.State);+ Assert.Equal((32, 16, "auto", 2), scanner.Options);+ Assert.Equal(LayaCheckpoint.Multilingual, got.Routing!.Model);+ }++ private sealed class PlainPredictor : ILayaPredictor+ {+ public LayaResult Predict(object? state, QuestionSet questions) => throw new InvalidOperationException("must not truncate");+ }++ [Fact]+ public void RouterRejectsPredictorsWithoutScanSupportAndNullState()+ {+ using var router = new LayaRouter(null, _ => new PlainPredictor());+ Assert.Throws<NotSupportedException>(() => router.PredictLong("hello", Questions()));+ Assert.Throws<ArgumentNullException>(() => router.PredictLong(null!, Questions()));+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/PredictParityTests.Long.cs b/laya-dotnet/tests/Laya.Tests/PredictParityTests.Long.csnew file mode 100644index 00000000..099fc783--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/PredictParityTests.Long.cs@@ -0,0 +1,154 @@+using Laya.Tokenization;+using System.Text.Json;++namespace Laya.Tests;++public sealed partial class PredictParityTests+{+ public static IEnumerable<object[]> LongSuccessCases() =>+ from checkpoint in TestArtifacts.ParityCheckpoints+ where GoldenData.For(checkpoint).Available+ from info in GoldenData.For(checkpoint).Index.Where(i => i.Kind == "long" && !i.ExpectsError)+ from split in new[] { false, true }+ select new object[] { checkpoint, info, split };++ public static IEnumerable<object[]> LongErrorCases() =>+ from checkpoint in TestArtifacts.ParityCheckpoints+ where GoldenData.For(checkpoint).Available+ from info in GoldenData.For(checkpoint).Index.Where(i => i.Kind == "long" && i.ExpectsError)+ select new object[] { checkpoint, info };++ [Theory]+ [MemberData(nameof(LongSuccessCases))]+ public void ReproducesLongPredictions(LayaCheckpoint checkpoint, GoldenCaseInfo info, bool split)+ {+ var engine = split ? fixture.RequireSplit(checkpoint) : fixture.Require(checkpoint);+ using var doc = GoldenData.For(checkpoint).Load(info);+ var root = doc.RootElement;+ var state = GoldenData.ToClr(root.GetProperty("state"))!;+ var questions = GoldenData.BuildQuestions(root.GetProperty("questions"));+ var options = root.GetProperty("options");+ var got = engine.PredictLong(state, questions, LongInt(options, "window"), LongInt(options, "stride"),+ options.TryGetProperty("aggregate", out var aggregate) ? aggregate.GetString()! : "auto",+ LongInt(options, "batch_size"));+ var expected = root.GetProperty("result");+ // The SDK keeps its existing model identifier instead of Python ONNXAgent's suffix.+ Assert.Equal("laya-rl-agent-onnx", expected.GetProperty("model").GetString());+ Assert.Equal("laya-rl-agent", got.Model);+ AssertLongUsage(expected.GetProperty("usage"), got.Usage);+ var answers = expected.GetProperty("answers");+ Assert.Equal(answers.EnumerateObject().Select(p => p.Name), got.Ids);+ foreach (var entry in answers.EnumerateObject())+ {+ var want = entry.Value;+ var answer = got[entry.Name];+ var where = $"{checkpoint}/{split}/{info.Name}/{entry.Name}";+ Assert.Equal(want.GetProperty("type").GetString(), SequenceBuilder.TypeName(answer.Type));+ AssertClose(want.GetProperty("confidence").GetDouble(), answer.Confidence, ProbTolerance, where + ".confidence");+ AssertClose(want.GetProperty("answer_confidence").GetDouble(), answer.AnswerConfidence,+ ProbTolerance, where + ".answer_confidence");+ AssertClose(want.GetProperty("action").GetProperty("act_probability").GetDouble(),+ answer.Action.ActProbability, ProbTolerance, where + ".action");+ switch (answer.Type)+ {+ case QuestionType.Choice: AssertChoice(want, answer.AsChoice(), where); break;+ case QuestionType.Score: AssertScore(want, answer.AsScore(), where); break;+ case QuestionType.Noul:+ AssertClose(want.GetProperty("noul").GetDouble(), answer.AsNoul().Probability, ProbTolerance, where);+ break;+ }+ if (want.TryGetProperty("window", out var window))+ Assert.Equal(new WindowInfo(window.GetProperty("index").GetInt32(),+ window.GetProperty("token_start").GetInt32(), window.GetProperty("token_end").GetInt32(),+ window.GetProperty("count").GetInt32()), answer.Window);+ else+ Assert.Null(answer.Window);+ }++ // These comparisons pin token offsets, decoder cleanup and special-token retention+ // independently of model probabilities (a dropped token could otherwise round away).+ using var tokenizer = new HfTokenizer(engine.Artifacts.TokenizerPath);+ var stateIds = tokenizer.Encode(PythonJson.State(state).Replace(tokenizer.MaskToken, " ", StringComparison.Ordinal));+ Assert.Equal(root.GetProperty("state_tokens").GetInt32(), stateIds.Length);+ var (budget, step, room) = LongPrediction.Budget(tokenizer, questions, engine.Config.MaxLen,+ engine.Config.HeadMaxLen, LongInt(options, "window"), LongInt(options, "stride"));+ Assert.Equal(root.GetProperty("effective_window").GetInt32(), budget);+ Assert.Equal(root.GetProperty("effective_stride").GetInt32(), step);+ Assert.Equal(root.GetProperty("effective_room").GetInt32(), room);+ foreach (var window in root.GetProperty("windows").EnumerateArray())+ Assert.Equal(window.GetProperty("text").GetString(), tokenizer.Decode(stateIds[+ window.GetProperty("token_start").GetInt32()..window.GetProperty("token_end").GetInt32()]));++ if (info.Name == "long_exact_limit")+ {+ Assert.Equal(budget, stateIds.Length);+ Assert.Equal(1, got.Usage.Windows);+ }+ if (info.Name == "long_room_fast_path")+ {+ Assert.True(stateIds.Length > budget);+ Assert.Equal(room, stateIds.Length);+ Assert.Equal(1, got.Usage.Windows);+ }+ if (got.Usage.Windows == 1 && questions.Count > 0)+ {+ var plain = engine.Predict(state, questions);+ Assert.Equal(plain.Usage.InputTokens, got.Usage.InputTokens);+ foreach (var id in questions.Ids)+ {+ Assert.Equal(plain[id].Confidence, got[id].Confidence);+ Assert.Equal(plain[id].AnswerConfidence, got[id].AnswerConfidence);+ Assert.Equal(plain[id].Action, got[id].Action);+ }+ }+ }++ [Theory]+ [MemberData(nameof(LongErrorCases))]+ public void ReproducesLongErrors(LayaCheckpoint checkpoint, GoldenCaseInfo info)+ {+ var engine = fixture.Require(checkpoint);+ using var doc = GoldenData.For(checkpoint).Load(info);+ var root = doc.RootElement;+ var options = root.GetProperty("options");+ var error = Assert.Throws<ArgumentException>(() => engine.PredictLong(+ GoldenData.ToClr(root.GetProperty("state"))!, GoldenData.BuildQuestions(root.GetProperty("questions")),+ LongInt(options, "window"), LongInt(options, "stride"),+ options.TryGetProperty("aggregate", out var aggregate) ? aggregate.GetString()! : "auto",+ LongInt(options, "batch_size")));+ Assert.StartsWith(root.GetProperty("error_message").GetString()!, error.Message, StringComparison.Ordinal);+ }++ private static int? LongInt(JsonElement options, string name) =>+ options.TryGetProperty(name, out var value) ? value.GetInt32() : null;++ private static void AssertLongUsage(JsonElement want, Usage got)+ {+ Assert.Equal(want.GetProperty("input_tokens").GetInt32(), got.InputTokens);+ Assert.Equal(want.GetProperty("output_tokens").GetInt32(), got.OutputTokens);+ Assert.Equal(want.GetProperty("windows").GetInt32(), got.Windows);+ Assert.Equal(LongInt(want, "state_tokens"), got.StateTokens);+ Assert.Equal(LongInt(want, "state_tokens_dropped"), got.StateTokensDropped);+ int? truncated = want.TryGetProperty("truncated", out var t)+ ? t.ValueKind == JsonValueKind.Number ? t.GetInt32() : t.GetBoolean() ? 1 : 0 : null;+ Assert.Equal(truncated, got.Truncated);+ if (want.TryGetProperty("truncated_questions", out var ids))+ Assert.Equal(ids.EnumerateArray().Select(id => id.GetString()!), got.TruncatedQuestions);+ else+ Assert.Null(got.TruncatedQuestions);+ if (want.TryGetProperty("options", out var options))+ {+ Assert.NotNull(got.Options);+ Assert.Equal(options.EnumerateObject().Select(p => p.Name), got.Options.Keys);+ foreach (var entry in options.EnumerateObject())+ {+ var tokens = entry.Value.GetProperty("tokens_per_option");+ Assert.Equal(new OptionUsage(entry.Value.GetProperty("total").GetInt32(),+ entry.Value.GetProperty("distinct").GetInt32(),+ tokens.ValueKind == JsonValueKind.Null ? null : tokens.GetInt32()), got.Options[entry.Name]);+ }+ }+ else+ Assert.Null(got.Options);+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/PredictParityTests.cs b/laya-dotnet/tests/Laya.Tests/PredictParityTests.csindex 767b3035..2d086b45 100644--- a/laya-dotnet/tests/Laya.Tests/PredictParityTests.cs+++ b/laya-dotnet/tests/Laya.Tests/PredictParityTests.cs@@ -12,7 +12,7 @@ namespace Laya.Tests;/// which is why the tolerances sit a little above 1e-4 rather than at zero./// </remarks>[Collection(AllEnginesCollection.Name)]-public sealed class PredictParityTests(AllEnginesFixture fixture)+public sealed partial class PredictParityTests(AllEnginesFixture fixture){/// <summary>Probabilities and confidences: 4-dp values, so a rounding boundary is 1e-4 wide.</summary>private const double ProbTolerance = 2e-4;diff --git a/laya-dotnet/tests/Laya.Tests/UsageTests.cs b/laya-dotnet/tests/Laya.Tests/UsageTests.csnew file mode 100644index 00000000..13b9e510--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/UsageTests.cs@@ -0,0 +1,179 @@+namespace Laya.Tests;++public class UsageTests+{+ private static Usage Full(+ IReadOnlyList<string>? truncated = null, IReadOnlyDictionary<string, OptionUsage>? options = null) =>+ new(10, 0)+ {+ Windows = 2, StateTokens = 100, StateTokensDropped = 5, Truncated = 1,+ TruncatedQuestions = truncated, Options = options,+ };++ [Fact]+ public void Plain_Values_EqualAndHashEqual()+ {+ var a = new Usage(10, 0);+ var b = new Usage(10, 0);+ Assert.True(a.Equals(b));+ Assert.Equal(a, b);+ Assert.Equal(a.GetHashCode(), b.GetHashCode());+ Assert.True(a == b);+ Assert.False(a != b);+ }++ [Fact]+ public void Plain_Different_NotEqual_OperatorsAgree()+ {+ var a = new Usage(10, 0);+ var b = new Usage(11, 0);+ Assert.False(a.Equals(b));+ Assert.False(a == b);+ Assert.True(a != b);+ Assert.NotEqual(new Usage(10, 0), new Usage(10, 1));+ }++ [Fact]+ public void EqualContent_DistinctLists_EqualAndHashEqual()+ {+ var a = Full(truncated: new List<string> { "q1", "q2" });+ var b = Full(truncated: new[] { "q1", "q2" });+ Assert.True(a.Equals(b));+ Assert.True(a == b);+ Assert.False(a != b);+ Assert.Equal(a.GetHashCode(), b.GetHashCode());+ }++ [Fact]+ public void EqualContent_DistinctDictionaries_EqualAndHashEqual()+ {+ var a = Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, 8), ["q2"] = new(2, 2, null) });+ var b = Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, 8), ["q2"] = new(2, 2, null) });+ Assert.True(a.Equals(b));+ Assert.True(a == b);+ Assert.Equal(a.GetHashCode(), b.GetHashCode());+ }++ [Fact]+ public void Dictionaries_DifferentInsertionOrder_EqualAndHashEqual()+ {+ var a = Full(options: new Dictionary<string, OptionUsage>+ {+ ["a"] = new(1, 1, null), ["b"] = new(2, 2, 5), ["c"] = new(3, 1, 7),+ });+ var b = Full(options: new Dictionary<string, OptionUsage>+ {+ ["c"] = new(3, 1, 7), ["a"] = new(1, 1, null), ["b"] = new(2, 2, 5),+ });+ Assert.True(a.Equals(b));+ Assert.True(a == b);+ Assert.Equal(a.GetHashCode(), b.GetHashCode());+ }++ [Fact]+ public void TruncatedQuestions_NullVsEmpty_NotEqual()+ {+ var a = Full(truncated: null);+ var b = Full(truncated: Array.Empty<string>());+ Assert.False(a.Equals(b));+ Assert.False(b.Equals(a));+ Assert.True(a != b);+ }++ [Fact]+ public void TruncatedQuestions_BothNull_Equal()+ {+ Assert.True(Full(truncated: null) == Full(truncated: null));+ }++ [Fact]+ public void TruncatedQuestions_DifferentOrder_NotEqual()+ {+ var a = Full(truncated: new[] { "q1", "q2" });+ var b = Full(truncated: new[] { "q2", "q1" });+ Assert.False(a.Equals(b));+ Assert.True(a != b);+ }++ [Fact]+ public void TruncatedQuestions_DifferentContentOrLength_NotEqual()+ {+ var a = Full(truncated: new[] { "q1", "q2" });+ Assert.NotEqual(a, Full(truncated: new[] { "q1", "q3" }));+ Assert.NotEqual(a, Full(truncated: new[] { "q1" }));+ Assert.NotEqual(a, Full(truncated: new[] { "Q1", "q2" })); // ordinal, case-sensitive+ }++ [Fact]+ public void Options_NullVsEmpty_NotEqual()+ {+ var a = Full(options: null);+ var b = Full(options: new Dictionary<string, OptionUsage>());+ Assert.False(a.Equals(b));+ Assert.False(b.Equals(a));+ Assert.True(a != b);+ }++ [Fact]+ public void Options_BothNullOrBothEmpty_Equal()+ {+ Assert.True(Full(options: null) == Full(options: null));+ Assert.True(+ Full(options: new Dictionary<string, OptionUsage>())+ == Full(options: new Dictionary<string, OptionUsage>()));+ }++ [Fact]+ public void Options_DifferentValue_NotEqual()+ {+ var a = Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, 8) });+ Assert.NotEqual(a, Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 2, 8) }));+ Assert.NotEqual(a, Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, null) }));+ }++ [Fact]+ public void Options_ExtraKeyOrDifferentKey_NotEqual()+ {+ var a = Full(options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, 8) });+ var extra = Full(options: new Dictionary<string, OptionUsage>+ {+ ["q1"] = new(4, 3, 8), ["q2"] = new(4, 3, 8),+ });+ var renamed = Full(options: new Dictionary<string, OptionUsage> { ["q2"] = new(4, 3, 8) });+ Assert.NotEqual(a, extra);+ Assert.NotEqual(extra, a);+ Assert.NotEqual(a, renamed);+ Assert.True(a != extra);+ }++ [Fact]+ public void ScalarFields_EachDifference_NotEqual()+ {+ var a = Full();+ Assert.NotEqual(a, a with { Windows = 3 });+ Assert.NotEqual(a, a with { StateTokens = 101 });+ Assert.NotEqual(a, a with { StateTokensDropped = 6 });+ Assert.NotEqual(a, a with { Truncated = 0 });+ Assert.NotEqual(a, a with { Windows = null });+ Assert.NotEqual(a, a with { StateTokens = null });+ Assert.NotEqual(a, a with { StateTokensDropped = null });+ Assert.NotEqual(a, a with { Truncated = null });+ }++ [Fact]+ public void WithCopies_StayEqual()+ {+ var a = Full(+ truncated: new List<string> { "q1" },+ options: new Dictionary<string, OptionUsage> { ["q1"] = new(4, 3, 8) });+ var copy = a with { };+ Assert.True(a == copy);+ Assert.Equal(a.GetHashCode(), copy.GetHashCode());++ var sameBack = (a with { Windows = 9 }) with { Windows = 2 };+ Assert.True(a.Equals(sameBack));+ Assert.Equal(a.GetHashCode(), sameBack.GetHashCode());++ Assert.NotEqual(a, a with { InputTokens = 11 });+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_clamp.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_clamp.jsonnew file mode 100644index 00000000..e0327d38--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_clamp.json@@ -0,0 +1,128 @@+{+ "name": "long_clamp",+ "state": "Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 4096,+ "stride": 2048,+ "batch_size": 2+ },+ "state_tokens": 857,+ "effective_window": 478,+ "effective_stride": 239,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 478,+ "text": "Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account"+ },+ {+ "token_start": 239,+ "token_end": 717,+ "text": ". Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal"+ },+ {+ "token_start": 478,+ "token_end": 857,+ "text": " activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.9124,+ "technical": 0.0563,+ "other": 0.0313+ },+ "confidence": 0.6778,+ "answer_confidence": 0.9124,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 478,+ "token_end": 857,+ "count": 3+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.4876,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.1355,+ "1": 0.2414,+ "2": 0.6231+ },+ "confidence": 0.1729,+ "answer_confidence": 0.6231,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 478,+ "token_end": 857,+ "count": 3+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.9655,+ "confidence": 0.9655,+ "answer_confidence": 0.9655,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 478,+ "token_end": 857,+ "count": 3+ }+ }+ },+ "usage": {+ "input_tokens": 4287,+ "output_tokens": 0,+ "state_tokens": 1335,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 3+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_dict.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_dict.jsonnew file mode 100644index 00000000..bb73d54d--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_dict.json@@ -0,0 +1,129 @@+{+ "name": "long_dict",+ "state": {+ "notes": "Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. ",+ "message": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ },+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96+ },+ "state_tokens": 179,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": "{\"notes\": \"Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": ". Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan"+ },+ {+ "token_start": 96,+ "token_end": 179,+ "text": " checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8794,+ "technical": 0.0613,+ "other": 0.0593+ },+ "confidence": 0.5889,+ "answer_confidence": 0.8794,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 179,+ "count": 3+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.4528,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.6652,+ "1": 0.2168,+ "2": 0.118+ },+ "confidence": 0.2219,+ "answer_confidence": 0.6652,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 0,+ "token_start": 0,+ "token_end": 96,+ "count": 3+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.8946,+ "confidence": 0.8946,+ "answer_confidence": 0.8946,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 179,+ "count": 3+ }+ }+ },+ "usage": {+ "input_tokens": 1107,+ "output_tokens": 0,+ "state_tokens": 275,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 3+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_empty_questions.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_empty_questions.jsonnew file mode 100644index 00000000..34e42d25--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_empty_questions.json@@ -0,0 +1,64 @@+{+ "name": "long_empty_questions",+ "state": "Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. ",+ "questions": {},+ "options": {+ "window": 32,+ "batch_size": 2+ },+ "state_tokens": 141,+ "effective_window": 32,+ "effective_stride": 16,+ "effective_room": 32,+ "windows": [+ {+ "token_start": 0,+ "token_end": 32,+ "text": "Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 16,+ "token_end": 48,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 32,+ "token_end": 64,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 48,+ "token_end": 80,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 64,+ "token_end": 96,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 80,+ "token_end": 112,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 96,+ "token_end": 128,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 112,+ "token_end": 141,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {},+ "usage": {+ "input_tokens": 0,+ "output_tokens": 0,+ "windows": 8+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_exact_limit.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_exact_limit.jsonnew file mode 100644index 00000000..75a7361f--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_exact_limit.json@@ -0,0 +1,90 @@+{+ "name": "long_exact_limit",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 312,+ "effective_window": 312,+ "effective_stride": 156,+ "effective_room": 478,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.5786,+ "technical": 0.2117,+ "other": 0.2097+ },+ "confidence": 0.1145,+ "answer_confidence": 0.5786,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.9141,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.3697,+ "1": 0.3466,+ "2": 0.2838+ },+ "confidence": 0.0055,+ "answer_confidence": 0.3697,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.1347,+ "confidence": 0.8653,+ "answer_confidence": 0.8653,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 1030,+ "output_tokens": 0,+ "state_tokens": 312,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_aggregate.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_aggregate.jsonnew file mode 100644index 00000000..1b1a6496--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_aggregate.json@@ -0,0 +1,33 @@+{+ "name": "long_invalid_aggregate",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "aggregate": "mean"+ },+ "error_type": "ValueError",+ "error_message": "predict_long: only aggregate='auto' is supported"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_stride.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_stride.jsonnew file mode 100644index 00000000..d710ad47--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_invalid_stride.json@@ -0,0 +1,34 @@+{+ "name": "long_invalid_stride",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 32,+ "stride": 33+ },+ "error_type": "ValueError",+ "error_message": "predict_long: stride=33 steps past the 32-token window, so 1 tokens between every pair of windows would be read by no window at all; pass stride <= 32"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_list.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_list.jsonnew file mode 100644index 00000000..9ed8257d--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_list.json@@ -0,0 +1,146 @@+{+ "name": "long_list",+ "state": [+ {+ "role": "assistant",+ "content": "Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. "+ },+ {+ "role": "user",+ "content": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96,+ "stride": 48+ },+ "state_tokens": 244,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": "[{\"role\": \"assistant\", \"content\": \"Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we"+ },+ {+ "token_start": 96,+ "token_end": 192,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 882"+ },+ {+ "token_start": 144,+ "token_end": 240,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling"+ },+ {+ "token_start": 192,+ "token_end": 244,+ "text": "13\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}]"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.9092,+ "technical": 0.0544,+ "other": 0.0364+ },+ "confidence": 0.6674,+ "answer_confidence": 0.9092,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 144,+ "token_end": 240,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.8904,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.029,+ "1": 0.0516,+ "2": 0.9194+ },+ "confidence": 0.6969,+ "answer_confidence": 0.9194,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 192,+ "token_end": 244,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.9909,+ "confidence": 0.9909,+ "answer_confidence": 0.9909,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 192,+ "token_end": 244,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1778,+ "output_tokens": 0,+ "state_tokens": 436,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_multi_chunk.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_multi_chunk.jsonnew file mode 100644index 00000000..4b2cd74e--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_multi_chunk.json@@ -0,0 +1,176 @@+{+ "name": "long_multi_chunk",+ "state": "The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "batch_size": 2+ },+ "state_tokens": 2037,+ "effective_window": 312,+ "effective_stride": 156,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 312,+ "text": "The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the"+ },+ {+ "token_start": 156,+ "token_end": 468,+ "text": " checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and"+ },+ {+ "token_start": 312,+ "token_end": 624,+ "text": " account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine"+ },+ {+ "token_start": 468,+ "token_end": 780,+ "text": " recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates"+ },+ {+ "token_start": 624,+ "token_end": 936,+ "text": " status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The"+ },+ {+ "token_start": 780,+ "token_end": 1092,+ "text": ". The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked"+ },+ {+ "token_start": 936,+ "token_end": 1248,+ "text": " agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account"+ },+ {+ "token_start": 1092,+ "token_end": 1404,+ "text": " the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded"+ },+ {+ "token_start": 1248,+ "token_end": 1560,+ "text": " and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status"+ },+ {+ "token_start": 1404,+ "token_end": 1716,+ "text": " routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates."+ },+ {+ "token_start": 1560,+ "token_end": 1872,+ "text": " updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent"+ },+ {+ "token_start": 1716,+ "token_end": 2028,+ "text": " The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed"+ },+ {+ "token_start": 1872,+ "token_end": 2037,+ "text": " checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8998,+ "technical": 0.0733,+ "other": 0.0268+ },+ "confidence": 0.6508,+ "answer_confidence": 0.8998,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 12,+ "token_start": 1872,+ "token_end": 2037,+ "count": 13+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.5771,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.588,+ "1": 0.2468,+ "2": 0.1651+ },+ "confidence": 0.1308,+ "answer_confidence": 0.588,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 6,+ "token_start": 936,+ "token_end": 1248,+ "count": 13+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.9029,+ "confidence": 0.9029,+ "answer_confidence": 0.9029,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 12,+ "token_start": 1872,+ "token_end": 2037,+ "count": 13+ }+ }+ },+ "usage": {+ "input_tokens": 12949,+ "output_tokens": 0,+ "state_tokens": 3909,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 13+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_no_state_room.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_no_state_room.jsonnew file mode 100644index 00000000..2c1bf91c--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_no_state_room.json@@ -0,0 +1,315 @@+{+ "name": "long_no_state_room",+ "state": "short",+ "questions": {+ "too_wide": {+ "type": "choice",+ "instructions": "Too many options to fit the sequence.",+ "criteria": {+ "opt_000": "description 0",+ "opt_001": "description 1",+ "opt_002": "description 2",+ "opt_003": "description 3",+ "opt_004": "description 4",+ "opt_005": "description 5",+ "opt_006": "description 6",+ "opt_007": "description 7",+ "opt_008": "description 8",+ "opt_009": "description 9",+ "opt_010": "description 10",+ "opt_011": "description 11",+ "opt_012": "description 12",+ "opt_013": "description 13",+ "opt_014": "description 14",+ "opt_015": "description 15",+ "opt_016": "description 16",+ "opt_017": "description 17",+ "opt_018": "description 18",+ "opt_019": "description 19",+ "opt_020": "description 20",+ "opt_021": "description 21",+ "opt_022": "description 22",+ "opt_023": "description 23",+ "opt_024": "description 24",+ "opt_025": "description 25",+ "opt_026": "description 26",+ "opt_027": "description 27",+ "opt_028": "description 28",+ "opt_029": "description 29",+ "opt_030": "description 30",+ "opt_031": "description 31",+ "opt_032": "description 32",+ "opt_033": "description 33",+ "opt_034": "description 34",+ "opt_035": "description 35",+ "opt_036": "description 36",+ "opt_037": "description 37",+ "opt_038": "description 38",+ "opt_039": "description 39",+ "opt_040": "description 40",+ "opt_041": "description 41",+ "opt_042": "description 42",+ "opt_043": "description 43",+ "opt_044": "description 44",+ "opt_045": "description 45",+ "opt_046": "description 46",+ "opt_047": "description 47",+ "opt_048": "description 48",+ "opt_049": "description 49",+ "opt_050": "description 50",+ "opt_051": "description 51",+ "opt_052": "description 52",+ "opt_053": "description 53",+ "opt_054": "description 54",+ "opt_055": "description 55",+ "opt_056": "description 56",+ "opt_057": "description 57",+ "opt_058": "description 58",+ "opt_059": "description 59",+ "opt_060": "description 60",+ "opt_061": "description 61",+ "opt_062": "description 62",+ "opt_063": "description 63",+ "opt_064": "description 64",+ "opt_065": "description 65",+ "opt_066": "description 66",+ "opt_067": "description 67",+ "opt_068": "description 68",+ "opt_069": "description 69",+ "opt_070": "description 70",+ "opt_071": "description 71",+ "opt_072": "description 72",+ "opt_073": "description 73",+ "opt_074": "description 74",+ "opt_075": "description 75",+ "opt_076": "description 76",+ "opt_077": "description 77",+ "opt_078": "description 78",+ "opt_079": "description 79",+ "opt_080": "description 80",+ "opt_081": "description 81",+ "opt_082": "description 82",+ "opt_083": "description 83",+ "opt_084": "description 84",+ "opt_085": "description 85",+ "opt_086": "description 86",+ "opt_087": "description 87",+ "opt_088": "description 88",+ "opt_089": "description 89",+ "opt_090": "description 90",+ "opt_091": "description 91",+ "opt_092": "description 92",+ "opt_093": "description 93",+ "opt_094": "description 94",+ "opt_095": "description 95",+ "opt_096": "description 96",+ "opt_097": "description 97",+ "opt_098": "description 98",+ "opt_099": "description 99",+ "opt_100": "description 100",+ "opt_101": "description 101",+ "opt_102": "description 102",+ "opt_103": "description 103",+ "opt_104": "description 104",+ "opt_105": "description 105",+ "opt_106": "description 106",+ "opt_107": "description 107",+ "opt_108": "description 108",+ "opt_109": "description 109",+ "opt_110": "description 110",+ "opt_111": "description 111",+ "opt_112": "description 112",+ "opt_113": "description 113",+ "opt_114": "description 114",+ "opt_115": "description 115",+ "opt_116": "description 116",+ "opt_117": "description 117",+ "opt_118": "description 118",+ "opt_119": "description 119",+ "opt_120": "description 120",+ "opt_121": "description 121",+ "opt_122": "description 122",+ "opt_123": "description 123",+ "opt_124": "description 124",+ "opt_125": "description 125",+ "opt_126": "description 126",+ "opt_127": "description 127",+ "opt_128": "description 128",+ "opt_129": "description 129",+ "opt_130": "description 130",+ "opt_131": "description 131",+ "opt_132": "description 132",+ "opt_133": "description 133",+ "opt_134": "description 134",+ "opt_135": "description 135",+ "opt_136": "description 136",+ "opt_137": "description 137",+ "opt_138": "description 138",+ "opt_139": "description 139",+ "opt_140": "description 140",+ "opt_141": "description 141",+ "opt_142": "description 142",+ "opt_143": "description 143",+ "opt_144": "description 144",+ "opt_145": "description 145",+ "opt_146": "description 146",+ "opt_147": "description 147",+ "opt_148": "description 148",+ "opt_149": "description 149",+ "opt_150": "description 150",+ "opt_151": "description 151",+ "opt_152": "description 152",+ "opt_153": "description 153",+ "opt_154": "description 154",+ "opt_155": "description 155",+ "opt_156": "description 156",+ "opt_157": "description 157",+ "opt_158": "description 158",+ "opt_159": "description 159",+ "opt_160": "description 160",+ "opt_161": "description 161",+ "opt_162": "description 162",+ "opt_163": "description 163",+ "opt_164": "description 164",+ "opt_165": "description 165",+ "opt_166": "description 166",+ "opt_167": "description 167",+ "opt_168": "description 168",+ "opt_169": "description 169",+ "opt_170": "description 170",+ "opt_171": "description 171",+ "opt_172": "description 172",+ "opt_173": "description 173",+ "opt_174": "description 174",+ "opt_175": "description 175",+ "opt_176": "description 176",+ "opt_177": "description 177",+ "opt_178": "description 178",+ "opt_179": "description 179",+ "opt_180": "description 180",+ "opt_181": "description 181",+ "opt_182": "description 182",+ "opt_183": "description 183",+ "opt_184": "description 184",+ "opt_185": "description 185",+ "opt_186": "description 186",+ "opt_187": "description 187",+ "opt_188": "description 188",+ "opt_189": "description 189",+ "opt_190": "description 190",+ "opt_191": "description 191",+ "opt_192": "description 192",+ "opt_193": "description 193",+ "opt_194": "description 194",+ "opt_195": "description 195",+ "opt_196": "description 196",+ "opt_197": "description 197",+ "opt_198": "description 198",+ "opt_199": "description 199",+ "opt_200": "description 200",+ "opt_201": "description 201",+ "opt_202": "description 202",+ "opt_203": "description 203",+ "opt_204": "description 204",+ "opt_205": "description 205",+ "opt_206": "description 206",+ "opt_207": "description 207",+ "opt_208": "description 208",+ "opt_209": "description 209",+ "opt_210": "description 210",+ "opt_211": "description 211",+ "opt_212": "description 212",+ "opt_213": "description 213",+ "opt_214": "description 214",+ "opt_215": "description 215",+ "opt_216": "description 216",+ "opt_217": "description 217",+ "opt_218": "description 218",+ "opt_219": "description 219",+ "opt_220": "description 220",+ "opt_221": "description 221",+ "opt_222": "description 222",+ "opt_223": "description 223",+ "opt_224": "description 224",+ "opt_225": "description 225",+ "opt_226": "description 226",+ "opt_227": "description 227",+ "opt_228": "description 228",+ "opt_229": "description 229",+ "opt_230": "description 230",+ "opt_231": "description 231",+ "opt_232": "description 232",+ "opt_233": "description 233",+ "opt_234": "description 234",+ "opt_235": "description 235",+ "opt_236": "description 236",+ "opt_237": "description 237",+ "opt_238": "description 238",+ "opt_239": "description 239",+ "opt_240": "description 240",+ "opt_241": "description 241",+ "opt_242": "description 242",+ "opt_243": "description 243",+ "opt_244": "description 244",+ "opt_245": "description 245",+ "opt_246": "description 246",+ "opt_247": "description 247",+ "opt_248": "description 248",+ "opt_249": "description 249",+ "opt_250": "description 250",+ "opt_251": "description 251",+ "opt_252": "description 252",+ "opt_253": "description 253",+ "opt_254": "description 254",+ "opt_255": "description 255",+ "opt_256": "description 256",+ "opt_257": "description 257",+ "opt_258": "description 258",+ "opt_259": "description 259",+ "opt_260": "description 260",+ "opt_261": "description 261",+ "opt_262": "description 262",+ "opt_263": "description 263",+ "opt_264": "description 264",+ "opt_265": "description 265",+ "opt_266": "description 266",+ "opt_267": "description 267",+ "opt_268": "description 268",+ "opt_269": "description 269",+ "opt_270": "description 270",+ "opt_271": "description 271",+ "opt_272": "description 272",+ "opt_273": "description 273",+ "opt_274": "description 274",+ "opt_275": "description 275",+ "opt_276": "description 276",+ "opt_277": "description 277",+ "opt_278": "description 278",+ "opt_279": "description 279",+ "opt_280": "description 280",+ "opt_281": "description 281",+ "opt_282": "description 282",+ "opt_283": "description 283",+ "opt_284": "description 284",+ "opt_285": "description 285",+ "opt_286": "description 286",+ "opt_287": "description 287",+ "opt_288": "description 288",+ "opt_289": "description 289",+ "opt_290": "description 290",+ "opt_291": "description 291",+ "opt_292": "description 292",+ "opt_293": "description 293",+ "opt_294": "description 294",+ "opt_295": "description 295",+ "opt_296": "description 296",+ "opt_297": "description 297",+ "opt_298": "description 298",+ "opt_299": "description 299"+ }+ }+ },+ "options": {},+ "error_type": "ValueError",+ "error_message": "predict_long: the questions' options fill the whole sequence (max_len=512, head_max_len=192), leaving no room for the state; no window can carry any of it. A label set this large is what laya.shortlist.predict_shortlist is for"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_punctuation.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_punctuation.jsonnew file mode 100644index 00000000..a41c0fd6--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_punctuation.json@@ -0,0 +1,138 @@+{+ "name": "long_punctuation",+ "state": "I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today .",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "stride": 64,+ "batch_size": 3+ },+ "state_tokens": 299,+ "effective_window": 64,+ "effective_stride": 64,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": "I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 256,+ "token_end": 299,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today ."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.9501,+ "technical": 0.023,+ "other": 0.0269+ },+ "confidence": 0.7881,+ "answer_confidence": 0.9501,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.6098,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.1266,+ "1": 0.137,+ "2": 0.7364+ },+ "confidence": 0.3089,+ "answer_confidence": 0.7364,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.9687,+ "confidence": 0.9687,+ "answer_confidence": 0.9687,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1367,+ "output_tokens": 0,+ "state_tokens": 299,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_room_fast_path.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_room_fast_path.jsonnew file mode 100644index 00000000..ce8ad891--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_room_fast_path.json@@ -0,0 +1,90 @@+{+ "name": "long_room_fast_path",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 478,+ "effective_window": 312,+ "effective_stride": 156,+ "effective_room": 478,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.5284,+ "technical": 0.2499,+ "other": 0.2217+ },+ "confidence": 0.0738,+ "answer_confidence": 0.5284,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.8467,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.4008,+ "1": 0.3518,+ "2": 0.2475+ },+ "confidence": 0.0173,+ "answer_confidence": 0.4008,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.1659,+ "confidence": 0.8341,+ "answer_confidence": 0.8341,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 1528,+ "output_tokens": 0,+ "state_tokens": 478,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_short.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_short.jsonnew file mode 100644index 00000000..fcbd242a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_short.json@@ -0,0 +1,90 @@+{+ "name": "long_short",+ "state": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 57,+ "effective_window": 312,+ "effective_stride": 156,+ "effective_room": 478,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8355,+ "technical": 0.1139,+ "other": 0.0506+ },+ "confidence": 0.5008,+ "answer_confidence": 0.8355,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.8578,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0339,+ "1": 0.0745,+ "2": 0.8916+ },+ "confidence": 0.6264,+ "answer_confidence": 0.8916,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.968,+ "confidence": 0.968,+ "answer_confidence": 0.968,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 265,+ "output_tokens": 0,+ "state_tokens": 57,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/case_long_special_tokens.json b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_special_tokens.jsonnew file mode 100644index 00000000..1cae8031--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/english/case_long_special_tokens.json@@ -0,0 +1,177 @@+{+ "name": "long_special_tokens",+ "state": "The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. ",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "batch_size": 2+ },+ "state_tokens": 421,+ "effective_window": 64,+ "effective_stride": 32,+ "effective_room": 478,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": "The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <"+ },+ {+ "token_start": 32,+ "token_end": 96,+ "text": "[CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <e"+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": "bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <"+ },+ {+ "token_start": 96,+ "token_end": 160,+ "text": "os> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and em"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": "mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀"+ },+ {+ "token_start": 160,+ "token_end": 224,+ "text": "ojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀."+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": " 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes "+ },+ {+ "token_start": 224,+ "token_end": 288,+ "text": " The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <"+ },+ {+ "token_start": 256,+ "token_end": 320,+ "text": "[CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <e"+ },+ {+ "token_start": 288,+ "token_end": 352,+ "text": "bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <"+ },+ {+ "token_start": 320,+ "token_end": 384,+ "text": "os> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and em"+ },+ {+ "token_start": 352,+ "token_end": 416,+ "text": "mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀"+ },+ {+ "token_start": 384,+ "token_end": 421,+ "text": "ojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "other",+ "probabilities": {+ "refund": 0.1677,+ "technical": 0.2108,+ "other": 0.6215+ },+ "confidence": 0.1597,+ "answer_confidence": 0.6215,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 96,+ "token_end": 160,+ "count": 13+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.4285,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2439,+ "1": 0.0837,+ "2": 0.6724+ },+ "confidence": 0.2549,+ "answer_confidence": 0.6724,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 12,+ "token_start": 384,+ "token_end": 421,+ "count": 13+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.6175,+ "confidence": 0.6175,+ "answer_confidence": 0.6175,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 96,+ "token_end": 160,+ "count": 13+ }+ }+ },+ "usage": {+ "input_tokens": 3637,+ "output_tokens": 0,+ "state_tokens": 805,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 13+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/index.json b/laya-dotnet/tests/Laya.Tests/golden/english/index.jsonindex 27fdf54e..5c2bf1ce 100644--- a/laya-dotnet/tests/Laya.Tests/golden/english/index.json+++ b/laya-dotnet/tests/Laya.Tests/golden/english/index.json@@ -84,5 +84,83 @@"file": "case_shortlist_many_options.json","expects_error": false,"kind": "shortlist"+ },+ {+ "name": "long_short",+ "file": "case_long_short.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_exact_limit",+ "file": "case_long_exact_limit.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_room_fast_path",+ "file": "case_long_room_fast_path.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_multi_chunk",+ "file": "case_long_multi_chunk.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_punctuation",+ "file": "case_long_punctuation.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_dict",+ "file": "case_long_dict.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_list",+ "file": "case_long_list.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_clamp",+ "file": "case_long_clamp.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_special_tokens",+ "file": "case_long_special_tokens.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_empty_questions",+ "file": "case_long_empty_questions.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_invalid_stride",+ "file": "case_long_invalid_stride.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_invalid_aggregate",+ "file": "case_long_invalid_aggregate.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_no_state_room",+ "file": "case_long_no_state_room.json",+ "expects_error": true,+ "kind": "long"}]diff --git a/laya-dotnet/tests/Laya.Tests/golden/english/meta.json b/laya-dotnet/tests/Laya.Tests/golden/english/meta.jsonindex 0822aa10..e781e7ad 100644--- a/laya-dotnet/tests/Laya.Tests/golden/english/meta.json+++ b/laya-dotnet/tests/Laya.Tests/golden/english/meta.json@@ -1,7 +1,7 @@{"generator": "tools/dump_golden.py","onnx_dir": "english",- "laya_version": "0.3.24",+ "laya_version": "0.4.11","onnxruntime_version": "1.30.0","transformers_version": "5.17.0","config": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_arabic.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_arabic.jsonindex 6a51bd57..a913fbfa 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_arabic.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_arabic.json@@ -523,18 +523,18 @@"marker_axis_padded": false,"logits": [[- 0.3361932039260864,- -1.2505707740783691+ 0.3361915349960327,+ -1.2505687475204468],[- 4.8046722412109375,- 0.1746445894241333+ 4.804673194885254,+ 0.17464512586593628]],"act_logits": [[- 1296.2886962890625,- -1541.61376953125+ 1296.288818359375,+ -1541.6138916015625],[1327.060302734375,diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_choice_criteria_list.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_choice_criteria_list.jsonindex fb868590..ab664900 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_choice_criteria_list.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_choice_criteria_list.json@@ -159,16 +159,16 @@"marker_axis_padded": false,"logits": [[- 5.808926582336426,- -2.2279748916625977,- -2.176790952682495,- -1.2747193574905396+ 5.808925628662109,+ -2.2279703617095947,+ -2.1767940521240234,+ -1.274719476699829]],"act_logits": [[- 1330.54052734375,- -1583.9449462890625+ 1330.540771484375,+ -1583.945068359375]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_cjk.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_cjk.jsonindex ffd5a829..99902366 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_cjk.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_cjk.json@@ -512,24 +512,24 @@"marker_axis_padded": false,"logits": [[- -1.3253834247589111,- -3.7910070419311523,- -3.4514949321746826+ -1.3253850936889648,+ -3.7910094261169434,+ -3.451493501663208],[- -3.4783575534820557,- 1.025787591934204,- -0.4910079836845398+ -3.4783573150634766,+ 1.025788426399231,+ -0.49100732803344727]],"act_logits": [[- 1391.3306884765625,- -1657.8365478515625+ 1391.3314208984375,+ -1657.8375244140625],[1477.1666259765625,- -1744.775634765625+ -1744.7757568359375]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_criterion_shapes.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_criterion_shapes.jsonindex f93493eb..0c06336e 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_criterion_shapes.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_criterion_shapes.json@@ -613,18 +613,18 @@"marker_axis_padded": false,"logits": [[- 3.2422239780426025,- -0.5191840529441833,- -3.4588732719421387,- -2.4333713054656982,- -0.7255609631538391,- -2.5488674640655518,- -1.55216383934021+ 3.2422256469726562,+ -0.5191883444786072,+ -3.4588751792907715,+ -2.4333722591400146,+ -0.7255568504333496,+ -2.5488669872283936,+ -1.5521641969680786],[- -3.1707990169525146,- -3.032681465148926,- -1.6353192329406738,+ -3.170797348022461,+ -3.0326786041259766,+ -1.6353217363357544,-10000.0,-10000.0,-10000.0,@@ -633,12 +633,12 @@],"act_logits": [[- 1270.6849365234375,+ 1270.6845703125,-1515.99755859375],[- 1517.0333251953125,- -1794.2874755859375+ 1517.0338134765625,+ -1794.2879638671875]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_dict_state.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_dict_state.jsonindex 9f1cefa6..475ae16a 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_dict_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_dict_state.json@@ -357,15 +357,15 @@"marker_axis_padded": false,"logits": [[- -4.517766952514648,- -2.0101256370544434,- -1.480738639831543+ -4.517765998840332,+ -2.0101253986358643,+ -1.4807348251342773]],"act_logits": [[- 1479.478271484375,- -1745.6634521484375+ 1479.477783203125,+ -1745.6630859375]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_json_escaping.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_json_escaping.jsonindex faedbc79..6d5d16e4 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_json_escaping.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_json_escaping.json@@ -515,14 +515,14 @@"marker_axis_padded": false,"logits": [[- -2.1366453170776367,- 17.42098617553711+ -2.1366775035858154,+ 17.420978546142578]],"act_logits": [[- 1012.655517578125,- -1208.8387451171875+ 1012.65576171875,+ -1208.8389892578125]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_list_state.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_list_state.jsonindex 0c02cb4e..abca5fcf 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_list_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_list_state.json@@ -317,13 +317,13 @@"marker_axis_padded": false,"logits": [[- 1.2456958293914795,- 0.24434494972229004+ 1.2456920146942139,+ 0.24434435367584229]],"act_logits": [[- 1307.537353515625,+ 1307.5372314453125,-1552.0126953125]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_clamp.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_clamp.jsonnew file mode 100644index 00000000..3e1e643c--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_clamp.json@@ -0,0 +1,94 @@+{+ "name": "long_clamp",+ "state": "Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 4096,+ "stride": 2048,+ "batch_size": 2+ },+ "state_tokens": 856,+ "effective_window": 990,+ "effective_stride": 495,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8343,+ "technical": 0.0249,+ "other": 0.1408+ },+ "confidence": 0.5275,+ "answer_confidence": 0.8343,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.4964,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0886,+ "1": 0.3263,+ "2": 0.585+ },+ "confidence": 0.1864,+ "answer_confidence": 0.585,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 1.0,+ "confidence": 1.0,+ "answer_confidence": 1.0,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 2664,+ "output_tokens": 0,+ "state_tokens": 856,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_dict.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_dict.jsonnew file mode 100644index 00000000..364bf12f--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_dict.json@@ -0,0 +1,129 @@+{+ "name": "long_dict",+ "state": {+ "notes": "Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. ",+ "message": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ },+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96+ },+ "state_tokens": 157,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": " {\"notes\": \"Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\":"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": " Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in."+ },+ {+ "token_start": 96,+ "token_end": 157,+ "text": " \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.7892,+ "technical": 0.0078,+ "other": 0.2029+ },+ "confidence": 0.5008,+ "answer_confidence": 0.7892,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 1,+ "token_start": 48,+ "token_end": 144,+ "count": 3+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.2335,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0218,+ "1": 0.7229,+ "2": 0.2553+ },+ "confidence": 0.3933,+ "answer_confidence": 0.7229,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 157,+ "count": 3+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.0739,+ "confidence": 0.9261,+ "answer_confidence": 0.9261,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 157,+ "count": 3+ }+ }+ },+ "usage": {+ "input_tokens": 1047,+ "output_tokens": 0,+ "state_tokens": 253,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 3+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_empty_questions.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_empty_questions.jsonnew file mode 100644index 00000000..4aa1945a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_empty_questions.json@@ -0,0 +1,54 @@+{+ "name": "long_empty_questions",+ "state": "Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. ",+ "questions": {},+ "options": {+ "window": 32,+ "batch_size": 2+ },+ "state_tokens": 106,+ "effective_window": 32,+ "effective_stride": 16,+ "effective_room": 32,+ "windows": [+ {+ "token_start": 0,+ "token_end": 32,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks"+ },+ {+ "token_start": 16,+ "token_end": 48,+ "text": " checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 32,+ "token_end": 64,+ "text": ". Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine"+ },+ {+ "token_start": 48,+ "token_end": 80,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks"+ },+ {+ "token_start": 64,+ "token_end": 96,+ "text": " checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 80,+ "token_end": 106,+ "text": ". Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {},+ "usage": {+ "input_tokens": 0,+ "output_tokens": 0,+ "windows": 6+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_exact_limit.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_exact_limit.jsonnew file mode 100644index 00000000..b632c882--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_exact_limit.json@@ -0,0 +1,90 @@+{+ "name": "long_exact_limit",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 760,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "technical",+ "probabilities": {+ "refund": 0.0576,+ "technical": 0.9159,+ "other": 0.0265+ },+ "confidence": 0.6895,+ "answer_confidence": 0.9159,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.9952,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2231,+ "1": 0.5585,+ "2": 0.2183+ },+ "confidence": 0.0968,+ "answer_confidence": 0.5585,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.7666,+ "confidence": 0.7666,+ "answer_confidence": 0.7666,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 2376,+ "output_tokens": 0,+ "state_tokens": 760,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_aggregate.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_aggregate.jsonnew file mode 100644index 00000000..1b1a6496--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_aggregate.json@@ -0,0 +1,33 @@+{+ "name": "long_invalid_aggregate",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "aggregate": "mean"+ },+ "error_type": "ValueError",+ "error_message": "predict_long: only aggregate='auto' is supported"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_stride.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_stride.jsonnew file mode 100644index 00000000..d710ad47--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_invalid_stride.json@@ -0,0 +1,34 @@+{+ "name": "long_invalid_stride",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 32,+ "stride": 33+ },+ "error_type": "ValueError",+ "error_message": "predict_long: stride=33 steps past the 32-token window, so 1 tokens between every pair of windows would be read by no window at all; pass stride <= 32"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_list.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_list.jsonnew file mode 100644index 00000000..613541c0--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_list.json@@ -0,0 +1,146 @@+{+ "name": "long_list",+ "state": [+ {+ "role": "assistant",+ "content": "Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. "+ },+ {+ "role": "user",+ "content": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96,+ "stride": 48+ },+ "state_tokens": 243,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": " [{\"role\": \"assistant\", \"content\": \"Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": " the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check"+ },+ {+ "token_start": 96,+ "token_end": 192,+ "text": " the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 88"+ },+ {+ "token_start": 144,+ "token_end": 240,+ "text": " the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the"+ },+ {+ "token_start": 192,+ "token_end": 243,+ "text": "213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}]"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8964,+ "technical": 0.0208,+ "other": 0.0828+ },+ "confidence": 0.6496,+ "answer_confidence": 0.8964,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 192,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.8103,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0112,+ "1": 0.1673,+ "2": 0.8215+ },+ "confidence": 0.5349,+ "answer_confidence": 0.8215,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 144,+ "token_end": 240,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.092,+ "confidence": 0.908,+ "answer_confidence": 0.908,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 192,+ "token_end": 243,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1788,+ "output_tokens": 0,+ "state_tokens": 436,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_multi_chunk.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_multi_chunk.jsonnew file mode 100644index 00000000..854fbc0c--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_multi_chunk.json@@ -0,0 +1,136 @@+{+ "name": "long_multi_chunk",+ "state": "The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "batch_size": 2+ },+ "state_tokens": 2036,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 760,+ "text": " The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The"+ },+ {+ "token_start": 380,+ "token_end": 1140,+ "text": " recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded"+ },+ {+ "token_start": 760,+ "token_end": 1520,+ "text": " agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent"+ },+ {+ "token_start": 1140,+ "token_end": 1900,+ "text": " routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine"+ },+ {+ "token_start": 1520,+ "token_end": 2036,+ "text": " checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\n Hi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "other",+ "probabilities": {+ "refund": 0.0021,+ "technical": 0.0006,+ "other": 0.9973+ },+ "confidence": 0.9819,+ "answer_confidence": 0.9973,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 1140,+ "token_end": 1900,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.4626,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.1332,+ "1": 0.2709,+ "2": 0.5958+ },+ "confidence": 0.1527,+ "answer_confidence": 0.5958,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 760,+ "token_end": 1520,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.2205,+ "confidence": 0.7795,+ "answer_confidence": 0.7795,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 1520,+ "token_end": 2036,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 11148,+ "output_tokens": 0,+ "state_tokens": 3556,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_no_state_room.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_no_state_room.jsonnew file mode 100644index 00000000..feba06c7--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_no_state_room.json@@ -0,0 +1,315 @@+{+ "name": "long_no_state_room",+ "state": "short",+ "questions": {+ "too_wide": {+ "type": "choice",+ "instructions": "Too many options to fit the sequence.",+ "criteria": {+ "opt_000": "description 0",+ "opt_001": "description 1",+ "opt_002": "description 2",+ "opt_003": "description 3",+ "opt_004": "description 4",+ "opt_005": "description 5",+ "opt_006": "description 6",+ "opt_007": "description 7",+ "opt_008": "description 8",+ "opt_009": "description 9",+ "opt_010": "description 10",+ "opt_011": "description 11",+ "opt_012": "description 12",+ "opt_013": "description 13",+ "opt_014": "description 14",+ "opt_015": "description 15",+ "opt_016": "description 16",+ "opt_017": "description 17",+ "opt_018": "description 18",+ "opt_019": "description 19",+ "opt_020": "description 20",+ "opt_021": "description 21",+ "opt_022": "description 22",+ "opt_023": "description 23",+ "opt_024": "description 24",+ "opt_025": "description 25",+ "opt_026": "description 26",+ "opt_027": "description 27",+ "opt_028": "description 28",+ "opt_029": "description 29",+ "opt_030": "description 30",+ "opt_031": "description 31",+ "opt_032": "description 32",+ "opt_033": "description 33",+ "opt_034": "description 34",+ "opt_035": "description 35",+ "opt_036": "description 36",+ "opt_037": "description 37",+ "opt_038": "description 38",+ "opt_039": "description 39",+ "opt_040": "description 40",+ "opt_041": "description 41",+ "opt_042": "description 42",+ "opt_043": "description 43",+ "opt_044": "description 44",+ "opt_045": "description 45",+ "opt_046": "description 46",+ "opt_047": "description 47",+ "opt_048": "description 48",+ "opt_049": "description 49",+ "opt_050": "description 50",+ "opt_051": "description 51",+ "opt_052": "description 52",+ "opt_053": "description 53",+ "opt_054": "description 54",+ "opt_055": "description 55",+ "opt_056": "description 56",+ "opt_057": "description 57",+ "opt_058": "description 58",+ "opt_059": "description 59",+ "opt_060": "description 60",+ "opt_061": "description 61",+ "opt_062": "description 62",+ "opt_063": "description 63",+ "opt_064": "description 64",+ "opt_065": "description 65",+ "opt_066": "description 66",+ "opt_067": "description 67",+ "opt_068": "description 68",+ "opt_069": "description 69",+ "opt_070": "description 70",+ "opt_071": "description 71",+ "opt_072": "description 72",+ "opt_073": "description 73",+ "opt_074": "description 74",+ "opt_075": "description 75",+ "opt_076": "description 76",+ "opt_077": "description 77",+ "opt_078": "description 78",+ "opt_079": "description 79",+ "opt_080": "description 80",+ "opt_081": "description 81",+ "opt_082": "description 82",+ "opt_083": "description 83",+ "opt_084": "description 84",+ "opt_085": "description 85",+ "opt_086": "description 86",+ "opt_087": "description 87",+ "opt_088": "description 88",+ "opt_089": "description 89",+ "opt_090": "description 90",+ "opt_091": "description 91",+ "opt_092": "description 92",+ "opt_093": "description 93",+ "opt_094": "description 94",+ "opt_095": "description 95",+ "opt_096": "description 96",+ "opt_097": "description 97",+ "opt_098": "description 98",+ "opt_099": "description 99",+ "opt_100": "description 100",+ "opt_101": "description 101",+ "opt_102": "description 102",+ "opt_103": "description 103",+ "opt_104": "description 104",+ "opt_105": "description 105",+ "opt_106": "description 106",+ "opt_107": "description 107",+ "opt_108": "description 108",+ "opt_109": "description 109",+ "opt_110": "description 110",+ "opt_111": "description 111",+ "opt_112": "description 112",+ "opt_113": "description 113",+ "opt_114": "description 114",+ "opt_115": "description 115",+ "opt_116": "description 116",+ "opt_117": "description 117",+ "opt_118": "description 118",+ "opt_119": "description 119",+ "opt_120": "description 120",+ "opt_121": "description 121",+ "opt_122": "description 122",+ "opt_123": "description 123",+ "opt_124": "description 124",+ "opt_125": "description 125",+ "opt_126": "description 126",+ "opt_127": "description 127",+ "opt_128": "description 128",+ "opt_129": "description 129",+ "opt_130": "description 130",+ "opt_131": "description 131",+ "opt_132": "description 132",+ "opt_133": "description 133",+ "opt_134": "description 134",+ "opt_135": "description 135",+ "opt_136": "description 136",+ "opt_137": "description 137",+ "opt_138": "description 138",+ "opt_139": "description 139",+ "opt_140": "description 140",+ "opt_141": "description 141",+ "opt_142": "description 142",+ "opt_143": "description 143",+ "opt_144": "description 144",+ "opt_145": "description 145",+ "opt_146": "description 146",+ "opt_147": "description 147",+ "opt_148": "description 148",+ "opt_149": "description 149",+ "opt_150": "description 150",+ "opt_151": "description 151",+ "opt_152": "description 152",+ "opt_153": "description 153",+ "opt_154": "description 154",+ "opt_155": "description 155",+ "opt_156": "description 156",+ "opt_157": "description 157",+ "opt_158": "description 158",+ "opt_159": "description 159",+ "opt_160": "description 160",+ "opt_161": "description 161",+ "opt_162": "description 162",+ "opt_163": "description 163",+ "opt_164": "description 164",+ "opt_165": "description 165",+ "opt_166": "description 166",+ "opt_167": "description 167",+ "opt_168": "description 168",+ "opt_169": "description 169",+ "opt_170": "description 170",+ "opt_171": "description 171",+ "opt_172": "description 172",+ "opt_173": "description 173",+ "opt_174": "description 174",+ "opt_175": "description 175",+ "opt_176": "description 176",+ "opt_177": "description 177",+ "opt_178": "description 178",+ "opt_179": "description 179",+ "opt_180": "description 180",+ "opt_181": "description 181",+ "opt_182": "description 182",+ "opt_183": "description 183",+ "opt_184": "description 184",+ "opt_185": "description 185",+ "opt_186": "description 186",+ "opt_187": "description 187",+ "opt_188": "description 188",+ "opt_189": "description 189",+ "opt_190": "description 190",+ "opt_191": "description 191",+ "opt_192": "description 192",+ "opt_193": "description 193",+ "opt_194": "description 194",+ "opt_195": "description 195",+ "opt_196": "description 196",+ "opt_197": "description 197",+ "opt_198": "description 198",+ "opt_199": "description 199",+ "opt_200": "description 200",+ "opt_201": "description 201",+ "opt_202": "description 202",+ "opt_203": "description 203",+ "opt_204": "description 204",+ "opt_205": "description 205",+ "opt_206": "description 206",+ "opt_207": "description 207",+ "opt_208": "description 208",+ "opt_209": "description 209",+ "opt_210": "description 210",+ "opt_211": "description 211",+ "opt_212": "description 212",+ "opt_213": "description 213",+ "opt_214": "description 214",+ "opt_215": "description 215",+ "opt_216": "description 216",+ "opt_217": "description 217",+ "opt_218": "description 218",+ "opt_219": "description 219",+ "opt_220": "description 220",+ "opt_221": "description 221",+ "opt_222": "description 222",+ "opt_223": "description 223",+ "opt_224": "description 224",+ "opt_225": "description 225",+ "opt_226": "description 226",+ "opt_227": "description 227",+ "opt_228": "description 228",+ "opt_229": "description 229",+ "opt_230": "description 230",+ "opt_231": "description 231",+ "opt_232": "description 232",+ "opt_233": "description 233",+ "opt_234": "description 234",+ "opt_235": "description 235",+ "opt_236": "description 236",+ "opt_237": "description 237",+ "opt_238": "description 238",+ "opt_239": "description 239",+ "opt_240": "description 240",+ "opt_241": "description 241",+ "opt_242": "description 242",+ "opt_243": "description 243",+ "opt_244": "description 244",+ "opt_245": "description 245",+ "opt_246": "description 246",+ "opt_247": "description 247",+ "opt_248": "description 248",+ "opt_249": "description 249",+ "opt_250": "description 250",+ "opt_251": "description 251",+ "opt_252": "description 252",+ "opt_253": "description 253",+ "opt_254": "description 254",+ "opt_255": "description 255",+ "opt_256": "description 256",+ "opt_257": "description 257",+ "opt_258": "description 258",+ "opt_259": "description 259",+ "opt_260": "description 260",+ "opt_261": "description 261",+ "opt_262": "description 262",+ "opt_263": "description 263",+ "opt_264": "description 264",+ "opt_265": "description 265",+ "opt_266": "description 266",+ "opt_267": "description 267",+ "opt_268": "description 268",+ "opt_269": "description 269",+ "opt_270": "description 270",+ "opt_271": "description 271",+ "opt_272": "description 272",+ "opt_273": "description 273",+ "opt_274": "description 274",+ "opt_275": "description 275",+ "opt_276": "description 276",+ "opt_277": "description 277",+ "opt_278": "description 278",+ "opt_279": "description 279",+ "opt_280": "description 280",+ "opt_281": "description 281",+ "opt_282": "description 282",+ "opt_283": "description 283",+ "opt_284": "description 284",+ "opt_285": "description 285",+ "opt_286": "description 286",+ "opt_287": "description 287",+ "opt_288": "description 288",+ "opt_289": "description 289",+ "opt_290": "description 290",+ "opt_291": "description 291",+ "opt_292": "description 292",+ "opt_293": "description 293",+ "opt_294": "description 294",+ "opt_295": "description 295",+ "opt_296": "description 296",+ "opt_297": "description 297",+ "opt_298": "description 298",+ "opt_299": "description 299"+ }+ }+ },+ "options": {},+ "error_type": "ValueError",+ "error_message": "predict_long: the questions' options fill the whole sequence (max_len=1024, head_max_len=256), leaving no room for the state; no window can carry any of it. A label set this large is what laya.shortlist.predict_shortlist is for"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_punctuation.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_punctuation.jsonnew file mode 100644index 00000000..2be95e0e--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_punctuation.json@@ -0,0 +1,138 @@+{+ "name": "long_punctuation",+ "state": "I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today .",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "stride": 64,+ "batch_size": 3+ },+ "state_tokens": 317,+ "effective_window": 64,+ "effective_stride": 64,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n"+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": "'t we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": " this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking ."+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": " We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I"+ },+ {+ "token_start": 256,+ "token_end": 317,+ "text": " 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today ."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.9993,+ "technical": 0.0004,+ "other": 0.0003+ },+ "confidence": 0.994,+ "answer_confidence": 0.9993,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 317,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.8986,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0148,+ "1": 0.0717,+ "2": 0.9135+ },+ "confidence": 0.6959,+ "answer_confidence": 0.9135,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 317,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.3804,+ "confidence": 0.6196,+ "answer_confidence": 0.6196,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 317,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1431,+ "output_tokens": 0,+ "state_tokens": 317,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_room_fast_path.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_room_fast_path.jsonnew file mode 100644index 00000000..ce70fb12--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_room_fast_path.json@@ -0,0 +1,90 @@+{+ "name": "long_room_fast_path",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 990,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "technical",+ "probabilities": {+ "refund": 0.0377,+ "technical": 0.9444,+ "other": 0.018+ },+ "confidence": 0.7726,+ "answer_confidence": 0.9444,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.0401,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2246,+ "1": 0.5108,+ "2": 0.2646+ },+ "confidence": 0.0621,+ "answer_confidence": 0.5108,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.8864,+ "confidence": 0.8864,+ "answer_confidence": 0.8864,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 3066,+ "output_tokens": 0,+ "state_tokens": 990,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_short.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_short.jsonnew file mode 100644index 00000000..d987e17a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_short.json@@ -0,0 +1,90 @@+{+ "name": "long_short",+ "state": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 56,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.836,+ "technical": 0.0114,+ "other": 0.1526+ },+ "confidence": 0.5562,+ "answer_confidence": 0.836,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.3713,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0231,+ "1": 0.5824,+ "2": 0.3945+ },+ "confidence": 0.3001,+ "answer_confidence": 0.5824,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.0414,+ "confidence": 0.9586,+ "answer_confidence": 0.9586,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 264,+ "output_tokens": 0,+ "state_tokens": 56,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_special_tokens.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_special_tokens.jsonnew file mode 100644index 00000000..2bfb8d5a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_special_tokens.json@@ -0,0 +1,162 @@+{+ "name": "long_special_tokens",+ "state": "The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. ",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "batch_size": 2+ },+ "state_tokens": 346,+ "effective_window": 64,+ "effective_stride": 32,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": " The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] "+ },+ {+ "token_start": 32,+ "token_end": 96,+ "text": " <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes ["+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": " and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos>"+ },+ {+ "token_start": 96,+ "token_end": 160,+ "text": "CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": " [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP"+ },+ {+ "token_start": 160,+ "token_end": 224,+ "text": ". The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] "+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": "] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes"+ },+ {+ "token_start": 224,+ "token_end": 288,+ "text": " and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> "+ },+ {+ "token_start": 256,+ "token_end": 320,+ "text": " [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀"+ },+ {+ "token_start": 288,+ "token_end": 346,+ "text": "<eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] and emojis 😀 🚀. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "other",+ "probabilities": {+ "refund": 0.0523,+ "technical": 0.2418,+ "other": 0.7059+ },+ "confidence": 0.3232,+ "answer_confidence": 0.7059,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 6,+ "token_start": 192,+ "token_end": 256,+ "count": 10+ }+ },+ "urgency": {+ "type": "score",+ "score": 0.932,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.1737,+ "1": 0.7206,+ "2": 0.1057+ },+ "confidence": 0.2921,+ "answer_confidence": 0.7206,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 96,+ "token_end": 160,+ "count": 10+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.0034,+ "confidence": 0.9966,+ "answer_confidence": 0.9966,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 5,+ "token_start": 160,+ "token_end": 224,+ "count": 10+ }+ }+ },+ "usage": {+ "input_tokens": 2862,+ "output_tokens": 0,+ "state_tokens": 634,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 10+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_state.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_state.jsonindex d9587269..cbb3e6d0 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_long_state.json@@ -6237,22 +6237,22 @@"marker_axis_padded": false,"logits": [[- -0.18077713251113892,- 4.145590782165527+ -0.18077844381332397,+ 4.145587921142578],[- -2.489722967147827,- -4.332098007202148+ -2.48972487449646,+ -4.332101345062256]],"act_logits": [[- 1173.5223388671875,+ 1173.522216796875,-1400.193603515625],[- 1087.2540283203125,- -1300.8582763671875+ 1087.253662109375,+ -1300.858154296875]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_many_options.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_many_options.jsonindex 965c5a5c..db2424f6 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_many_options.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_many_options.json@@ -1059,51 +1059,51 @@"marker_axis_padded": false,"logits": [[- -1.3844637870788574,- -0.3702296018600464,- -0.2953379154205322,- -0.27147263288497925,- -1.7039079666137695,- -2.3245246410369873,- -1.9655388593673706,- -1.990427017211914,- -2.1103861331939697,- -1.3460218906402588,- -1.866158366203308,- -1.226549744606018,- -1.4565726518630981,- -1.8490114212036133,- -2.6093556880950928,- -2.637212038040161,+ -1.3844640254974365,+ -0.37022775411605835,+ -0.2953376770019531,+ -0.27147334814071655,+ -1.7039093971252441,+ -2.3245255947113037,+ -1.965539574623108,+ -1.9904274940490723,+ -2.110386371612549,+ -1.3460203409194946,+ -1.8661582469940186,+ -1.2265479564666748,+ -1.4565691947937012,+ -1.8490118980407715,+ -2.60935378074646,+ -2.637211322784424,-2.614530324935913,- -2.4503233432769775,- -2.4418349266052246,- -2.0673422813415527,- -1.503393530845642,- -0.7902888059616089,- -0.8891362547874451,- -1.0078449249267578,- -1.6876612901687622,- -1.858831763267517,- -1.9822001457214355,- -1.875482201576233,- -1.9256559610366821,- -1.152733325958252,- -1.6685296297073364,- -1.4456483125686646,- -1.3304994106292725,- -1.5693132877349854,- -2.358699321746826,- -2.4427297115325928,+ -2.4503231048583984,+ -2.441833972930908,+ -2.067340850830078,+ -1.5033921003341675,+ -0.7902883291244507,+ -0.8891361951828003,+ -1.0078444480895996,+ -1.6876617670059204,+ -1.8588327169418335,+ -1.98219895362854,+ -1.875481367111206,+ -1.9256561994552612,+ -1.1527340412139893,+ -1.6685307025909424,+ -1.4456485509872437,+ -1.330500841140747,+ -1.5693142414093018,+ -2.3586995601654053,+ -2.442730188369751,-2.3081207275390625,- -1.8695451021194458,- -1.3365660905838013,- 0.4271225929260254+ -1.869545578956604,+ -1.3365647792816162,+ 0.4271259307861328]],"act_logits": [[- 1270.501953125,+ 1270.5020751953125,-1514.28369140625]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_mask_injection.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_mask_injection.jsonindex f0fe7d5a..dd7cd34f 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_mask_injection.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_mask_injection.json@@ -182,13 +182,13 @@"marker_axis_padded": false,"logits": [[- 0.25578683614730835,- 6.43765926361084+ 0.2557864189147949,+ 6.437662601470947]],"act_logits": [[- 1296.0322265625,+ 1296.0318603515625,-1539.1763916015625]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_nonstring_instructions.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_nonstring_instructions.jsonindex cef51565..0fc1e74f 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_nonstring_instructions.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_nonstring_instructions.json@@ -381,22 +381,22 @@"marker_axis_padded": false,"logits": [[- -0.9075435400009155,- -0.7191635966300964+ -0.9075420498847961,+ -0.7191608548164368],[- -1.4057278633117676,+ -1.4057300090789795,0.24854958057403564]],"act_logits": [[1266.0982666015625,- -1506.8524169921875+ -1506.8525390625],[- 1164.3831787109375,- -1387.8636474609375+ 1164.3819580078125,+ -1387.8626708984375]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_quickstart.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_quickstart.jsonindex d674c82b..f7155b07 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_quickstart.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_quickstart.json@@ -1362,45 +1362,45 @@"logits": [[7.727238655090332,- -4.5556159019470215,- -2.060908794403076,+ -4.555615425109863,+ -2.0609042644500732,-10000.0],[- -3.112750768661499,- 0.14540886878967285,- -0.22580891847610474,- -0.7165496945381165+ -3.1127467155456543,+ 0.14541220664978027,+ -0.22580814361572266,+ -0.7165543437004089],[- 3.0695745944976807,- -0.07253217697143555,+ 3.0695688724517822,+ -0.07253175973892212,-10000.0,-10000.0],[- 1.247995138168335,- -0.26682430505752563,+ 1.247997522354126,+ -0.26682233810424805,-10000.0,-10000.0]],"act_logits": [[- 1252.7357177734375,- -1494.896484375+ 1252.7354736328125,+ -1494.896240234375],[- 1394.9483642578125,- -1645.8038330078125+ 1394.948486328125,+ -1645.8040771484375],[- 1234.0137939453125,- -1468.8489990234375+ 1234.01416015625,+ -1468.8492431640625],[- 1266.3450927734375,- -1504.056640625+ 1266.344970703125,+ -1504.056396484375]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_english.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_english.jsonindex 9ca2e154..3bc0ae65 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_english.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_english.json@@ -1286,26 +1286,26 @@"marker_axis_padded": false,"logits": [[- 15.422260284423828,- -4.568120002746582,- -4.566651344299316,- -4.348117828369141+ 15.42226791381836,+ -4.56812047958374,+ -4.566651821136475,+ -4.348118782043457],[- -3.322251319885254,- 0.3622562885284424,+ -3.3222527503967285,+ 0.3622555732727051,2.582277297973633,-10000.0],[- 1.3057746887207031,- -0.5563302040100098,+ 1.3057777881622314,+ -0.556329607963562,-10000.0,-10000.0],[- -3.2935068607330322,- 0.292530357837677,+ -3.2935073375701904,+ 0.2925301194190979,-10000.0,-10000.0]@@ -1317,15 +1317,15 @@],[1579.6341552734375,- -1867.15625+ -1867.1561279296875],[1175.693115234375,- -1397.9881591796875+ -1397.988037109375],[1106.8782958984375,- -1319.4776611328125+ -1319.477783203125]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_hindi.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_hindi.jsonindex 0ca2f840..a28c1aea 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_hindi.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_sample_app_hindi.json@@ -948,26 +948,26 @@"marker_axis_padded": false,"logits": [[- 4.29817533493042,- -3.6258249282836914,+ 4.298194885253906,+ -3.6258273124694824,-4.5493597984313965,- -3.820557117462158+ -3.8205618858337402],[- -2.450326919555664,- -0.4570348858833313,- 1.0562384128570557,+ -2.450333833694458,+ -0.45703834295272827,+ 1.0562376976013184,-10000.0],[- 2.252955198287964,- -0.012327313423156738,+ 2.2529542446136475,+ -0.012327849864959717,-10000.0,-10000.0],[- -3.191080093383789,- 0.556289553642273,+ -3.1910810470581055,+ 0.5562881231307983,-10000.0,-10000.0]@@ -975,19 +975,19 @@"act_logits": [[1286.3685302734375,- -1537.641845703125+ -1537.6419677734375],[- 1477.1959228515625,- -1743.811279296875+ 1477.1961669921875,+ -1743.8115234375],[- 1388.951416015625,- -1647.3592529296875+ 1388.9515380859375,+ -1647.3594970703125],[- 1218.649658203125,- -1451.647705078125+ 1218.6494140625,+ -1451.6475830078125]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_shortlist_many_options.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_shortlist_many_options.jsonindex 13e2deb0..7e22c01c 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_shortlist_many_options.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_shortlist_many_options.json@@ -999,32 +999,32 @@"marker_axis_padded": false,"logits": [[- 2.7842955589294434,- 0.835179328918457,- -2.3139162063598633,- -4.610975742340088,+ 2.7842917442321777,+ 0.8351801633834839,+ -2.3139195442199707,+ -4.61097526550293,-4.60257625579834,- -4.59871768951416,- -0.6679871678352356,- -4.603085517883301,- -3.6910927295684814,+ -4.598717212677002,+ -0.6679849028587341,+ -4.603085041046143,+ -3.691092014312744,-3.6140689849853516,- 0.8638021349906921,+ 0.8638026714324951,-4.581456184387207,- -4.249812126159668,- -2.9920549392700195,+ -4.249808311462402,+ -2.9920575618743896,-4.548275470733643,- -4.61987829208374,- -0.3889305591583252,- -3.8191657066345215,+ -4.619877338409424,+ -0.3889336585998535,+ -3.8191652297973633,-4.251703262329102,- -4.654714107513428+ -4.654713153839111]],"act_logits": [[- 1326.2877197265625,- -1586.6636962890625+ 1326.2880859375,+ -1586.664306640625]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_single_option.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_single_option.jsonindex 03042a99..438731d6 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_single_option.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/case_single_option.json@@ -125,14 +125,14 @@"marker_axis_padded": true,"logits": [[- -0.9127780199050903,+ -0.9127790331840515,-10000.0]],"act_logits": [[- 1366.2135009765625,- -1624.6650390625+ 1366.21337890625,+ -1624.6649169921875]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/index.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/index.jsonindex 27fdf54e..5c2bf1ce 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/index.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/index.json@@ -84,5 +84,83 @@"file": "case_shortlist_many_options.json","expects_error": false,"kind": "shortlist"+ },+ {+ "name": "long_short",+ "file": "case_long_short.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_exact_limit",+ "file": "case_long_exact_limit.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_room_fast_path",+ "file": "case_long_room_fast_path.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_multi_chunk",+ "file": "case_long_multi_chunk.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_punctuation",+ "file": "case_long_punctuation.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_dict",+ "file": "case_long_dict.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_list",+ "file": "case_long_list.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_clamp",+ "file": "case_long_clamp.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_special_tokens",+ "file": "case_long_special_tokens.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_empty_questions",+ "file": "case_long_empty_questions.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_invalid_stride",+ "file": "case_long_invalid_stride.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_invalid_aggregate",+ "file": "case_long_invalid_aggregate.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_no_state_room",+ "file": "case_long_no_state_room.json",+ "expects_error": true,+ "kind": "long"}]diff --git a/laya-dotnet/tests/Laya.Tests/golden/multilingual/meta.json b/laya-dotnet/tests/Laya.Tests/golden/multilingual/meta.jsonindex 71b7b56a..b52f1a0b 100644--- a/laya-dotnet/tests/Laya.Tests/golden/multilingual/meta.json+++ b/laya-dotnet/tests/Laya.Tests/golden/multilingual/meta.json@@ -1,7 +1,7 @@{"generator": "tools/dump_golden.py","onnx_dir": "multilingual",- "laya_version": "0.3.24",+ "laya_version": "0.4.11","onnxruntime_version": "1.30.0","transformers_version": "5.17.0","config": {@@ -56,12 +56,12 @@},"onnx_self_check": {"single_noul": {- "logits_maxdiff": 5.245208740234375e-06,- "act_maxdiff": 0.0003662109375+ "logits_maxdiff": 3.337860107421875e-06,+ "act_maxdiff": 0.000244140625},"triage_4q": {- "logits_maxdiff": 8.821487426757812e-06,- "act_maxdiff": 0.0006103515625+ "logits_maxdiff": 1.3232231140136719e-05,+ "act_maxdiff": 0.0010986328125}}}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_arabic.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_arabic.jsonindex 23c9c5e3..705a18d2 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_arabic.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_arabic.json@@ -889,12 +889,12 @@"marker_axis_padded": false,"logits": [[- 0.4124017059803009,+ 0.4124016761779785,0.09562945365905762],[- 0.9585608839988708,- -0.012332737445831299+ 0.95856112241745,+ -0.012332618236541748]],"act_logits": [diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_cjk.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_cjk.jsonindex 89ffd561..c6823856 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_cjk.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_cjk.json@@ -853,9 +853,9 @@"marker_axis_padded": false,"logits": [[- 1.2237383127212524,- 0.408316433429718,- 0.30611613392829895+ 1.223738193511963,+ 0.4083164930343628,+ 0.3061161935329437],[-2.5716042518615723,@@ -869,7 +869,7 @@-3939.86865234375],[- 3960.244873046875,+ 3960.2451171875,-3243.89111328125]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_criterion_shapes.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_criterion_shapes.jsonindex abbe11d9..0264f8a6 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_criterion_shapes.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_criterion_shapes.json@@ -610,12 +610,12 @@"logits": [[2.062333106994629,- 0.24727195501327515,+ 0.24727189540863037,-1.662116289138794,-1.5677821636199951,-1.513063907623291,- -1.319779634475708,- -0.44945579767227173+ -1.3197797536849976,+ -0.4494558572769165],[-0.012083202600479126,diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_dict_state.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_dict_state.jsonindex 7a697c46..22786113 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_dict_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_dict_state.json@@ -357,9 +357,9 @@"marker_axis_padded": false,"logits": [[- -0.07843291759490967,+ -0.07843288779258728,1.3633489608764648,- 1.0982259511947632+ 1.0982258319854736]],"act_logits": [diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_list_state.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_list_state.jsonindex 6d2789a7..d056c866 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_list_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_list_state.json@@ -321,12 +321,12 @@"logits": [[2.002666711807251,- -0.3821010887622833+ -0.3821011185646057]],"act_logits": [[- 4920.5048828125,+ 4920.50439453125,-4016.302734375]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_clamp.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_clamp.jsonnew file mode 100644index 00000000..8b060c62--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_clamp.json@@ -0,0 +1,94 @@+{+ "name": "long_clamp",+ "state": "Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Normal account activity. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 4096,+ "stride": 2048,+ "batch_size": 2+ },+ "state_tokens": 857,+ "effective_window": 990,+ "effective_stride": 495,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8479,+ "technical": 0.0837,+ "other": 0.0685+ },+ "confidence": 0.5166,+ "answer_confidence": 0.8479,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.6689,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0372,+ "1": 0.2567,+ "2": 0.7061+ },+ "confidence": 0.3471,+ "answer_confidence": 0.7061,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.8296,+ "confidence": 0.8296,+ "answer_confidence": 0.8296,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 2665,+ "output_tokens": 0,+ "state_tokens": 857,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_dict.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_dict.jsonnew file mode 100644index 00000000..012b9e5a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_dict.json@@ -0,0 +1,129 @@+{+ "name": "long_dict",+ "state": {+ "notes": "Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. ",+ "message": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ },+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96+ },+ "state_tokens": 179,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": "{\"notes\": \"Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": ". Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan"+ },+ {+ "token_start": 96,+ "token_end": 179,+ "text": " checks completed. Routine checks completed. Routine checks completed. Routine checks completed. \", \"message\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8143,+ "technical": 0.1062,+ "other": 0.0794+ },+ "confidence": 0.4478,+ "answer_confidence": 0.8143,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 179,+ "count": 3+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.6601,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.029,+ "1": 0.2819,+ "2": 0.6891+ },+ "confidence": 0.348,+ "answer_confidence": 0.6891,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 179,+ "count": 3+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.801,+ "confidence": 0.801,+ "answer_confidence": 0.801,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 2,+ "token_start": 96,+ "token_end": 179,+ "count": 3+ }+ }+ },+ "usage": {+ "input_tokens": 1107,+ "output_tokens": 0,+ "state_tokens": 275,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 3+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_empty_questions.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_empty_questions.jsonnew file mode 100644index 00000000..34e42d25--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_empty_questions.json@@ -0,0 +1,64 @@+{+ "name": "long_empty_questions",+ "state": "Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. ",+ "questions": {},+ "options": {+ "window": 32,+ "batch_size": 2+ },+ "state_tokens": 141,+ "effective_window": 32,+ "effective_stride": 16,+ "effective_room": 32,+ "windows": [+ {+ "token_start": 0,+ "token_end": 32,+ "text": "Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 16,+ "token_end": 48,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 32,+ "token_end": 64,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 48,+ "token_end": 80,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 64,+ "token_end": 96,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 80,+ "token_end": 112,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 96,+ "token_end": 128,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks."+ },+ {+ "token_start": 112,+ "token_end": 141,+ "text": " Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. Routine checks. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {},+ "usage": {+ "input_tokens": 0,+ "output_tokens": 0,+ "windows": 8+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_exact_limit.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_exact_limit.jsonnew file mode 100644index 00000000..3583fcb8--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_exact_limit.json@@ -0,0 +1,90 @@+{+ "name": "long_exact_limit",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 760,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "other",+ "probabilities": {+ "refund": 0.2296,+ "technical": 0.3781,+ "other": 0.3923+ },+ "confidence": 0.0236,+ "answer_confidence": 0.3923,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.1188,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2602,+ "1": 0.3608,+ "2": 0.379+ },+ "confidence": 0.0116,+ "answer_confidence": 0.379,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.2368,+ "confidence": 0.7632,+ "answer_confidence": 0.7632,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 2374,+ "output_tokens": 0,+ "state_tokens": 760,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_aggregate.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_aggregate.jsonnew file mode 100644index 00000000..1b1a6496--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_aggregate.json@@ -0,0 +1,33 @@+{+ "name": "long_invalid_aggregate",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "aggregate": "mean"+ },+ "error_type": "ValueError",+ "error_message": "predict_long: only aggregate='auto' is supported"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_stride.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_stride.jsonnew file mode 100644index 00000000..d710ad47--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_invalid_stride.json@@ -0,0 +1,34 @@+{+ "name": "long_invalid_stride",+ "state": "short",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 32,+ "stride": 33+ },+ "error_type": "ValueError",+ "error_message": "predict_long: stride=33 steps past the 32-token window, so 1 tokens between every pair of windows would be read by no window at all; pass stride <= 32"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_list.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_list.jsonnew file mode 100644index 00000000..acbb6566--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_list.json@@ -0,0 +1,146 @@+{+ "name": "long_list",+ "state": [+ {+ "role": "assistant",+ "content": "Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. "+ },+ {+ "role": "user",+ "content": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 96,+ "stride": 48+ },+ "state_tokens": 244,+ "effective_window": 96,+ "effective_stride": 48,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 96,+ "text": "[{\"role\": \"assistant\", \"content\": \"Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we"+ },+ {+ "token_start": 48,+ "token_end": 144,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we"+ },+ {+ "token_start": 96,+ "token_end": 192,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 882"+ },+ {+ "token_start": 144,+ "token_end": 240,+ "text": " check the account. Please wait while we check the account. Please wait while we check the account. Please wait while we check the account. \"}, {\"role\": \"user\", \"content\": \"Subject: Double charged on invoice 88213\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling"+ },+ {+ "token_start": 192,+ "token_end": 244,+ "text": "13\\n\\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.\"}]"+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8269,+ "technical": 0.0938,+ "other": 0.0793+ },+ "confidence": 0.4719,+ "answer_confidence": 0.8269,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 144,+ "token_end": 240,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.7764,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0266,+ "1": 0.1705,+ "2": 0.803+ },+ "confidence": 0.4773,+ "answer_confidence": 0.803,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 192,+ "token_end": 244,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.8002,+ "confidence": 0.8002,+ "answer_confidence": 0.8002,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 192,+ "token_end": 244,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1778,+ "output_tokens": 0,+ "state_tokens": 436,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_multi_chunk.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_multi_chunk.jsonnew file mode 100644index 00000000..4eaa2bc1--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_multi_chunk.json@@ -0,0 +1,136 @@+{+ "name": "long_multi_chunk",+ "state": "The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "batch_size": 2+ },+ "state_tokens": 2037,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 760,+ "text": "The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The"+ },+ {+ "token_start": 380,+ "token_end": 1140,+ "text": " recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded"+ },+ {+ "token_start": 760,+ "token_end": 1520,+ "text": " agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent"+ },+ {+ "token_start": 1140,+ "token_end": 1900,+ "text": " routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine"+ },+ {+ "token_start": 1520,+ "token_end": 2037,+ "text": " checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. The agent checked the account and recorded routine status updates. Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.8698,+ "technical": 0.0699,+ "other": 0.0603+ },+ "confidence": 0.5662,+ "answer_confidence": 0.8698,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 1520,+ "token_end": 2037,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.7495,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0314,+ "1": 0.1876,+ "2": 0.7809+ },+ "confidence": 0.4395,+ "answer_confidence": 0.7809,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 1520,+ "token_end": 2037,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.7882,+ "confidence": 0.7882,+ "answer_confidence": 0.7882,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 1520,+ "token_end": 2037,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 11141,+ "output_tokens": 0,+ "state_tokens": 3557,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_no_state_room.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_no_state_room.jsonnew file mode 100644index 00000000..feba06c7--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_no_state_room.json@@ -0,0 +1,315 @@+{+ "name": "long_no_state_room",+ "state": "short",+ "questions": {+ "too_wide": {+ "type": "choice",+ "instructions": "Too many options to fit the sequence.",+ "criteria": {+ "opt_000": "description 0",+ "opt_001": "description 1",+ "opt_002": "description 2",+ "opt_003": "description 3",+ "opt_004": "description 4",+ "opt_005": "description 5",+ "opt_006": "description 6",+ "opt_007": "description 7",+ "opt_008": "description 8",+ "opt_009": "description 9",+ "opt_010": "description 10",+ "opt_011": "description 11",+ "opt_012": "description 12",+ "opt_013": "description 13",+ "opt_014": "description 14",+ "opt_015": "description 15",+ "opt_016": "description 16",+ "opt_017": "description 17",+ "opt_018": "description 18",+ "opt_019": "description 19",+ "opt_020": "description 20",+ "opt_021": "description 21",+ "opt_022": "description 22",+ "opt_023": "description 23",+ "opt_024": "description 24",+ "opt_025": "description 25",+ "opt_026": "description 26",+ "opt_027": "description 27",+ "opt_028": "description 28",+ "opt_029": "description 29",+ "opt_030": "description 30",+ "opt_031": "description 31",+ "opt_032": "description 32",+ "opt_033": "description 33",+ "opt_034": "description 34",+ "opt_035": "description 35",+ "opt_036": "description 36",+ "opt_037": "description 37",+ "opt_038": "description 38",+ "opt_039": "description 39",+ "opt_040": "description 40",+ "opt_041": "description 41",+ "opt_042": "description 42",+ "opt_043": "description 43",+ "opt_044": "description 44",+ "opt_045": "description 45",+ "opt_046": "description 46",+ "opt_047": "description 47",+ "opt_048": "description 48",+ "opt_049": "description 49",+ "opt_050": "description 50",+ "opt_051": "description 51",+ "opt_052": "description 52",+ "opt_053": "description 53",+ "opt_054": "description 54",+ "opt_055": "description 55",+ "opt_056": "description 56",+ "opt_057": "description 57",+ "opt_058": "description 58",+ "opt_059": "description 59",+ "opt_060": "description 60",+ "opt_061": "description 61",+ "opt_062": "description 62",+ "opt_063": "description 63",+ "opt_064": "description 64",+ "opt_065": "description 65",+ "opt_066": "description 66",+ "opt_067": "description 67",+ "opt_068": "description 68",+ "opt_069": "description 69",+ "opt_070": "description 70",+ "opt_071": "description 71",+ "opt_072": "description 72",+ "opt_073": "description 73",+ "opt_074": "description 74",+ "opt_075": "description 75",+ "opt_076": "description 76",+ "opt_077": "description 77",+ "opt_078": "description 78",+ "opt_079": "description 79",+ "opt_080": "description 80",+ "opt_081": "description 81",+ "opt_082": "description 82",+ "opt_083": "description 83",+ "opt_084": "description 84",+ "opt_085": "description 85",+ "opt_086": "description 86",+ "opt_087": "description 87",+ "opt_088": "description 88",+ "opt_089": "description 89",+ "opt_090": "description 90",+ "opt_091": "description 91",+ "opt_092": "description 92",+ "opt_093": "description 93",+ "opt_094": "description 94",+ "opt_095": "description 95",+ "opt_096": "description 96",+ "opt_097": "description 97",+ "opt_098": "description 98",+ "opt_099": "description 99",+ "opt_100": "description 100",+ "opt_101": "description 101",+ "opt_102": "description 102",+ "opt_103": "description 103",+ "opt_104": "description 104",+ "opt_105": "description 105",+ "opt_106": "description 106",+ "opt_107": "description 107",+ "opt_108": "description 108",+ "opt_109": "description 109",+ "opt_110": "description 110",+ "opt_111": "description 111",+ "opt_112": "description 112",+ "opt_113": "description 113",+ "opt_114": "description 114",+ "opt_115": "description 115",+ "opt_116": "description 116",+ "opt_117": "description 117",+ "opt_118": "description 118",+ "opt_119": "description 119",+ "opt_120": "description 120",+ "opt_121": "description 121",+ "opt_122": "description 122",+ "opt_123": "description 123",+ "opt_124": "description 124",+ "opt_125": "description 125",+ "opt_126": "description 126",+ "opt_127": "description 127",+ "opt_128": "description 128",+ "opt_129": "description 129",+ "opt_130": "description 130",+ "opt_131": "description 131",+ "opt_132": "description 132",+ "opt_133": "description 133",+ "opt_134": "description 134",+ "opt_135": "description 135",+ "opt_136": "description 136",+ "opt_137": "description 137",+ "opt_138": "description 138",+ "opt_139": "description 139",+ "opt_140": "description 140",+ "opt_141": "description 141",+ "opt_142": "description 142",+ "opt_143": "description 143",+ "opt_144": "description 144",+ "opt_145": "description 145",+ "opt_146": "description 146",+ "opt_147": "description 147",+ "opt_148": "description 148",+ "opt_149": "description 149",+ "opt_150": "description 150",+ "opt_151": "description 151",+ "opt_152": "description 152",+ "opt_153": "description 153",+ "opt_154": "description 154",+ "opt_155": "description 155",+ "opt_156": "description 156",+ "opt_157": "description 157",+ "opt_158": "description 158",+ "opt_159": "description 159",+ "opt_160": "description 160",+ "opt_161": "description 161",+ "opt_162": "description 162",+ "opt_163": "description 163",+ "opt_164": "description 164",+ "opt_165": "description 165",+ "opt_166": "description 166",+ "opt_167": "description 167",+ "opt_168": "description 168",+ "opt_169": "description 169",+ "opt_170": "description 170",+ "opt_171": "description 171",+ "opt_172": "description 172",+ "opt_173": "description 173",+ "opt_174": "description 174",+ "opt_175": "description 175",+ "opt_176": "description 176",+ "opt_177": "description 177",+ "opt_178": "description 178",+ "opt_179": "description 179",+ "opt_180": "description 180",+ "opt_181": "description 181",+ "opt_182": "description 182",+ "opt_183": "description 183",+ "opt_184": "description 184",+ "opt_185": "description 185",+ "opt_186": "description 186",+ "opt_187": "description 187",+ "opt_188": "description 188",+ "opt_189": "description 189",+ "opt_190": "description 190",+ "opt_191": "description 191",+ "opt_192": "description 192",+ "opt_193": "description 193",+ "opt_194": "description 194",+ "opt_195": "description 195",+ "opt_196": "description 196",+ "opt_197": "description 197",+ "opt_198": "description 198",+ "opt_199": "description 199",+ "opt_200": "description 200",+ "opt_201": "description 201",+ "opt_202": "description 202",+ "opt_203": "description 203",+ "opt_204": "description 204",+ "opt_205": "description 205",+ "opt_206": "description 206",+ "opt_207": "description 207",+ "opt_208": "description 208",+ "opt_209": "description 209",+ "opt_210": "description 210",+ "opt_211": "description 211",+ "opt_212": "description 212",+ "opt_213": "description 213",+ "opt_214": "description 214",+ "opt_215": "description 215",+ "opt_216": "description 216",+ "opt_217": "description 217",+ "opt_218": "description 218",+ "opt_219": "description 219",+ "opt_220": "description 220",+ "opt_221": "description 221",+ "opt_222": "description 222",+ "opt_223": "description 223",+ "opt_224": "description 224",+ "opt_225": "description 225",+ "opt_226": "description 226",+ "opt_227": "description 227",+ "opt_228": "description 228",+ "opt_229": "description 229",+ "opt_230": "description 230",+ "opt_231": "description 231",+ "opt_232": "description 232",+ "opt_233": "description 233",+ "opt_234": "description 234",+ "opt_235": "description 235",+ "opt_236": "description 236",+ "opt_237": "description 237",+ "opt_238": "description 238",+ "opt_239": "description 239",+ "opt_240": "description 240",+ "opt_241": "description 241",+ "opt_242": "description 242",+ "opt_243": "description 243",+ "opt_244": "description 244",+ "opt_245": "description 245",+ "opt_246": "description 246",+ "opt_247": "description 247",+ "opt_248": "description 248",+ "opt_249": "description 249",+ "opt_250": "description 250",+ "opt_251": "description 251",+ "opt_252": "description 252",+ "opt_253": "description 253",+ "opt_254": "description 254",+ "opt_255": "description 255",+ "opt_256": "description 256",+ "opt_257": "description 257",+ "opt_258": "description 258",+ "opt_259": "description 259",+ "opt_260": "description 260",+ "opt_261": "description 261",+ "opt_262": "description 262",+ "opt_263": "description 263",+ "opt_264": "description 264",+ "opt_265": "description 265",+ "opt_266": "description 266",+ "opt_267": "description 267",+ "opt_268": "description 268",+ "opt_269": "description 269",+ "opt_270": "description 270",+ "opt_271": "description 271",+ "opt_272": "description 272",+ "opt_273": "description 273",+ "opt_274": "description 274",+ "opt_275": "description 275",+ "opt_276": "description 276",+ "opt_277": "description 277",+ "opt_278": "description 278",+ "opt_279": "description 279",+ "opt_280": "description 280",+ "opt_281": "description 281",+ "opt_282": "description 282",+ "opt_283": "description 283",+ "opt_284": "description 284",+ "opt_285": "description 285",+ "opt_286": "description 286",+ "opt_287": "description 287",+ "opt_288": "description 288",+ "opt_289": "description 289",+ "opt_290": "description 290",+ "opt_291": "description 291",+ "opt_292": "description 292",+ "opt_293": "description 293",+ "opt_294": "description 294",+ "opt_295": "description 295",+ "opt_296": "description 296",+ "opt_297": "description 297",+ "opt_298": "description 298",+ "opt_299": "description 299"+ }+ }+ },+ "options": {},+ "error_type": "ValueError",+ "error_message": "predict_long: the questions' options fill the whole sequence (max_len=1024, head_max_len=256), leaving no room for the state; no window can carry any of it. A label set this large is what laya.shortlist.predict_shortlist is for"+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_punctuation.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_punctuation.jsonnew file mode 100644index 00000000..3bd38b9a--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_punctuation.json@@ -0,0 +1,138 @@+{+ "name": "long_punctuation",+ "state": "I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today .",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "stride": 64,+ "batch_size": 3+ },+ "state_tokens": 299,+ "effective_window": 64,+ "effective_stride": 64,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": "I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ?"+ },+ {+ "token_start": 256,+ "token_end": 299,+ "text": " I 'm checking . We 've seen this , have n't we ? I 'm checking . We 've seen this , have n't we ? I want a refund ! I 'll cancel today ."+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.817,+ "technical": 0.082,+ "other": 0.101+ },+ "confidence": 0.4523,+ "answer_confidence": 0.817,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.7239,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0515,+ "1": 0.173,+ "2": 0.7755+ },+ "confidence": 0.4051,+ "answer_confidence": 0.7755,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.785,+ "confidence": 0.785,+ "answer_confidence": 0.785,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 4,+ "token_start": 256,+ "token_end": 299,+ "count": 5+ }+ }+ },+ "usage": {+ "input_tokens": 1367,+ "output_tokens": 0,+ "state_tokens": 299,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 5+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_room_fast_path.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_room_fast_path.jsonnew file mode 100644index 00000000..284268f2--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_room_fast_path.json@@ -0,0 +1,90 @@+{+ "name": "long_room_fast_path",+ "state": "a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 990,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "technical",+ "probabilities": {+ "refund": 0.2548,+ "technical": 0.3772,+ "other": 0.368+ },+ "confidence": 0.0133,+ "answer_confidence": 0.3772,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.0802,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2808,+ "1": 0.3582,+ "2": 0.361+ },+ "confidence": 0.0058,+ "answer_confidence": 0.361,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.2487,+ "confidence": 0.7513,+ "answer_confidence": 0.7513,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 3064,+ "output_tokens": 0,+ "state_tokens": 990,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_short.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_short.jsonnew file mode 100644index 00000000..da0ce3a8--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_short.json@@ -0,0 +1,90 @@+{+ "name": "long_short",+ "state": "Subject: Double charged on invoice 88213\n\nHi, I was billed twice this month for the Pro plan and the second charge has not been refunded. This is the third time I have written in. If it is not fixed today I am cancelling the account.",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {},+ "state_tokens": 57,+ "effective_window": 760,+ "effective_stride": 380,+ "effective_room": 990,+ "windows": [],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "refund",+ "probabilities": {+ "refund": 0.7054,+ "technical": 0.1834,+ "other": 0.1111+ },+ "confidence": 0.2705,+ "answer_confidence": 0.7054,+ "action": {+ "act_probability": 1.0+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.8371,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.0193,+ "1": 0.1243,+ "2": 0.8564+ },+ "confidence": 0.574,+ "answer_confidence": 0.8564,+ "action": {+ "act_probability": 1.0+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.7914,+ "confidence": 0.7914,+ "answer_confidence": 0.7914,+ "action": {+ "act_probability": 1.0+ }+ }+ },+ "usage": {+ "input_tokens": 265,+ "output_tokens": 0,+ "state_tokens": 57,+ "state_tokens_dropped": 0,+ "truncated": false,+ "truncated_questions": [],+ "windows": 1+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_special_tokens.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_special_tokens.jsonnew file mode 100644index 00000000..e4c27745--- /dev/null+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_special_tokens.json@@ -0,0 +1,177 @@+{+ "name": "long_special_tokens",+ "state": "The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. ",+ "questions": {+ "topic": {+ "type": "choice",+ "instructions": "What is the request about?",+ "criteria": {+ "refund": "money back, duplicate charge",+ "technical": "bugs and outages",+ "other": null+ }+ },+ "urgency": {+ "type": "score",+ "instructions": "How urgent is this request?",+ "criteria": [+ "not urgent",+ "this week",+ "today"+ ]+ },+ "cancel": {+ "type": "noul",+ "instructions": "The customer threatens to cancel the account."+ }+ },+ "options": {+ "window": 64,+ "batch_size": 2+ },+ "state_tokens": 421,+ "effective_window": 64,+ "effective_stride": 32,+ "effective_room": 990,+ "windows": [+ {+ "token_start": 0,+ "token_end": 64,+ "text": "The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <"+ },+ {+ "token_start": 32,+ "token_end": 96,+ "text": "[CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <e"+ },+ {+ "token_start": 64,+ "token_end": 128,+ "text": "bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <"+ },+ {+ "token_start": 96,+ "token_end": 160,+ "text": "os> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and em"+ },+ {+ "token_start": 128,+ "token_end": 192,+ "text": "mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀"+ },+ {+ "token_start": 160,+ "token_end": 224,+ "text": "ojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀."+ },+ {+ "token_start": 192,+ "token_end": 256,+ "text": " 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes "+ },+ {+ "token_start": 224,+ "token_end": 288,+ "text": " The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <"+ },+ {+ "token_start": 256,+ "token_end": 320,+ "text": "[CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <e"+ },+ {+ "token_start": 288,+ "token_end": 352,+ "text": "bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <"+ },+ {+ "token_start": 320,+ "token_end": 384,+ "text": "os> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and em"+ },+ {+ "token_start": 352,+ "token_end": 416,+ "text": "mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀"+ },+ {+ "token_start": 384,+ "token_end": 421,+ "text": "ojis 😀 🚀. The text includes [CLS] [SEP] <bos> <eos> <mask> and emojis 😀 🚀. "+ }+ ],+ "result": {+ "model": "laya-rl-agent-onnx",+ "answers": {+ "topic": {+ "type": "choice",+ "choice": "other",+ "probabilities": {+ "refund": 0.0893,+ "technical": 0.259,+ "other": 0.6516+ },+ "confidence": 0.231,+ "answer_confidence": 0.6516,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 3,+ "token_start": 96,+ "token_end": 160,+ "count": 13+ }+ },+ "urgency": {+ "type": "score",+ "score": 1.3344,+ "legend": {+ "0": "not urgent",+ "1": "this week",+ "2": "today"+ },+ "probabilities": {+ "0": 0.2168,+ "1": 0.2319,+ "2": 0.5512+ },+ "confidence": 0.091,+ "answer_confidence": 0.5512,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 12,+ "token_start": 384,+ "token_end": 421,+ "count": 13+ }+ },+ "cancel": {+ "type": "noul",+ "noul": 0.2017,+ "confidence": 0.7983,+ "answer_confidence": 0.7983,+ "action": {+ "act_probability": 1.0+ },+ "window": {+ "index": 12,+ "token_start": 384,+ "token_end": 421,+ "count": 13+ }+ }+ },+ "usage": {+ "input_tokens": 3637,+ "output_tokens": 0,+ "state_tokens": 805,+ "state_tokens_dropped": 0,+ "truncated": 0,+ "truncated_questions": [],+ "windows": 13+ }+ }+}diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_state.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_state.jsonindex 5a9a9a61..624855d0 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_state.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_long_state.json@@ -6238,7 +6238,7 @@"logits": [[1.9772350788116455,- -0.25270819664001465+ -0.25270816683769226],[0.011878401041030884,diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_many_options.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_many_options.jsonindex 6bc5024e..64aaeeb2 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_many_options.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_many_options.json@@ -1065,46 +1065,46 @@"marker_axis_padded": false,"logits": [[- 0.5144236087799072,- 0.34069469571113586,+ 0.5144237279891968,+ 0.34069475531578064,0.3221031427383423,- 0.17725032567977905,- 0.10183802247047424,+ 0.17725029587745667,+ 0.10183805227279663,0.25006332993507385,0.19678166508674622,- 0.10084766149520874,- 0.2583611309528351,- 0.2658017873764038,- 0.39381715655326843,+ 0.1008477509021759,+ 0.25836125016212463,+ 0.2658017575740814,+ 0.39381712675094604,0.20233997702598572,0.020099788904190063,- 0.07363346219062805,- -0.02278640866279602,- -0.17907613515853882,- -0.17688599228858948,- -0.036870479583740234,+ 0.07363343238830566,+ -0.022786349058151245,+ -0.1790761649608612,+ -0.17688605189323425,+ -0.03687050938606262,-0.01895928382873535,- 0.1375594437122345,+ 0.13755956292152405,0.15170282125473022,- -0.15126603841781616,- -0.37737107276916504,- -0.21056896448135376,+ -0.15126609802246094,+ -0.37737104296684265,+ -0.2105688452720642,-0.18938809633255005,- -0.13098987936973572,+ -0.13098981976509094,-0.0960497260093689,- 0.009582728147506714,+ 0.009582698345184326,0.10648441314697266,- 0.12361237406730652,- -0.013582974672317505,- 0.019405245780944824,- -0.2615450322628021,- -0.07609763741493225,- -0.0788978636264801,+ 0.12361249327659607,+ -0.013583093881607056,+ 0.019405215978622437,+ -0.2615450620651245,+ -0.07609766721725464,+ -0.07889795303344727,-0.21638256311416626,-0.10915178060531616,- -0.05439230799674988,- 0.03386649489402771,- -0.3493933081626892+ -0.05439227819442749,+ 0.03386658430099487,+ -0.3493933379650116]],"act_logits": [diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_mask_injection.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_mask_injection.jsonindex 6e2a87a8..d181b611 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_mask_injection.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_mask_injection.json@@ -204,13 +204,13 @@"logits": [[0.7911447882652283,- -0.21168416738510132+ -0.21168413758277893]],"act_logits": [[4881.5341796875,- -3982.474609375+ -3982.47509765625]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_nonstring_instructions.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_nonstring_instructions.jsonindex a13d2823..ea4bd64d 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_nonstring_instructions.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_nonstring_instructions.json@@ -421,12 +421,12 @@"marker_axis_padded": false,"logits": [[- 0.7489709258079529,+ 0.7489709854125977,0.33357158303260803],[1.0393319129943848,- -0.3546997606754303+ -0.3546997010707855]],"act_logits": [@@ -436,7 +436,7 @@],[4882.25927734375,- -3996.43505859375+ -3996.4345703125]],"result": {diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_quickstart.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_quickstart.jsonindex f4d49024..b8b3403b 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_quickstart.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_quickstart.json@@ -1403,9 +1403,9 @@-10000.0],[- -2.449965476989746,- 0.27642229199409485,- 2.564621686935425,+ -2.449965715408325,+ 0.2764223515987396,+ 2.5646214485168457,1.5527721643447876],[@@ -1415,7 +1415,7 @@-10000.0],[- -1.2292494773864746,+ -1.2292495965957642,0.15064242482185364,-10000.0,-10000.0diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_english.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_english.jsonindex aee44581..5de10f1f 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_english.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_english.json@@ -1316,7 +1316,7 @@-2.143510341644287],[- -1.3115590810775757,+ -1.3115592002868652,0.9793980121612549,2.117581367492676,-10000.0@@ -1328,7 +1328,7 @@-10000.0],[- -1.2392635345458984,+ -1.239263653755188,0.14693397283554077,-10000.0,-10000.0@@ -1337,11 +1337,11 @@"act_logits": [[4803.14453125,- -3924.28955078125+ -3924.2890625],[- 4621.31689453125,- -3778.1796875+ 4621.31640625,+ -3778.17919921875],[4875.13427734375,diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_hindi.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_hindi.jsonindex 4c052f0b..d5b7cb02 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_hindi.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_sample_app_hindi.json@@ -1358,18 +1358,18 @@[-0.5805244445800781,-0.31233158707618713,- -0.9875006675720215,+ -0.9875007271766663,0.421606183052063],[0.8618424534797668,- 1.6211997270584106,- 0.3419472873210907,+ 1.6211999654769897,+ 0.3419472575187683,-10000.0],[2.76562762260437,- -0.4687272012233734,+ -0.468727171421051,-10000.0,-10000.0],@@ -1382,8 +1382,8 @@],"act_logits": [[- 4708.5419921875,- -3841.3037109375+ 4708.54248046875,+ -3841.30322265625],[4602.10791015625,@@ -1394,7 +1394,7 @@-3766.26611328125],[- 4603.33056640625,+ 4603.330078125,-3762.07861328125]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_shortlist_many_options.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_shortlist_many_options.jsonindex b53820e6..c838a7a1 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_shortlist_many_options.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_shortlist_many_options.json@@ -1002,26 +1002,26 @@"marker_axis_padded": false,"logits": [[- 0.7194006443023682,- 0.2002488672733307,- 1.3849756717681885,- 0.19671010971069336,+ 0.7194005846977234,+ 0.20024871826171875,+ 1.384975790977478,+ 0.19671007990837097,-2.3684210777282715,-2.5026655197143555,-0.1955488622188568,-1.487708568572998,- -1.5839439630508423,- -0.0484333336353302,- 0.6778708100318909,- 0.4778832197189331,+ -1.5839437246322632,+ -0.04843336343765259,+ 0.6778708696365356,+ 0.47788310050964355,-1.1739604473114014,-0.6882023811340332,-2.925354480743408,-2.322965383529663,-2.6699132919311523,- -0.09885123372077942,- -0.047182679176330566,- -0.9663347005844116+ -0.0988512933254242,+ -0.047182708978652954,+ -0.9663347601890564]],"act_logits": [diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_single_option.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_single_option.jsonindex c04dd248..8e23b017 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_single_option.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/case_single_option.json@@ -131,7 +131,7 @@],"act_logits": [[- 4787.115234375,+ 4787.11572265625,-3909.83642578125]],diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/index.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/index.jsonindex 27fdf54e..5c2bf1ce 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/index.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/index.json@@ -84,5 +84,83 @@"file": "case_shortlist_many_options.json","expects_error": false,"kind": "shortlist"+ },+ {+ "name": "long_short",+ "file": "case_long_short.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_exact_limit",+ "file": "case_long_exact_limit.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_room_fast_path",+ "file": "case_long_room_fast_path.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_multi_chunk",+ "file": "case_long_multi_chunk.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_punctuation",+ "file": "case_long_punctuation.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_dict",+ "file": "case_long_dict.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_list",+ "file": "case_long_list.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_clamp",+ "file": "case_long_clamp.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_special_tokens",+ "file": "case_long_special_tokens.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_empty_questions",+ "file": "case_long_empty_questions.json",+ "expects_error": false,+ "kind": "long"+ },+ {+ "name": "long_invalid_stride",+ "file": "case_long_invalid_stride.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_invalid_aggregate",+ "file": "case_long_invalid_aggregate.json",+ "expects_error": true,+ "kind": "long"+ },+ {+ "name": "long_no_state_room",+ "file": "case_long_no_state_room.json",+ "expects_error": true,+ "kind": "long"}]diff --git a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/meta.json b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/meta.jsonindex 079fcbe4..7e4bec91 100644--- a/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/meta.json+++ b/laya-dotnet/tests/Laya.Tests/golden/typed-decisions/meta.json@@ -1,7 +1,7 @@{"generator": "tools/dump_golden.py","onnx_dir": "typed-decisions",- "laya_version": "0.3.24",+ "laya_version": "0.4.11","onnxruntime_version": "1.30.0","transformers_version": "5.17.0","config": {@@ -73,11 +73,11 @@},"onnx_self_check": {"single_noul": {- "logits_maxdiff": 1.8477439880371094e-06,+ "logits_maxdiff": 1.817941665649414e-06,"act_maxdiff": 0.0009765625},"triage_4q": {- "logits_maxdiff": 2.6226043701171875e-06,+ "logits_maxdiff": 2.86102294921875e-06,"act_maxdiff": 0.00146484375}}diff --git a/laya-dotnet/tools/dump_golden.py b/laya-dotnet/tools/dump_golden.pyindex 9799f03f..fc890cab 100644--- a/laya-dotnet/tools/dump_golden.py+++ b/laya-dotnet/tools/dump_golden.py@@ -8,6 +8,8 @@ unmodified, so every number written here is what Python actually answers -- notparaphrase of it. It also means no 1.3 GB safetensors checkpoint is needed: the exportedONNX graph supplies the forward pass.+Long cases run the genuine `ONNXAgent.predict_long`, sharing that same verified session.+Before writing anything the script checks its ONNX session against the PyTorch referencevectors bundled in `fixtures.npz`, so a bad session can never silently poison the goldens.@@ -36,7 +38,7 @@ REPO = os.path.dirname(os.path.dirname(TOOLS))sys.path.insert(0, REPO)sys.path.insert(0, TOOLS)-from golden_cases import CASES, ERROR_CASES, SHORTLIST_E2E_CASES # noqa: E402+from golden_cases import CASES, ERROR_CASES, LONG_CASES, LONG_ERROR_CASES, SHORTLIST_E2E_CASES # noqa: E402import hashing_embedder # noqa: E402@@ -381,6 +383,61 @@ def record_error_case(agent: Agent, case: dict) -> dict:raise SystemExit("case %r was expected to raise ValueError but did not" % case["name"])+def record_long_case(agent: Agent, case: dict, expects_error: bool = False) -> dict:+ """Run the genuine ONNXAgent scan, sharing the already verified session/tokenizer."""+ from laya.common import encode_text, window_budget+ from laya.onnx_agent import ONNXAgent++ onnx = ONNXAgent.__new__(ONNXAgent)+ onnx.cfg, onnx.tok, onnx.session = agent.cfg, agent.tok, agent.model.sess+ onnx.temperature = agent.temperature+ onnx.temperature_by_options = agent.temperature_by_options+ onnx.lang_temperatures = {}+ options = case.get("options", {})+ state, questions = case.get("state"), case["questions"]+ rec = {"name": case["name"], "state": state, "questions": questions, "options": options}+ if expects_error:+ try:+ onnx.predict_long(state, questions, **options)+ except ValueError as e:+ rec.update(error_type="ValueError", error_message=str(e))+ return rec+ raise SystemExit("long case %r was expected to raise ValueError but did not" % case["name"])++ internal = [onnx._to_internal(q) for q in questions.values()]+ budget, step, room = window_budget(+ onnx.tok, internal, onnx.cfg.get("max_len", 512), onnx.cfg.get("head_max_len", 192),+ window=options.get("window"), stride=options.get("stride"),+ )+ # predict_long's one-pass bound: an explicit window, else the room the questions leave.+ single = budget if (options.get("window") or 0) > 0 else room+ if case.get("state_at_room") and room <= budget:+ raise SystemExit("long case %r needs room (%d) > window (%d)" % (case["name"], room, budget))+ target = budget if case.get("state_at_limit") else room if case.get("state_at_room") else None+ if target is not None:+ state = " ".join(["a"] * target)+ rec["state"] = state+ state_ids = encode_text(+ onnx.tok, serialize_state(state).replace(onnx.tok.mask_token, " "), add_special_tokens=False,+ )["input_ids"]+ if target is not None and len(state_ids) != target:+ raise SystemExit("boundary state is %d tokens, expected exactly %d" % (len(state_ids), target))+ rec.update(state_tokens=len(state_ids), effective_window=budget, effective_stride=step,+ effective_room=room)+ # Record decoded windows too: this pins cleanup, special tokens and boundary drift independently+ # of rounded model scores. The single-window fast path must not decode/re-encode the state.+ windows = []+ if len(state_ids) > single:+ for start in range(0, len(state_ids), step):+ windows.append({"token_start": start, "token_end": min(start + budget, len(state_ids)),+ "text": onnx.tok.decode(state_ids[start:start + budget])})+ if start + budget >= len(state_ids):+ break+ rec["windows"] = windows+ rec["result"] = onnx.predict_long(state, questions, **options)+ return rec++def dump(obj, path: str):with open(path, "w", encoding="utf-8", newline="\n") as f:json.dump(obj, f, ensure_ascii=False, indent=2, sort_keys=False)@@ -474,6 +531,15 @@ def run_checkpoint(onnx_dir: str, out_dir: str) -> int:"expects_error": False, "kind": "shortlist",})+ for cases, expects_error in ((LONG_CASES, False), (LONG_ERROR_CASES, True)):+ for case in cases:+ rec = record_long_case(agent, case, expects_error)+ dump(rec, os.path.join(out_dir, "case_%s.json" % case["name"]))+ index.append({+ "name": case["name"], "file": "case_%s.json" % case["name"],+ "expects_error": expects_error, "kind": "long",+ })+dump(index, os.path.join(out_dir, "index.json"))print("done: %d cases -> %s" % (len(index), out_dir))return 0diff --git a/laya-dotnet/tools/golden_cases.py b/laya-dotnet/tools/golden_cases.pyindex b3932291..25f4733a 100644--- a/laya-dotnet/tools/golden_cases.py+++ b/laya-dotnet/tools/golden_cases.py@@ -315,3 +315,74 @@ SHORTLIST_E2E_CASES = ["k": 20,},]++# ONNXAgent.predict_long, not the torch Agent: the .NET engine is an ONNX runtime too.+LONG_QUESTIONS = {+ "topic": {+ "type": "choice", "instructions": "What is the request about?",+ "criteria": {"refund": "money back, duplicate charge", "technical": "bugs and outages", "other": None},+ },+ "urgency": {+ "type": "score", "instructions": "How urgent is this request?",+ "criteria": ["not urgent", "this week", "today"],+ },+ "cancel": {"type": "noul", "instructions": "The customer threatens to cancel the account."},+}++LONG_CASES = [+ {"name": "long_short", "state": QUICKSTART_STATE, "questions": LONG_QUESTIONS},+ # The dump computes this state from the actual tokenizer and the effective default budget.+ {"name": "long_exact_limit", "state_at_limit": True, "questions": LONG_QUESTIONS},+ # Past the default window but within the questions' room: one Predict pass, no scan.+ {"name": "long_room_fast_path", "state_at_room": True, "questions": LONG_QUESTIONS},+ {+ "name": "long_multi_chunk",+ "state": ("The agent checked the account and recorded routine status updates. " * 180+ + QUICKSTART_STATE),+ "questions": LONG_QUESTIONS,+ "options": {"batch_size": 2},+ },+ {+ "name": "long_punctuation",+ "state": ("I 'm checking . We 've seen this , have n't we ? " * 18+ + "I want a refund ! I 'll cancel today ."),+ "questions": LONG_QUESTIONS,+ "options": {"window": 64, "stride": 64, "batch_size": 3},+ },+ {+ "name": "long_dict",+ "state": {"notes": "Routine checks completed. " * 22, "message": QUICKSTART_STATE},+ "questions": LONG_QUESTIONS,+ "options": {"window": 96},+ },+ {+ "name": "long_list",+ "state": [{"role": "assistant", "content": "Please wait while we check the account. " * 20},+ {"role": "user", "content": QUICKSTART_STATE}],+ "questions": LONG_QUESTIONS,+ "options": {"window": 96, "stride": 48},+ },+ {+ "name": "long_clamp",+ "state": "Normal account activity. " * 200 + QUICKSTART_STATE,+ "questions": LONG_QUESTIONS,+ "options": {"window": 4096, "stride": 2048, "batch_size": 2},+ },+ # Tokenizer.decode must retain special tokens, just as Python's default decode does.+ {+ "name": "long_special_tokens",+ "state": ("The text includes [CLS] [SEP] <bos> <eos> [MASK] <mask> and emojis 😀 🚀. " * 15),+ "questions": LONG_QUESTIONS,+ "options": {"window": 64, "batch_size": 2},+ },+ {"name": "long_empty_questions", "state": "Routine checks. " * 35, "questions": {},+ "options": {"window": 32, "batch_size": 2}},+]++LONG_ERROR_CASES = [+ {"name": "long_invalid_stride", "state": "short", "questions": LONG_QUESTIONS,+ "options": {"window": 32, "stride": 33}},+ {"name": "long_invalid_aggregate", "state": "short", "questions": LONG_QUESTIONS,+ "options": {"aggregate": "mean"}},+ {"name": "long_no_state_room", "state": "short", "questions": ERROR_CASES[0]["questions"]},+]