You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
three_small_things SmallThing[] @description("Should have three items.")
544
+
final_string string
545
+
}
546
+
547
+
class ClassWithoutDone {
548
+
i_16_digits int
549
+
s_20_words string @description("A string with 20 words in it") @stream.with_state
550
+
}
551
+
552
+
class ClassWithBlockDone {
553
+
i_16_digits int
554
+
s_20_words string
555
+
@@stream.done
556
+
}
557
+
558
+
class SmallThing {
559
+
i_16_digits int @stream.not_null
560
+
i_8_digits int
561
+
}
562
+
563
+
function MakeSemanticContainer() -> SemanticContainer {
564
+
client "openai/gpt-4o"
565
+
prompt #"
566
+
{{ ctx.output_format }}
567
+
"#
568
+
}
569
+
"###;
570
+
571
+
test_deserializer!(
572
+
test_streaming_not_null_list,
573
+
TEST_FILE_STREAMING_NOT_NULL_LIST,
574
+
r#"
575
+
{
576
+
"sixteen_digit_number": 1234567890123456,
577
+
"string_with_twenty_words": "This is an example string that contains exactly twenty words for the requested output in JSON format. It is quite informative.",
578
+
"class_1": {
579
+
"i_16_digits": 9876543210123456,
580
+
"s_20_words": "Another example string used for class one with twenty distinct words to complete the requirements of this JSON structure."
581
+
},
582
+
"class_2": {
583
+
"i_16_digits": 4567890123456789,
584
+
"s_20_words": "Class two also has a longer description that encompasses twenty unique words to fulfill the output specifications."
585
+
},
586
+
"class_done_needed": {
587
+
"i_16_digits": 7890123456789012,
588
+
"s_20_words": "This class indicates what has been completed and also includes twenty words in its description for clarity."
589
+
},
590
+
"class_needed": {
591
+
"i_16_digits": 3210987654321098,
592
+
"s_20_words": "Another class that explains what is currently needed for completion includes another twenty-word explanation for better understanding."
593
+
},
594
+
"three_small_things": [
595
+
{
596
+
"i_16_digits": 1357924680135792,
597
+
"i_8_digits": 24681357
598
+
},
599
+
{
600
+
"i_16_digits": 2468135790246813,
601
+
"i_8_digits": 86421357
602
+
},
603
+
{
604
+
"i_16_digits": 3571598642035791,
605
+
"i_8_digits": 97586421
606
+
}
607
+
],
608
+
"final_string": "This final string provides a brief conclusion or summary of the entire JSON formatted data provided above."
609
+
}
610
+
"#,
611
+
TypeIR::class("SemanticContainer"),
612
+
{
613
+
"sixteen_digit_number":1234567890123456i64,
614
+
"string_with_twenty_words":"This is an example string that contains exactly twenty words for the requested output in JSON format. It is quite informative.",
615
+
"class_1":{
616
+
"i_16_digits":9876543210123456i64,
617
+
"s_20_words":"Another example string used for class one with twenty distinct words to complete the requirements of this JSON structure."
618
+
},
619
+
"class_2":{
620
+
"i_16_digits":4567890123456789i64,
621
+
"s_20_words":"Class two also has a longer description that encompasses twenty unique words to fulfill the output specifications."
622
+
},
623
+
"class_done_needed":{
624
+
"i_16_digits":7890123456789012i64,
625
+
"s_20_words":"This class indicates what has been completed and also includes twenty words in its description for clarity."
626
+
},
627
+
"class_needed":{
628
+
"i_16_digits":3210987654321098i64,
629
+
"s_20_words":"Another class that explains what is currently needed for completion includes another twenty-word explanation for better understanding."
630
+
},
631
+
"three_small_things":[
632
+
{
633
+
"i_16_digits":1357924680135792i64,
634
+
"i_8_digits":24681357
635
+
},
636
+
{
637
+
"i_16_digits":2468135790246813i64,
638
+
"i_8_digits":86421357
639
+
},
640
+
{
641
+
"i_16_digits":3571598642035791i64,
642
+
"i_8_digits":97586421
643
+
}
644
+
],
645
+
"final_string":"This final string provides a brief conclusion or summary of the entire JSON formatted data provided above."
646
+
}
647
+
);
648
+
649
+
test_partial_deserializer!(
650
+
test_streaming_not_null_list_partial,
651
+
TEST_FILE_STREAMING_NOT_NULL_LIST,
652
+
r#"
653
+
{
654
+
"sixteen_digit_number": 1234567890123456,
655
+
"string_with_twenty_words": "This is an example string that contains exactly twenty words for the requested output in JSON format. It is quite informative.",
656
+
"class_1": {
657
+
"i_16_digits": 9876543210123456,
658
+
"s_20_words": "Another example string used for class one with twenty distinct words to complete the requirements of this JSON structure."
659
+
},
660
+
"class_2": {
661
+
"i_16_digits": 4567890123456789,
662
+
"s_20_words": "Class two also has a longer description that encompasses twenty unique words to fulfill the output specifications."
663
+
},
664
+
"class_done_needed": {
665
+
"i_16_digits": 7890123456789012,
666
+
"s_20_words": "This class indicates what has been completed and also includes twenty words in its description for clarity."
667
+
},
668
+
"class_needed": {
669
+
"i_16_digits": 3210987654321098,
670
+
"s_20_words": "Another class that explains what is currently needed for completion includes another twenty-word explanation for better understanding."
671
+
},
672
+
"three_small_things": [{
673
+
"i_16_digits": 123
674
+
675
+
"#,
676
+
TypeIR::class("SemanticContainer"),
677
+
{
678
+
"sixteen_digit_number":1234567890123456i64,
679
+
"string_with_twenty_words":"This is an example string that contains exactly twenty words for the requested output in JSON format. It is quite informative.",
680
+
"class_1":{
681
+
"i_16_digits":9876543210123456i64,
682
+
"s_20_words":"Another example string used for class one with twenty distinct words to complete the requirements of this JSON structure."
683
+
},
684
+
"class_2":{
685
+
"i_16_digits":4567890123456789i64,
686
+
"s_20_words":"Class two also has a longer description that encompasses twenty unique words to fulfill the output specifications."
687
+
},
688
+
"class_done_needed":{
689
+
"i_16_digits":7890123456789012i64,
690
+
"s_20_words":"This class indicates what has been completed and also includes twenty words in its description for clarity."
691
+
},
692
+
"class_needed":{
693
+
"i_16_digits":3210987654321098i64,
694
+
"s_20_words":"Another class that explains what is currently needed for completion includes another twenty-word explanation for better understanding."
695
+
},
696
+
"three_small_things":[
697
+
],
698
+
"final_string": null
699
+
}
700
+
);
701
+
702
+
test_deserializer!(
703
+
test_streaming_not_null_list_partial_2,
704
+
TEST_FILE_STREAMING_NOT_NULL_LIST,
705
+
r#"
706
+
{
707
+
"i_16_digits": 123456789012345,
708
+
"i_8_digits": 12345
709
+
}
710
+
"#,
711
+
TypeIR::class("SmallThing"),
712
+
{
713
+
"i_16_digits":123456789012345i64,
714
+
"i_8_digits":12345
715
+
}
716
+
);
717
+
718
+
test_partial_deserializer!(
719
+
test_streaming_not_null_list_partial_3_0,
720
+
TEST_FILE_STREAMING_NOT_NULL_LIST,
721
+
r#"
722
+
{
723
+
"three_small_things": [
724
+
{
725
+
"i_16_digits": 123456789012345
726
+
"#,
727
+
TypeIR::class("SemanticContainer2"),
728
+
// we should return an empty list here, not null
729
+
// SmallThing.i_16_digits is not_null, so the entry is not valid
730
+
// until the number is complete
731
+
{
732
+
"three_small_things":[
733
+
]
734
+
}
735
+
);
736
+
737
+
test_partial_deserializer!(
738
+
test_streaming_not_null_list_partial_3_1,
739
+
TEST_FILE_STREAMING_NOT_NULL_LIST,
740
+
r#"
741
+
{
742
+
"three_small_things": [
743
+
{
744
+
"i_16_digits": 123456789012345,
745
+
"#,
746
+
TypeIR::class("SemanticContainer2"),
747
+
// we should return an empty list here, not null
748
+
// SmallThing.i_16_digits is not_null, so the entry is not valid
0 commit comments