@langwatch/scenario 0.2.12 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -8
- package/dist/{chunk-7HLDX5EL.mjs → chunk-3Z7E24UI.mjs} +52 -43
- package/dist/{chunk-OL4RFXV4.mjs → chunk-RHTLQKEJ.mjs} +1 -1
- package/dist/index.d.mts +110 -128
- package/dist/index.d.ts +110 -128
- package/dist/index.js +118 -111
- package/dist/index.mjs +23 -23
- package/dist/integrations/vitest/reporter.js +14 -10
- package/dist/integrations/vitest/reporter.mjs +7 -3
- package/dist/integrations/vitest/setup-global.js +1 -1
- package/dist/integrations/vitest/setup-global.mjs +1 -1
- package/dist/integrations/vitest/setup.js +155 -90
- package/dist/integrations/vitest/setup.mjs +2 -2
- package/package.json +8 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { CoreMessage, CoreUserMessage, CoreAssistantMessage, CoreToolMessage, LanguageModel } from 'ai';
|
|
3
|
-
import { z } from 'zod';
|
|
2
|
+
import { CoreMessage, CoreUserMessage, CoreAssistantMessage, CoreToolMessage, LanguageModel, ModelMessage } from 'ai';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
|
+
import { z as z$1 } from 'zod';
|
|
5
6
|
|
|
6
7
|
declare enum AgentRole {
|
|
7
8
|
USER = "User",
|
|
@@ -352,31 +353,12 @@ interface ScenarioExecutionStateLike {
|
|
|
352
353
|
declare const DEFAULT_TEMPERATURE = 0;
|
|
353
354
|
declare const scenarioProjectConfigSchema: z.ZodObject<{
|
|
354
355
|
defaultModel: z.ZodOptional<z.ZodObject<{
|
|
355
|
-
model: z.
|
|
356
|
+
model: z.ZodCustom<LanguageModel, LanguageModel>;
|
|
356
357
|
temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
357
358
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
maxTokens?: number | undefined;
|
|
362
|
-
}, {
|
|
363
|
-
model: ai.LanguageModelV1;
|
|
364
|
-
temperature?: number | undefined;
|
|
365
|
-
maxTokens?: number | undefined;
|
|
366
|
-
}>>;
|
|
367
|
-
}, "strict", z.ZodTypeAny, {
|
|
368
|
-
defaultModel?: {
|
|
369
|
-
model: ai.LanguageModelV1;
|
|
370
|
-
temperature: number;
|
|
371
|
-
maxTokens?: number | undefined;
|
|
372
|
-
} | undefined;
|
|
373
|
-
}, {
|
|
374
|
-
defaultModel?: {
|
|
375
|
-
model: ai.LanguageModelV1;
|
|
376
|
-
temperature?: number | undefined;
|
|
377
|
-
maxTokens?: number | undefined;
|
|
378
|
-
} | undefined;
|
|
379
|
-
}>;
|
|
359
|
+
}, z.core.$strip>>;
|
|
360
|
+
headless: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
361
|
+
}, z.core.$strict>;
|
|
380
362
|
type ScenarioProjectConfig = z.infer<typeof scenarioProjectConfigSchema>;
|
|
381
363
|
declare function defineConfig(config: ScenarioProjectConfig): ScenarioProjectConfig;
|
|
382
364
|
|
|
@@ -491,7 +473,7 @@ declare class JudgeAgent extends JudgeAgentAdapter {
|
|
|
491
473
|
constructor(cfg: JudgeAgentConfig);
|
|
492
474
|
call(input: AgentInput): Promise<never[] | {
|
|
493
475
|
success: boolean;
|
|
494
|
-
messages:
|
|
476
|
+
messages: ai.ModelMessage[];
|
|
495
477
|
reasoning: string;
|
|
496
478
|
metCriteria: string[];
|
|
497
479
|
unmetCriteria: string[];
|
|
@@ -687,26 +669,26 @@ declare enum ScenarioRunStatus {
|
|
|
687
669
|
* Discriminated union of all possible scenario event types.
|
|
688
670
|
* Enables type-safe handling of different event types based on the 'type' field.
|
|
689
671
|
*/
|
|
690
|
-
declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
691
|
-
timestamp: z.ZodNumber;
|
|
692
|
-
rawEvent: z.ZodOptional<z.ZodAny>;
|
|
693
|
-
batchRunId: z.ZodString;
|
|
694
|
-
scenarioId: z.ZodString;
|
|
695
|
-
scenarioRunId: z.ZodString;
|
|
696
|
-
scenarioSetId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
672
|
+
declare const scenarioEventSchema: z$1.ZodDiscriminatedUnion<"type", [z$1.ZodObject<{
|
|
673
|
+
timestamp: z$1.ZodNumber;
|
|
674
|
+
rawEvent: z$1.ZodOptional<z$1.ZodAny>;
|
|
675
|
+
batchRunId: z$1.ZodString;
|
|
676
|
+
scenarioId: z$1.ZodString;
|
|
677
|
+
scenarioRunId: z$1.ZodString;
|
|
678
|
+
scenarioSetId: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
697
679
|
} & {
|
|
698
|
-
type: z.ZodLiteral<ScenarioEventType.RUN_STARTED>;
|
|
699
|
-
metadata: z.ZodObject<{
|
|
700
|
-
name: z.ZodOptional<z.ZodString>;
|
|
701
|
-
description: z.ZodOptional<z.ZodString>;
|
|
702
|
-
}, "strip", z.ZodTypeAny, {
|
|
680
|
+
type: z$1.ZodLiteral<ScenarioEventType.RUN_STARTED>;
|
|
681
|
+
metadata: z$1.ZodObject<{
|
|
682
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
683
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
684
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
703
685
|
name?: string | undefined;
|
|
704
686
|
description?: string | undefined;
|
|
705
687
|
}, {
|
|
706
688
|
name?: string | undefined;
|
|
707
689
|
description?: string | undefined;
|
|
708
690
|
}>;
|
|
709
|
-
}, "strip", z.ZodTypeAny, {
|
|
691
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
710
692
|
type: ScenarioEventType.RUN_STARTED;
|
|
711
693
|
timestamp: number;
|
|
712
694
|
batchRunId: string;
|
|
@@ -730,36 +712,36 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
730
712
|
};
|
|
731
713
|
rawEvent?: any;
|
|
732
714
|
scenarioSetId?: string | undefined;
|
|
733
|
-
}>, z.ZodObject<{
|
|
734
|
-
timestamp: z.ZodNumber;
|
|
735
|
-
rawEvent: z.ZodOptional<z.ZodAny>;
|
|
736
|
-
batchRunId: z.ZodString;
|
|
737
|
-
scenarioId: z.ZodString;
|
|
738
|
-
scenarioRunId: z.ZodString;
|
|
739
|
-
scenarioSetId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
715
|
+
}>, z$1.ZodObject<{
|
|
716
|
+
timestamp: z$1.ZodNumber;
|
|
717
|
+
rawEvent: z$1.ZodOptional<z$1.ZodAny>;
|
|
718
|
+
batchRunId: z$1.ZodString;
|
|
719
|
+
scenarioId: z$1.ZodString;
|
|
720
|
+
scenarioRunId: z$1.ZodString;
|
|
721
|
+
scenarioSetId: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
740
722
|
} & {
|
|
741
|
-
type: z.ZodLiteral<ScenarioEventType.RUN_FINISHED>;
|
|
742
|
-
status: z.ZodNativeEnum<typeof ScenarioRunStatus>;
|
|
743
|
-
results: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
744
|
-
verdict: z.ZodNativeEnum<typeof Verdict>;
|
|
745
|
-
reasoning: z.ZodOptional<z.ZodString>;
|
|
746
|
-
metCriteria: z.ZodArray<z.ZodString, "many">;
|
|
747
|
-
unmetCriteria: z.ZodArray<z.ZodString, "many">;
|
|
748
|
-
error: z.ZodOptional<z.ZodString>;
|
|
749
|
-
}, "strip", z.ZodTypeAny, {
|
|
723
|
+
type: z$1.ZodLiteral<ScenarioEventType.RUN_FINISHED>;
|
|
724
|
+
status: z$1.ZodNativeEnum<typeof ScenarioRunStatus>;
|
|
725
|
+
results: z$1.ZodNullable<z$1.ZodOptional<z$1.ZodObject<{
|
|
726
|
+
verdict: z$1.ZodNativeEnum<typeof Verdict>;
|
|
727
|
+
reasoning: z$1.ZodOptional<z$1.ZodString>;
|
|
728
|
+
metCriteria: z$1.ZodArray<z$1.ZodString, "many">;
|
|
729
|
+
unmetCriteria: z$1.ZodArray<z$1.ZodString, "many">;
|
|
730
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
731
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
750
732
|
verdict: Verdict;
|
|
751
733
|
metCriteria: string[];
|
|
752
734
|
unmetCriteria: string[];
|
|
753
|
-
reasoning?: string | undefined;
|
|
754
735
|
error?: string | undefined;
|
|
736
|
+
reasoning?: string | undefined;
|
|
755
737
|
}, {
|
|
756
738
|
verdict: Verdict;
|
|
757
739
|
metCriteria: string[];
|
|
758
740
|
unmetCriteria: string[];
|
|
759
|
-
reasoning?: string | undefined;
|
|
760
741
|
error?: string | undefined;
|
|
742
|
+
reasoning?: string | undefined;
|
|
761
743
|
}>>>;
|
|
762
|
-
}, "strip", z.ZodTypeAny, {
|
|
744
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
763
745
|
type: ScenarioEventType.RUN_FINISHED;
|
|
764
746
|
status: ScenarioRunStatus;
|
|
765
747
|
timestamp: number;
|
|
@@ -772,8 +754,8 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
772
754
|
verdict: Verdict;
|
|
773
755
|
metCriteria: string[];
|
|
774
756
|
unmetCriteria: string[];
|
|
775
|
-
reasoning?: string | undefined;
|
|
776
757
|
error?: string | undefined;
|
|
758
|
+
reasoning?: string | undefined;
|
|
777
759
|
} | null | undefined;
|
|
778
760
|
}, {
|
|
779
761
|
type: ScenarioEventType.RUN_FINISHED;
|
|
@@ -788,19 +770,19 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
788
770
|
verdict: Verdict;
|
|
789
771
|
metCriteria: string[];
|
|
790
772
|
unmetCriteria: string[];
|
|
791
|
-
reasoning?: string | undefined;
|
|
792
773
|
error?: string | undefined;
|
|
774
|
+
reasoning?: string | undefined;
|
|
793
775
|
} | null | undefined;
|
|
794
|
-
}>, z.ZodObject<{
|
|
795
|
-
messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<z.objectUtil.extendShape<{
|
|
796
|
-
id: z.ZodString;
|
|
797
|
-
role: z.ZodString;
|
|
798
|
-
content: z.ZodOptional<z.ZodString>;
|
|
799
|
-
name: z.ZodOptional<z.ZodString>;
|
|
776
|
+
}>, z$1.ZodObject<{
|
|
777
|
+
messages: z$1.ZodArray<z$1.ZodDiscriminatedUnion<"role", [z$1.ZodObject<z$1.objectUtil.extendShape<{
|
|
778
|
+
id: z$1.ZodString;
|
|
779
|
+
role: z$1.ZodString;
|
|
780
|
+
content: z$1.ZodOptional<z$1.ZodString>;
|
|
781
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
800
782
|
}, {
|
|
801
|
-
role: z.ZodLiteral<"developer">;
|
|
802
|
-
content: z.ZodString;
|
|
803
|
-
}>, "strip", z.ZodTypeAny, {
|
|
783
|
+
role: z$1.ZodLiteral<"developer">;
|
|
784
|
+
content: z$1.ZodString;
|
|
785
|
+
}>, "strip", z$1.ZodTypeAny, {
|
|
804
786
|
id: string;
|
|
805
787
|
role: "developer";
|
|
806
788
|
content: string;
|
|
@@ -810,15 +792,15 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
810
792
|
role: "developer";
|
|
811
793
|
content: string;
|
|
812
794
|
name?: string | undefined;
|
|
813
|
-
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
814
|
-
id: z.ZodString;
|
|
815
|
-
role: z.ZodString;
|
|
816
|
-
content: z.ZodOptional<z.ZodString>;
|
|
817
|
-
name: z.ZodOptional<z.ZodString>;
|
|
795
|
+
}>, z$1.ZodObject<z$1.objectUtil.extendShape<{
|
|
796
|
+
id: z$1.ZodString;
|
|
797
|
+
role: z$1.ZodString;
|
|
798
|
+
content: z$1.ZodOptional<z$1.ZodString>;
|
|
799
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
818
800
|
}, {
|
|
819
|
-
role: z.ZodLiteral<"system">;
|
|
820
|
-
content: z.ZodString;
|
|
821
|
-
}>, "strip", z.ZodTypeAny, {
|
|
801
|
+
role: z$1.ZodLiteral<"system">;
|
|
802
|
+
content: z$1.ZodString;
|
|
803
|
+
}>, "strip", z$1.ZodTypeAny, {
|
|
822
804
|
id: string;
|
|
823
805
|
role: "system";
|
|
824
806
|
content: string;
|
|
@@ -828,28 +810,28 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
828
810
|
role: "system";
|
|
829
811
|
content: string;
|
|
830
812
|
name?: string | undefined;
|
|
831
|
-
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
832
|
-
id: z.ZodString;
|
|
833
|
-
role: z.ZodString;
|
|
834
|
-
content: z.ZodOptional<z.ZodString>;
|
|
835
|
-
name: z.ZodOptional<z.ZodString>;
|
|
813
|
+
}>, z$1.ZodObject<z$1.objectUtil.extendShape<{
|
|
814
|
+
id: z$1.ZodString;
|
|
815
|
+
role: z$1.ZodString;
|
|
816
|
+
content: z$1.ZodOptional<z$1.ZodString>;
|
|
817
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
836
818
|
}, {
|
|
837
|
-
role: z.ZodLiteral<"assistant">;
|
|
838
|
-
content: z.ZodOptional<z.ZodString>;
|
|
839
|
-
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
840
|
-
id: z.ZodString;
|
|
841
|
-
type: z.ZodLiteral<"function">;
|
|
842
|
-
function: z.ZodObject<{
|
|
843
|
-
name: z.ZodString;
|
|
844
|
-
arguments: z.ZodString;
|
|
845
|
-
}, "strip", z.ZodTypeAny, {
|
|
819
|
+
role: z$1.ZodLiteral<"assistant">;
|
|
820
|
+
content: z$1.ZodOptional<z$1.ZodString>;
|
|
821
|
+
toolCalls: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
822
|
+
id: z$1.ZodString;
|
|
823
|
+
type: z$1.ZodLiteral<"function">;
|
|
824
|
+
function: z$1.ZodObject<{
|
|
825
|
+
name: z$1.ZodString;
|
|
826
|
+
arguments: z$1.ZodString;
|
|
827
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
846
828
|
name: string;
|
|
847
829
|
arguments: string;
|
|
848
830
|
}, {
|
|
849
831
|
name: string;
|
|
850
832
|
arguments: string;
|
|
851
833
|
}>;
|
|
852
|
-
}, "strip", z.ZodTypeAny, {
|
|
834
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
853
835
|
function: {
|
|
854
836
|
name: string;
|
|
855
837
|
arguments: string;
|
|
@@ -864,7 +846,7 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
864
846
|
type: "function";
|
|
865
847
|
id: string;
|
|
866
848
|
}>, "many">>;
|
|
867
|
-
}>, "strip", z.ZodTypeAny, {
|
|
849
|
+
}>, "strip", z$1.ZodTypeAny, {
|
|
868
850
|
id: string;
|
|
869
851
|
role: "assistant";
|
|
870
852
|
name?: string | undefined;
|
|
@@ -890,15 +872,15 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
890
872
|
type: "function";
|
|
891
873
|
id: string;
|
|
892
874
|
}[] | undefined;
|
|
893
|
-
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
894
|
-
id: z.ZodString;
|
|
895
|
-
role: z.ZodString;
|
|
896
|
-
content: z.ZodOptional<z.ZodString>;
|
|
897
|
-
name: z.ZodOptional<z.ZodString>;
|
|
875
|
+
}>, z$1.ZodObject<z$1.objectUtil.extendShape<{
|
|
876
|
+
id: z$1.ZodString;
|
|
877
|
+
role: z$1.ZodString;
|
|
878
|
+
content: z$1.ZodOptional<z$1.ZodString>;
|
|
879
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
898
880
|
}, {
|
|
899
|
-
role: z.ZodLiteral<"user">;
|
|
900
|
-
content: z.ZodString;
|
|
901
|
-
}>, "strip", z.ZodTypeAny, {
|
|
881
|
+
role: z$1.ZodLiteral<"user">;
|
|
882
|
+
content: z$1.ZodString;
|
|
883
|
+
}>, "strip", z$1.ZodTypeAny, {
|
|
902
884
|
id: string;
|
|
903
885
|
role: "user";
|
|
904
886
|
content: string;
|
|
@@ -908,12 +890,12 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
908
890
|
role: "user";
|
|
909
891
|
content: string;
|
|
910
892
|
name?: string | undefined;
|
|
911
|
-
}>, z.ZodObject<{
|
|
912
|
-
id: z.ZodString;
|
|
913
|
-
content: z.ZodString;
|
|
914
|
-
role: z.ZodLiteral<"tool">;
|
|
915
|
-
toolCallId: z.ZodString;
|
|
916
|
-
}, "strip", z.ZodTypeAny, {
|
|
893
|
+
}>, z$1.ZodObject<{
|
|
894
|
+
id: z$1.ZodString;
|
|
895
|
+
content: z$1.ZodString;
|
|
896
|
+
role: z$1.ZodLiteral<"tool">;
|
|
897
|
+
toolCallId: z$1.ZodString;
|
|
898
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
917
899
|
id: string;
|
|
918
900
|
role: "tool";
|
|
919
901
|
content: string;
|
|
@@ -925,14 +907,14 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
925
907
|
toolCallId: string;
|
|
926
908
|
}>]>, "many">;
|
|
927
909
|
} & {
|
|
928
|
-
timestamp: z.ZodNumber;
|
|
929
|
-
rawEvent: z.ZodOptional<z.ZodAny>;
|
|
930
|
-
batchRunId: z.ZodString;
|
|
931
|
-
scenarioId: z.ZodString;
|
|
932
|
-
scenarioRunId: z.ZodString;
|
|
933
|
-
scenarioSetId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
934
|
-
type: z.ZodLiteral<ScenarioEventType.MESSAGE_SNAPSHOT>;
|
|
935
|
-
}, "strip", z.ZodTypeAny, {
|
|
910
|
+
timestamp: z$1.ZodNumber;
|
|
911
|
+
rawEvent: z$1.ZodOptional<z$1.ZodAny>;
|
|
912
|
+
batchRunId: z$1.ZodString;
|
|
913
|
+
scenarioId: z$1.ZodString;
|
|
914
|
+
scenarioRunId: z$1.ZodString;
|
|
915
|
+
scenarioSetId: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
916
|
+
type: z$1.ZodLiteral<ScenarioEventType.MESSAGE_SNAPSHOT>;
|
|
917
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
936
918
|
type: ScenarioEventType.MESSAGE_SNAPSHOT;
|
|
937
919
|
messages: ({
|
|
938
920
|
id: string;
|
|
@@ -1017,7 +999,7 @@ declare const scenarioEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
1017
999
|
rawEvent?: any;
|
|
1018
1000
|
scenarioSetId?: string | undefined;
|
|
1019
1001
|
}>]>;
|
|
1020
|
-
type ScenarioEvent = z.infer<typeof scenarioEventSchema>;
|
|
1002
|
+
type ScenarioEvent = z$1.infer<typeof scenarioEventSchema>;
|
|
1021
1003
|
|
|
1022
1004
|
/**
|
|
1023
1005
|
* Manages the execution of a single scenario test.
|
|
@@ -1152,9 +1134,9 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1152
1134
|
/**
|
|
1153
1135
|
* Gets the complete conversation history as an array of messages.
|
|
1154
1136
|
*
|
|
1155
|
-
* @returns Array of
|
|
1137
|
+
* @returns Array of ModelMessage objects representing the full conversation
|
|
1156
1138
|
*/
|
|
1157
|
-
get messages():
|
|
1139
|
+
get messages(): ModelMessage[];
|
|
1158
1140
|
/**
|
|
1159
1141
|
* Gets the unique identifier for the conversation thread.
|
|
1160
1142
|
* This ID is used to maintain conversation context across multiple runs.
|
|
@@ -1227,7 +1209,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1227
1209
|
* }
|
|
1228
1210
|
* ```
|
|
1229
1211
|
*/
|
|
1230
|
-
step(): Promise<
|
|
1212
|
+
step(): Promise<ModelMessage[] | ScenarioResult>;
|
|
1231
1213
|
private _step;
|
|
1232
1214
|
/**
|
|
1233
1215
|
* Calls a specific agent to generate a response or make a decision.
|
|
@@ -1267,7 +1249,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1267
1249
|
* - "assistant" messages are routed to AGENT role agents
|
|
1268
1250
|
* - Other message types are added directly to the conversation
|
|
1269
1251
|
*
|
|
1270
|
-
* @param message - The
|
|
1252
|
+
* @param message - The ModelMessage to add to the conversation
|
|
1271
1253
|
*
|
|
1272
1254
|
* @example
|
|
1273
1255
|
* ```typescript
|
|
@@ -1277,7 +1259,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1277
1259
|
* });
|
|
1278
1260
|
* ```
|
|
1279
1261
|
*/
|
|
1280
|
-
message(message:
|
|
1262
|
+
message(message: ModelMessage): Promise<void>;
|
|
1281
1263
|
/**
|
|
1282
1264
|
* Executes a user turn in the conversation.
|
|
1283
1265
|
*
|
|
@@ -1287,7 +1269,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1287
1269
|
*
|
|
1288
1270
|
* This method is part of the ScenarioExecutionLike interface used by script steps.
|
|
1289
1271
|
*
|
|
1290
|
-
* @param content - Optional content for the user's message. Can be a string or
|
|
1272
|
+
* @param content - Optional content for the user's message. Can be a string or ModelMessage.
|
|
1291
1273
|
* If not provided, the user simulator agent will generate the content.
|
|
1292
1274
|
*
|
|
1293
1275
|
* @example
|
|
@@ -1298,14 +1280,14 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1298
1280
|
* // Let user simulator generate content
|
|
1299
1281
|
* await execution.user();
|
|
1300
1282
|
*
|
|
1301
|
-
* // Use a
|
|
1283
|
+
* // Use a ModelMessage object
|
|
1302
1284
|
* await execution.user({
|
|
1303
1285
|
* role: "user",
|
|
1304
1286
|
* content: "Tell me a joke"
|
|
1305
1287
|
* });
|
|
1306
1288
|
* ```
|
|
1307
1289
|
*/
|
|
1308
|
-
user(content?: string |
|
|
1290
|
+
user(content?: string | ModelMessage): Promise<void>;
|
|
1309
1291
|
/**
|
|
1310
1292
|
* Executes an agent turn in the conversation.
|
|
1311
1293
|
*
|
|
@@ -1315,7 +1297,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1315
1297
|
*
|
|
1316
1298
|
* This method is part of the ScenarioExecutionLike interface used by script steps.
|
|
1317
1299
|
*
|
|
1318
|
-
* @param content - Optional content for the agent's response. Can be a string or
|
|
1300
|
+
* @param content - Optional content for the agent's response. Can be a string or ModelMessage.
|
|
1319
1301
|
* If not provided, the agent under test will generate the response.
|
|
1320
1302
|
*
|
|
1321
1303
|
* @example
|
|
@@ -1326,14 +1308,14 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1326
1308
|
* // Use provided content
|
|
1327
1309
|
* await execution.agent("The weather is sunny today!");
|
|
1328
1310
|
*
|
|
1329
|
-
* // Use a
|
|
1311
|
+
* // Use a ModelMessage object
|
|
1330
1312
|
* await execution.agent({
|
|
1331
1313
|
* role: "assistant",
|
|
1332
1314
|
* content: "I'm here to help you with weather information."
|
|
1333
1315
|
* });
|
|
1334
1316
|
* ```
|
|
1335
1317
|
*/
|
|
1336
|
-
agent(content?: string |
|
|
1318
|
+
agent(content?: string | ModelMessage): Promise<void>;
|
|
1337
1319
|
/**
|
|
1338
1320
|
* Invokes the judge agent to evaluate the current state of the conversation.
|
|
1339
1321
|
*
|
|
@@ -1361,7 +1343,7 @@ declare class ScenarioExecution implements ScenarioExecutionLike {
|
|
|
1361
1343
|
* const result = await execution.judge("Please consider the user's satisfaction level");
|
|
1362
1344
|
* ```
|
|
1363
1345
|
*/
|
|
1364
|
-
judge(content?: string |
|
|
1346
|
+
judge(content?: string | ModelMessage): Promise<ScenarioResult | null>;
|
|
1365
1347
|
/**
|
|
1366
1348
|
* Lets the scenario proceed automatically for a specified number of turns.
|
|
1367
1349
|
*
|