@lobehub/lobehub 2.0.0-next.74 → 2.0.0-next.76
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/CHANGELOG.md +50 -0
- package/changelog/v1.json +18 -0
- package/locales/ar/chat.json +5 -0
- package/locales/ar/models.json +15 -0
- package/locales/ar/tool.json +12 -1
- package/locales/bg-BG/chat.json +5 -0
- package/locales/bg-BG/models.json +15 -0
- package/locales/bg-BG/tool.json +12 -1
- package/locales/de-DE/chat.json +5 -0
- package/locales/de-DE/models.json +15 -0
- package/locales/de-DE/tool.json +12 -1
- package/locales/en-US/models.json +15 -0
- package/locales/es-ES/chat.json +5 -0
- package/locales/es-ES/models.json +15 -0
- package/locales/es-ES/tool.json +12 -1
- package/locales/fa-IR/chat.json +5 -0
- package/locales/fa-IR/models.json +15 -0
- package/locales/fa-IR/tool.json +12 -1
- package/locales/fr-FR/chat.json +5 -0
- package/locales/fr-FR/models.json +15 -0
- package/locales/fr-FR/tool.json +12 -1
- package/locales/it-IT/chat.json +5 -0
- package/locales/it-IT/models.json +15 -0
- package/locales/it-IT/tool.json +12 -1
- package/locales/ja-JP/chat.json +5 -0
- package/locales/ja-JP/models.json +15 -0
- package/locales/ja-JP/tool.json +12 -1
- package/locales/ko-KR/chat.json +5 -0
- package/locales/ko-KR/models.json +15 -0
- package/locales/ko-KR/tool.json +12 -1
- package/locales/nl-NL/chat.json +5 -0
- package/locales/nl-NL/models.json +15 -0
- package/locales/nl-NL/tool.json +12 -1
- package/locales/pl-PL/chat.json +5 -0
- package/locales/pl-PL/models.json +15 -0
- package/locales/pl-PL/tool.json +12 -1
- package/locales/pt-BR/chat.json +5 -0
- package/locales/pt-BR/models.json +15 -0
- package/locales/pt-BR/tool.json +12 -1
- package/locales/ru-RU/chat.json +5 -0
- package/locales/ru-RU/models.json +15 -0
- package/locales/ru-RU/tool.json +12 -1
- package/locales/tr-TR/chat.json +5 -0
- package/locales/tr-TR/models.json +15 -0
- package/locales/tr-TR/tool.json +12 -1
- package/locales/vi-VN/chat.json +5 -0
- package/locales/vi-VN/models.json +15 -0
- package/locales/vi-VN/tool.json +12 -1
- package/locales/zh-CN/models.json +15 -0
- package/locales/zh-TW/chat.json +5 -0
- package/locales/zh-TW/models.json +15 -0
- package/locales/zh-TW/tool.json +12 -1
- package/package.json +1 -1
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +2 -0
- package/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap +1007 -0
- package/packages/model-runtime/src/core/streams/openai/openai.test.ts +310 -0
- package/packages/model-runtime/src/core/streams/openai/openai.ts +67 -0
- package/packages/model-runtime/src/providers/minimax/index.ts +36 -6
- package/packages/model-runtime/src/providers/novita/__snapshots__/index.test.ts.snap +584 -0
- package/packages/model-runtime/src/providers/openai/__snapshots__/index.test.ts.snap +517 -0
- package/packages/model-runtime/src/providers/ppio/__snapshots__/index.test.ts.snap +27 -0
- package/packages/utils/src/colorUtils.test.ts +167 -0
- package/src/locales/default/error.ts +2 -2
package/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap
CHANGED
|
@@ -592,3 +592,1010 @@ exports[`OpenAIResponsesStream > should transform OpenAI stream to protocol stre
|
|
|
592
592
|
",
|
|
593
593
|
]
|
|
594
594
|
`;
|
|
595
|
+
|
|
596
|
+
exports[`OpenAIResponsesStream Reasoning summary 1`] = `
|
|
597
|
+
[
|
|
598
|
+
|
|
599
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
600
|
+
"
|
|
601
|
+
,
|
|
602
|
+
|
|
603
|
+
"event: data
|
|
604
|
+
"
|
|
605
|
+
,
|
|
606
|
+
|
|
607
|
+
"data: "in_progress"
|
|
608
|
+
|
|
609
|
+
"
|
|
610
|
+
,
|
|
611
|
+
|
|
612
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
613
|
+
"
|
|
614
|
+
,
|
|
615
|
+
|
|
616
|
+
"event: data
|
|
617
|
+
"
|
|
618
|
+
,
|
|
619
|
+
|
|
620
|
+
"data: {"type":"response.in_progress","response":{"id":"resp_684313b89200819087f27686e0c822260b502bf083132d0d","object":"response","created_at":1749226424,"status":"in_progress","error":null,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"o4-mini","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":"medium","summary":"detailed"},"service_tier":"auto","store":false,"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"function","description":"a search service. Useful for when you need to answer questions about current events. Input should be a search query. Output is a JSON array of the query results","name":"lobe-web-browsing____search____builtin","parameters":{"properties":{"query":{"description":"The search query","type":"string"},"searchCategories":{"description":"The search categories you can set:","items":{"enum":["general","images","news","science","videos"],"type":"string"},"type":"array"},"searchEngines":{"description":"The search engines you can use:","items":{"enum":["google","bilibili","bing","duckduckgo","npm","pypi","github","arxiv","google scholar","z-library","reddit","imdb","brave","wikipedia","pinterest","unsplash","vimeo","youtube"],"type":"string"},"type":"array"},"searchTimeRange":{"description":"The time range you can set:","enum":["anytime","day","week","month","year"],"type":"string"}},"required":["query"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit page content. Output is a JSON object of title, content, url and website","name":"lobe-web-browsing____crawlSinglePage____builtin","parameters":{"properties":{"url":{"description":"The url need to be crawled","type":"string"}},"required":["url"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit multi pages. If need to visit multi website, use this one. Output is an array of JSON object of title, content, url and website","name":"lobe-web-browsing____crawlMultiPages____builtin","parameters":{"properties":{"urls":{"items":{"description":"The urls need to be crawled","type":"string"},"type":"array"}},"required":["urls"],"type":"object"},"strict":true}],"top_p":1,"truncation":"disabled","usage":null,"user":null,"metadata":{}}}
|
|
621
|
+
|
|
622
|
+
"
|
|
623
|
+
,
|
|
624
|
+
|
|
625
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
626
|
+
"
|
|
627
|
+
,
|
|
628
|
+
|
|
629
|
+
"event: data
|
|
630
|
+
"
|
|
631
|
+
,
|
|
632
|
+
|
|
633
|
+
"data: {"id":"rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d","type":"reasoning","summary":[]}
|
|
634
|
+
|
|
635
|
+
"
|
|
636
|
+
,
|
|
637
|
+
|
|
638
|
+
"id: rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d
|
|
639
|
+
"
|
|
640
|
+
,
|
|
641
|
+
|
|
642
|
+
"event: reasoning
|
|
643
|
+
"
|
|
644
|
+
,
|
|
645
|
+
|
|
646
|
+
"data: ""
|
|
647
|
+
|
|
648
|
+
"
|
|
649
|
+
,
|
|
650
|
+
|
|
651
|
+
"id: rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d
|
|
652
|
+
"
|
|
653
|
+
,
|
|
654
|
+
|
|
655
|
+
"event: reasoning
|
|
656
|
+
"
|
|
657
|
+
,
|
|
658
|
+
|
|
659
|
+
"data: "**Answering a"
|
|
660
|
+
|
|
661
|
+
"
|
|
662
|
+
,
|
|
663
|
+
|
|
664
|
+
"id: rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d
|
|
665
|
+
"
|
|
666
|
+
,
|
|
667
|
+
|
|
668
|
+
"event: reasoning
|
|
669
|
+
"
|
|
670
|
+
,
|
|
671
|
+
|
|
672
|
+
"data: " numeric or 9.92"
|
|
673
|
+
|
|
674
|
+
"
|
|
675
|
+
,
|
|
676
|
+
|
|
677
|
+
"id: rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d
|
|
678
|
+
"
|
|
679
|
+
,
|
|
680
|
+
|
|
681
|
+
"event: reasoning
|
|
682
|
+
"
|
|
683
|
+
,
|
|
684
|
+
|
|
685
|
+
"data: "."
|
|
686
|
+
|
|
687
|
+
"
|
|
688
|
+
,
|
|
689
|
+
|
|
690
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
691
|
+
"
|
|
692
|
+
,
|
|
693
|
+
|
|
694
|
+
"event: data
|
|
695
|
+
"
|
|
696
|
+
,
|
|
697
|
+
|
|
698
|
+
"data: {"type":"response.reasoning_summary_text.done","item_id":"rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d","output_index":0,"summary_index":0,"text":"**Answering a numeric comparison**\\n\\nThe user is asking in Chinese which number is larger: 9.1 or 9.92. This is straightforward since 9.92 is clearly larger, as it's greater than 9.1. We can respond with \\"9.92大于9.1\\" without needing to search for more information. It's a simple comparison, but Iould also add a little explanation, noting that 9.92 is indeed 0.82 more than 9.1. However, keeping it simple with \\"9.92 > 9.1\\" is perfectly fine!"}
|
|
699
|
+
|
|
700
|
+
"
|
|
701
|
+
,
|
|
702
|
+
|
|
703
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
704
|
+
"
|
|
705
|
+
,
|
|
706
|
+
|
|
707
|
+
"event: data
|
|
708
|
+
"
|
|
709
|
+
,
|
|
710
|
+
|
|
711
|
+
"data: {"type":"response.reasoning_summary_part.done","item_id":"rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d","output_index":0,"summary_index":0,"part":{"type":"summary_text","text":"**Answering a numeric comparison**\\n\\nThe user is asking in Chinese which number is larger: 9.1 or 9.92. This is straightforward since 9.92 is clearly larger, as it's greater than 9.1. We can respond with \\"9.92大于9.1\\" without needing to search for more information. Is a simple comparison, but I could also add a little explanation, noting that 9.92 is indeed 0.82 more than 9.1. However, keeping it simple with \\"9.92 > 9.1\\" is perfectly fine!"}}
|
|
712
|
+
|
|
713
|
+
"
|
|
714
|
+
,
|
|
715
|
+
|
|
716
|
+
"id: rs_6843fe13e73c8190a49d9372ef8cd46f08c019075e7c8955
|
|
717
|
+
"
|
|
718
|
+
,
|
|
719
|
+
|
|
720
|
+
"event: reasoning
|
|
721
|
+
"
|
|
722
|
+
,
|
|
723
|
+
|
|
724
|
+
"data: "\\n"
|
|
725
|
+
|
|
726
|
+
"
|
|
727
|
+
,
|
|
728
|
+
|
|
729
|
+
"id: rs_6843fe13e73c8190a49d9372ef8cd46f08c019075e7c8955
|
|
730
|
+
"
|
|
731
|
+
,
|
|
732
|
+
|
|
733
|
+
"event: reasoning
|
|
734
|
+
"
|
|
735
|
+
,
|
|
736
|
+
|
|
737
|
+
"data: "**Exploring a mathematical sequence**"
|
|
738
|
+
|
|
739
|
+
"
|
|
740
|
+
,
|
|
741
|
+
|
|
742
|
+
"id: rs_6843fe13e73c8190a49d9372ef8cd46f08c019075e7c8955
|
|
743
|
+
"
|
|
744
|
+
,
|
|
745
|
+
|
|
746
|
+
"event: reasoning
|
|
747
|
+
"
|
|
748
|
+
,
|
|
749
|
+
|
|
750
|
+
"data: " analyzing"
|
|
751
|
+
|
|
752
|
+
"
|
|
753
|
+
,
|
|
754
|
+
|
|
755
|
+
"id: rs_684313b9774481908ee856625f82fb8c0b502bf083132d0d
|
|
756
|
+
"
|
|
757
|
+
,
|
|
758
|
+
|
|
759
|
+
"event: text
|
|
760
|
+
"
|
|
761
|
+
,
|
|
762
|
+
|
|
763
|
+
"data: null
|
|
764
|
+
|
|
765
|
+
"
|
|
766
|
+
,
|
|
767
|
+
|
|
768
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
769
|
+
"
|
|
770
|
+
,
|
|
771
|
+
|
|
772
|
+
"event: data
|
|
773
|
+
"
|
|
774
|
+
,
|
|
775
|
+
|
|
776
|
+
"data: {"id":"msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d","type":"message","status":"in_progress","content":[],"role":"assistant"}
|
|
777
|
+
|
|
778
|
+
"
|
|
779
|
+
,
|
|
780
|
+
|
|
781
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
782
|
+
"
|
|
783
|
+
,
|
|
784
|
+
|
|
785
|
+
"event: data
|
|
786
|
+
"
|
|
787
|
+
,
|
|
788
|
+
|
|
789
|
+
"data: {"type":"response.content_part.added","item_id":"msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":""}}
|
|
790
|
+
|
|
791
|
+
"
|
|
792
|
+
,
|
|
793
|
+
|
|
794
|
+
"id: msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d
|
|
795
|
+
"
|
|
796
|
+
,
|
|
797
|
+
|
|
798
|
+
"event: text
|
|
799
|
+
"
|
|
800
|
+
,
|
|
801
|
+
|
|
802
|
+
"data: "9.92 比 9.1 大。"
|
|
803
|
+
|
|
804
|
+
"
|
|
805
|
+
,
|
|
806
|
+
|
|
807
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
808
|
+
"
|
|
809
|
+
,
|
|
810
|
+
|
|
811
|
+
"event: data
|
|
812
|
+
"
|
|
813
|
+
,
|
|
814
|
+
|
|
815
|
+
"data: {"type":"response.output_text.done","item_id":"msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d","output_index":1,"content_index":0,"text":"9.92 比 9.1 大。"}
|
|
816
|
+
|
|
817
|
+
"
|
|
818
|
+
,
|
|
819
|
+
|
|
820
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
821
|
+
"
|
|
822
|
+
,
|
|
823
|
+
|
|
824
|
+
"event: data
|
|
825
|
+
"
|
|
826
|
+
,
|
|
827
|
+
|
|
828
|
+
"data: {"type":"response.content_part.done","item_id":"msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":"9.92 比 9.1 大。"}}
|
|
829
|
+
|
|
830
|
+
"
|
|
831
|
+
,
|
|
832
|
+
|
|
833
|
+
"id: msg_684313bee2c88190b0f4b09621ad7dc60b502bf083132d0d
|
|
834
|
+
"
|
|
835
|
+
,
|
|
836
|
+
|
|
837
|
+
"event: text
|
|
838
|
+
"
|
|
839
|
+
,
|
|
840
|
+
|
|
841
|
+
"data: null
|
|
842
|
+
|
|
843
|
+
"
|
|
844
|
+
,
|
|
845
|
+
|
|
846
|
+
"id: resp_684313b89200819087f27686e0c822260b502bf083132d0d
|
|
847
|
+
"
|
|
848
|
+
,
|
|
849
|
+
|
|
850
|
+
"event: usage
|
|
851
|
+
"
|
|
852
|
+
,
|
|
853
|
+
|
|
854
|
+
"data: {"inputCacheMissTokens":93,"inputCachedTokens":2298,"inputTextTokens":2391,"outputReasoningTokens":128,"outputTextTokens":16,"totalInputTokens":2391,"totalOutputTokens":144,"totalTokens":2535}
|
|
855
|
+
|
|
856
|
+
"
|
|
857
|
+
,
|
|
858
|
+
]
|
|
859
|
+
`;
|
|
860
|
+
|
|
861
|
+
exports[`OpenAIResponsesStream should transform OpenAI stream to protocol stream 1`] = `
|
|
862
|
+
[
|
|
863
|
+
|
|
864
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
865
|
+
"
|
|
866
|
+
,
|
|
867
|
+
|
|
868
|
+
"event: data
|
|
869
|
+
"
|
|
870
|
+
,
|
|
871
|
+
|
|
872
|
+
"data: "in_progress"
|
|
873
|
+
|
|
874
|
+
"
|
|
875
|
+
,
|
|
876
|
+
|
|
877
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
878
|
+
"
|
|
879
|
+
,
|
|
880
|
+
|
|
881
|
+
"event: data
|
|
882
|
+
"
|
|
883
|
+
,
|
|
884
|
+
|
|
885
|
+
"data: {"type":"response.in_progress","response":{"id":"resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58","object":"response","created_at":1748925324,"status":"in_progress","error":null,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"o4-mini","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":"medium","summary":null},"service_tier":"auto","store":false,"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"function","description":"a search service. Useful for when you need to answer questions about current events. Input should be a search query. Output is a JSON array of the query results","name":"lobe-web-browsing____search____builtin","parameters":{"properties":{"query":{"description":"The search query","type":"string"},"searchCategories":{"description":"The search categories you can set:","items":{"enum":["general","images","news","science","videos"],"type":"string"},"type":"array"},"searchEngines":{"description":"The search engines you can use:","items":{"enum":["google","bilibili","bing","duckduckgo","npm","pypi","github","arxiv","google scholar","z-library","reddit","imdb","brave","wikipedia","pinterest","unsplash","vimeo","youtube"],"type":"string"},"type":"array"},"searchTimeRange":{"description":"The time range you can set:","enum":["anytime","day","week","month","year"],"type":"string"}},"required":["query"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit page content. Output is a JSON object of title, content, url and website","name":"lobe-web-browsing____crawlSinglePage____builtin","parameters":{"properties":{"url":{"description":"The url need to be crawled","type":"string"}},"required":["url"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit multi pages. If need to visit multi website, use this one. Output is an array of JSON object of title, content, url and website","name":"lobe-web-browsing____crawlMultiPages____builtin","parameters":{"properties":{"urls":{"items":{"description":"The urls need to be crawled","type":"string"},"type":"array"}},"required":["urls"],"type":"object"},"strict":true}],"top_p":1,"truncation":"disabled","usage":null,"user":null,"metadata":{}}}
|
|
886
|
+
|
|
887
|
+
"
|
|
888
|
+
,
|
|
889
|
+
|
|
890
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
891
|
+
"
|
|
892
|
+
,
|
|
893
|
+
|
|
894
|
+
"event: data
|
|
895
|
+
"
|
|
896
|
+
,
|
|
897
|
+
|
|
898
|
+
"data: {"id":"rs_683e7bc80a9c81908f6e3d61ad63cc1e0cf93af363cdcf58","type":"reasoning","summary":[]}
|
|
899
|
+
|
|
900
|
+
"
|
|
901
|
+
,
|
|
902
|
+
|
|
903
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
904
|
+
"
|
|
905
|
+
,
|
|
906
|
+
|
|
907
|
+
"event: data
|
|
908
|
+
"
|
|
909
|
+
,
|
|
910
|
+
|
|
911
|
+
"data: {"id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","type":"message","status":"in_progress","content":[],"role":"assistant"}
|
|
912
|
+
|
|
913
|
+
"
|
|
914
|
+
,
|
|
915
|
+
|
|
916
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
917
|
+
"
|
|
918
|
+
,
|
|
919
|
+
|
|
920
|
+
"event: data
|
|
921
|
+
"
|
|
922
|
+
,
|
|
923
|
+
|
|
924
|
+
"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":"Hello"}}
|
|
925
|
+
|
|
926
|
+
"
|
|
927
|
+
,
|
|
928
|
+
|
|
929
|
+
"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
|
|
930
|
+
"
|
|
931
|
+
,
|
|
932
|
+
|
|
933
|
+
"event: data
|
|
934
|
+
"
|
|
935
|
+
,
|
|
936
|
+
|
|
937
|
+
"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":" world"}}
|
|
938
|
+
|
|
939
|
+
"
|
|
940
|
+
,
|
|
941
|
+
]
|
|
942
|
+
`;
|
|
943
|
+
|
|
944
|
+
exports[`OpenAIResponsesStream should handle first chunk error with FIRST_CHUNK_ERROR_KEY 1`] = `
|
|
945
|
+
[
|
|
946
|
+
|
|
947
|
+
"id: first_chunk_error
|
|
948
|
+
"
|
|
949
|
+
,
|
|
950
|
+
|
|
951
|
+
"event: error
|
|
952
|
+
"
|
|
953
|
+
,
|
|
954
|
+
|
|
955
|
+
"data: {"body":{"message":"Invalid API key","errorType":"InvalidProviderAPIKey"},"message":"Invalid API key","type":"InvalidProviderAPIKey"}
|
|
956
|
+
|
|
957
|
+
"
|
|
958
|
+
,
|
|
959
|
+
]
|
|
960
|
+
`;
|
|
961
|
+
|
|
962
|
+
exports[`OpenAIResponsesStream should handle first chunk error with message object 1`] = `
|
|
963
|
+
[
|
|
964
|
+
|
|
965
|
+
"id: first_chunk_error
|
|
966
|
+
"
|
|
967
|
+
,
|
|
968
|
+
|
|
969
|
+
"event: error
|
|
970
|
+
"
|
|
971
|
+
,
|
|
972
|
+
|
|
973
|
+
"data: {"body":{"message":{"error":"API quota exceeded","code":429}},"message":"{\\"message\\":{\\"error\\":\\"API quota exceeded\\",\\"code\\":429}}","type":"ProviderBizError"}
|
|
974
|
+
|
|
975
|
+
"
|
|
976
|
+
,
|
|
977
|
+
]
|
|
978
|
+
`;
|
|
979
|
+
|
|
980
|
+
exports[`OpenAIResponsesStream should handle first chunk error without message 1`] = `
|
|
981
|
+
[
|
|
982
|
+
|
|
983
|
+
"id: first_chunk_error
|
|
984
|
+
"
|
|
985
|
+
,
|
|
986
|
+
|
|
987
|
+
"event: error
|
|
988
|
+
"
|
|
989
|
+
,
|
|
990
|
+
|
|
991
|
+
"data: {"body":{"code":"rate_limit_exceeded","status":429},"message":"{\\"code\\":\\"rate_limit_exceeded\\",\\"status\\":429}","type":"ProviderBizError"}
|
|
992
|
+
|
|
993
|
+
"
|
|
994
|
+
,
|
|
995
|
+
]
|
|
996
|
+
`;
|
|
997
|
+
|
|
998
|
+
exports[`OpenAIResponsesStream should handle response.created event 1`] = `
|
|
999
|
+
[
|
|
1000
|
+
|
|
1001
|
+
"id: resp_test_123
|
|
1002
|
+
"
|
|
1003
|
+
,
|
|
1004
|
+
|
|
1005
|
+
"event: data
|
|
1006
|
+
"
|
|
1007
|
+
,
|
|
1008
|
+
|
|
1009
|
+
"data: "in_progress"
|
|
1010
|
+
|
|
1011
|
+
"
|
|
1012
|
+
,
|
|
1013
|
+
]
|
|
1014
|
+
`;
|
|
1015
|
+
|
|
1016
|
+
exports[`OpenAIResponsesStream should handle function_call in response.output_item.added 1`] = `
|
|
1017
|
+
[
|
|
1018
|
+
|
|
1019
|
+
"id: resp_test_456
|
|
1020
|
+
"
|
|
1021
|
+
,
|
|
1022
|
+
|
|
1023
|
+
"event: data
|
|
1024
|
+
"
|
|
1025
|
+
,
|
|
1026
|
+
|
|
1027
|
+
"data: "in_progress"
|
|
1028
|
+
|
|
1029
|
+
"
|
|
1030
|
+
,
|
|
1031
|
+
|
|
1032
|
+
"id: resp_test_456
|
|
1033
|
+
"
|
|
1034
|
+
,
|
|
1035
|
+
|
|
1036
|
+
"event: tool_calls
|
|
1037
|
+
"
|
|
1038
|
+
,
|
|
1039
|
+
|
|
1040
|
+
"data: [{"function":{"arguments":"{\\"location\\": \\"San Francisco\\"}","name":"get_weather"},"id":"call_abc123","index":0,"type":"function"}]
|
|
1041
|
+
|
|
1042
|
+
"
|
|
1043
|
+
,
|
|
1044
|
+
]
|
|
1045
|
+
`;
|
|
1046
|
+
|
|
1047
|
+
exports[`OpenAIResponsesStream should handle multiple function_calls with incrementing index 1`] = `
|
|
1048
|
+
[
|
|
1049
|
+
|
|
1050
|
+
"id: resp_multi_tool
|
|
1051
|
+
"
|
|
1052
|
+
,
|
|
1053
|
+
|
|
1054
|
+
"event: data
|
|
1055
|
+
"
|
|
1056
|
+
,
|
|
1057
|
+
|
|
1058
|
+
"data: "in_progress"
|
|
1059
|
+
|
|
1060
|
+
"
|
|
1061
|
+
,
|
|
1062
|
+
|
|
1063
|
+
"id: resp_multi_tool
|
|
1064
|
+
"
|
|
1065
|
+
,
|
|
1066
|
+
|
|
1067
|
+
"event: tool_calls
|
|
1068
|
+
"
|
|
1069
|
+
,
|
|
1070
|
+
|
|
1071
|
+
"data: [{"function":{"arguments":"{\\"param\\": \\"value1\\"}","name":"tool_one"},"id":"call_1","index":0,"type":"function"}]
|
|
1072
|
+
|
|
1073
|
+
"
|
|
1074
|
+
,
|
|
1075
|
+
|
|
1076
|
+
"id: resp_multi_tool
|
|
1077
|
+
"
|
|
1078
|
+
,
|
|
1079
|
+
|
|
1080
|
+
"event: tool_calls
|
|
1081
|
+
"
|
|
1082
|
+
,
|
|
1083
|
+
|
|
1084
|
+
"data: [{"function":{"arguments":"{\\"param\\": \\"value2\\"}","name":"tool_two"},"id":"call_2","index":1,"type":"function"}]
|
|
1085
|
+
|
|
1086
|
+
"
|
|
1087
|
+
,
|
|
1088
|
+
]
|
|
1089
|
+
`;
|
|
1090
|
+
|
|
1091
|
+
exports[`OpenAIResponsesStream should handle response.function_call_arguments.delta 1`] = `
|
|
1092
|
+
[
|
|
1093
|
+
|
|
1094
|
+
"id: resp_delta_test
|
|
1095
|
+
"
|
|
1096
|
+
,
|
|
1097
|
+
|
|
1098
|
+
"event: data
|
|
1099
|
+
"
|
|
1100
|
+
,
|
|
1101
|
+
|
|
1102
|
+
"data: "in_progress"
|
|
1103
|
+
|
|
1104
|
+
"
|
|
1105
|
+
,
|
|
1106
|
+
|
|
1107
|
+
"id: resp_delta_test
|
|
1108
|
+
"
|
|
1109
|
+
,
|
|
1110
|
+
|
|
1111
|
+
"event: tool_calls
|
|
1112
|
+
"
|
|
1113
|
+
,
|
|
1114
|
+
|
|
1115
|
+
"data: [{"function":{"arguments":"{\\"query\\":","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
|
|
1116
|
+
|
|
1117
|
+
"
|
|
1118
|
+
,
|
|
1119
|
+
|
|
1120
|
+
"id: resp_delta_test
|
|
1121
|
+
"
|
|
1122
|
+
,
|
|
1123
|
+
|
|
1124
|
+
"event: tool_calls
|
|
1125
|
+
"
|
|
1126
|
+
,
|
|
1127
|
+
|
|
1128
|
+
"data: [{"function":{"arguments":" \\"OpenAI\\"}","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
|
|
1129
|
+
|
|
1130
|
+
"
|
|
1131
|
+
,
|
|
1132
|
+
]
|
|
1133
|
+
`;
|
|
1134
|
+
|
|
1135
|
+
exports[`OpenAIResponsesStream should handle response.output_text.delta 1`] = `
|
|
1136
|
+
[
|
|
1137
|
+
|
|
1138
|
+
"id: resp_text_delta
|
|
1139
|
+
"
|
|
1140
|
+
,
|
|
1141
|
+
|
|
1142
|
+
"event: data
|
|
1143
|
+
"
|
|
1144
|
+
,
|
|
1145
|
+
|
|
1146
|
+
"data: "in_progress"
|
|
1147
|
+
|
|
1148
|
+
"
|
|
1149
|
+
,
|
|
1150
|
+
|
|
1151
|
+
"id: msg_123
|
|
1152
|
+
"
|
|
1153
|
+
,
|
|
1154
|
+
|
|
1155
|
+
"event: text
|
|
1156
|
+
"
|
|
1157
|
+
,
|
|
1158
|
+
|
|
1159
|
+
"data: "Hello "
|
|
1160
|
+
|
|
1161
|
+
"
|
|
1162
|
+
,
|
|
1163
|
+
|
|
1164
|
+
"id: msg_123
|
|
1165
|
+
"
|
|
1166
|
+
,
|
|
1167
|
+
|
|
1168
|
+
"event: text
|
|
1169
|
+
"
|
|
1170
|
+
,
|
|
1171
|
+
|
|
1172
|
+
"data: "world!"
|
|
1173
|
+
|
|
1174
|
+
"
|
|
1175
|
+
,
|
|
1176
|
+
]
|
|
1177
|
+
`;
|
|
1178
|
+
|
|
1179
|
+
exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for first part 1`] = `
|
|
1180
|
+
[
|
|
1181
|
+
|
|
1182
|
+
"id: resp_reasoning
|
|
1183
|
+
"
|
|
1184
|
+
,
|
|
1185
|
+
|
|
1186
|
+
"event: data
|
|
1187
|
+
"
|
|
1188
|
+
,
|
|
1189
|
+
|
|
1190
|
+
"data: "in_progress"
|
|
1191
|
+
|
|
1192
|
+
"
|
|
1193
|
+
,
|
|
1194
|
+
|
|
1195
|
+
"id: reasoning_1
|
|
1196
|
+
"
|
|
1197
|
+
,
|
|
1198
|
+
|
|
1199
|
+
"event: reasoning
|
|
1200
|
+
"
|
|
1201
|
+
,
|
|
1202
|
+
|
|
1203
|
+
"data: ""
|
|
1204
|
+
|
|
1205
|
+
"
|
|
1206
|
+
,
|
|
1207
|
+
]
|
|
1208
|
+
`;
|
|
1209
|
+
|
|
1210
|
+
exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for subsequent parts 1`] = `
|
|
1211
|
+
[
|
|
1212
|
+
|
|
1213
|
+
"id: resp_reasoning_multi
|
|
1214
|
+
"
|
|
1215
|
+
,
|
|
1216
|
+
|
|
1217
|
+
"event: data
|
|
1218
|
+
"
|
|
1219
|
+
,
|
|
1220
|
+
|
|
1221
|
+
"data: "in_progress"
|
|
1222
|
+
|
|
1223
|
+
"
|
|
1224
|
+
,
|
|
1225
|
+
|
|
1226
|
+
"id: reasoning_1
|
|
1227
|
+
"
|
|
1228
|
+
,
|
|
1229
|
+
|
|
1230
|
+
"event: reasoning
|
|
1231
|
+
"
|
|
1232
|
+
,
|
|
1233
|
+
|
|
1234
|
+
"data: ""
|
|
1235
|
+
|
|
1236
|
+
"
|
|
1237
|
+
,
|
|
1238
|
+
|
|
1239
|
+
"id: reasoning_2
|
|
1240
|
+
"
|
|
1241
|
+
,
|
|
1242
|
+
|
|
1243
|
+
"event: reasoning
|
|
1244
|
+
"
|
|
1245
|
+
,
|
|
1246
|
+
|
|
1247
|
+
"data: "\\n"
|
|
1248
|
+
|
|
1249
|
+
"
|
|
1250
|
+
,
|
|
1251
|
+
]
|
|
1252
|
+
`;
|
|
1253
|
+
|
|
1254
|
+
exports[`OpenAIResponsesStream should handle response.reasoning_summary_text.delta 1`] = `
|
|
1255
|
+
[
|
|
1256
|
+
|
|
1257
|
+
"id: resp_reasoning_delta
|
|
1258
|
+
"
|
|
1259
|
+
,
|
|
1260
|
+
|
|
1261
|
+
"event: data
|
|
1262
|
+
"
|
|
1263
|
+
,
|
|
1264
|
+
|
|
1265
|
+
"data: "in_progress"
|
|
1266
|
+
|
|
1267
|
+
"
|
|
1268
|
+
,
|
|
1269
|
+
|
|
1270
|
+
"id: reasoning_123
|
|
1271
|
+
"
|
|
1272
|
+
,
|
|
1273
|
+
|
|
1274
|
+
"event: reasoning
|
|
1275
|
+
"
|
|
1276
|
+
,
|
|
1277
|
+
|
|
1278
|
+
"data: "Thinking about"
|
|
1279
|
+
|
|
1280
|
+
"
|
|
1281
|
+
,
|
|
1282
|
+
|
|
1283
|
+
"id: reasoning_123
|
|
1284
|
+
"
|
|
1285
|
+
,
|
|
1286
|
+
|
|
1287
|
+
"event: reasoning
|
|
1288
|
+
"
|
|
1289
|
+
,
|
|
1290
|
+
|
|
1291
|
+
"data: " the problem..."
|
|
1292
|
+
|
|
1293
|
+
"
|
|
1294
|
+
,
|
|
1295
|
+
]
|
|
1296
|
+
`;
|
|
1297
|
+
|
|
1298
|
+
exports[`OpenAIResponsesStream should handle response.output_text.annotation.added 1`] = `
|
|
1299
|
+
[
|
|
1300
|
+
|
|
1301
|
+
"id: resp_annotation
|
|
1302
|
+
"
|
|
1303
|
+
,
|
|
1304
|
+
|
|
1305
|
+
"event: data
|
|
1306
|
+
"
|
|
1307
|
+
,
|
|
1308
|
+
|
|
1309
|
+
"data: "in_progress"
|
|
1310
|
+
|
|
1311
|
+
"
|
|
1312
|
+
,
|
|
1313
|
+
|
|
1314
|
+
"id: msg_citation
|
|
1315
|
+
"
|
|
1316
|
+
,
|
|
1317
|
+
|
|
1318
|
+
"event: text
|
|
1319
|
+
"
|
|
1320
|
+
,
|
|
1321
|
+
|
|
1322
|
+
"data: null
|
|
1323
|
+
|
|
1324
|
+
"
|
|
1325
|
+
,
|
|
1326
|
+
]
|
|
1327
|
+
`;
|
|
1328
|
+
|
|
1329
|
+
exports[`OpenAIResponsesStream should handle multiple annotations and accumulate citations 1`] = `
|
|
1330
|
+
[
|
|
1331
|
+
|
|
1332
|
+
"id: resp_multi_citation
|
|
1333
|
+
"
|
|
1334
|
+
,
|
|
1335
|
+
|
|
1336
|
+
"event: data
|
|
1337
|
+
"
|
|
1338
|
+
,
|
|
1339
|
+
|
|
1340
|
+
"data: "in_progress"
|
|
1341
|
+
|
|
1342
|
+
"
|
|
1343
|
+
,
|
|
1344
|
+
|
|
1345
|
+
"id: msg_cite
|
|
1346
|
+
"
|
|
1347
|
+
,
|
|
1348
|
+
|
|
1349
|
+
"event: text
|
|
1350
|
+
"
|
|
1351
|
+
,
|
|
1352
|
+
|
|
1353
|
+
"data: null
|
|
1354
|
+
|
|
1355
|
+
"
|
|
1356
|
+
,
|
|
1357
|
+
|
|
1358
|
+
"id: msg_cite
|
|
1359
|
+
"
|
|
1360
|
+
,
|
|
1361
|
+
|
|
1362
|
+
"event: text
|
|
1363
|
+
"
|
|
1364
|
+
,
|
|
1365
|
+
|
|
1366
|
+
"data: null
|
|
1367
|
+
|
|
1368
|
+
"
|
|
1369
|
+
,
|
|
1370
|
+
]
|
|
1371
|
+
`;
|
|
1372
|
+
|
|
1373
|
+
exports[`OpenAIResponsesStream should handle response.output_item.done with citations 1`] = `
|
|
1374
|
+
[
|
|
1375
|
+
|
|
1376
|
+
"id: resp_done_citation
|
|
1377
|
+
"
|
|
1378
|
+
,
|
|
1379
|
+
|
|
1380
|
+
"event: data
|
|
1381
|
+
"
|
|
1382
|
+
,
|
|
1383
|
+
|
|
1384
|
+
"data: "in_progress"
|
|
1385
|
+
|
|
1386
|
+
"
|
|
1387
|
+
,
|
|
1388
|
+
|
|
1389
|
+
"id: msg_final
|
|
1390
|
+
"
|
|
1391
|
+
,
|
|
1392
|
+
|
|
1393
|
+
"event: text
|
|
1394
|
+
"
|
|
1395
|
+
,
|
|
1396
|
+
|
|
1397
|
+
"data: null
|
|
1398
|
+
|
|
1399
|
+
"
|
|
1400
|
+
,
|
|
1401
|
+
|
|
1402
|
+
"id: msg_final
|
|
1403
|
+
"
|
|
1404
|
+
,
|
|
1405
|
+
|
|
1406
|
+
"event: grounding
|
|
1407
|
+
"
|
|
1408
|
+
,
|
|
1409
|
+
|
|
1410
|
+
"data: {"citations":[{"title":"Citation Title","url":"https://citation.com"}]}
|
|
1411
|
+
|
|
1412
|
+
"
|
|
1413
|
+
,
|
|
1414
|
+
]
|
|
1415
|
+
`;
|
|
1416
|
+
|
|
1417
|
+
exports[`OpenAIResponsesStream should handle response.output_item.done without citations 1`] = `
|
|
1418
|
+
[
|
|
1419
|
+
|
|
1420
|
+
"id: resp_done_no_citation
|
|
1421
|
+
"
|
|
1422
|
+
,
|
|
1423
|
+
|
|
1424
|
+
"event: data
|
|
1425
|
+
"
|
|
1426
|
+
,
|
|
1427
|
+
|
|
1428
|
+
"data: "in_progress"
|
|
1429
|
+
|
|
1430
|
+
"
|
|
1431
|
+
,
|
|
1432
|
+
|
|
1433
|
+
"id: msg_no_cite
|
|
1434
|
+
"
|
|
1435
|
+
,
|
|
1436
|
+
|
|
1437
|
+
"event: text
|
|
1438
|
+
"
|
|
1439
|
+
,
|
|
1440
|
+
|
|
1441
|
+
"data: null
|
|
1442
|
+
|
|
1443
|
+
"
|
|
1444
|
+
,
|
|
1445
|
+
]
|
|
1446
|
+
`;
|
|
1447
|
+
|
|
1448
|
+
exports[`OpenAIResponsesStream should handle response.completed with usage 1`] = `
|
|
1449
|
+
[
|
|
1450
|
+
|
|
1451
|
+
"id: resp_completed_usage
|
|
1452
|
+
"
|
|
1453
|
+
,
|
|
1454
|
+
|
|
1455
|
+
"event: data
|
|
1456
|
+
"
|
|
1457
|
+
,
|
|
1458
|
+
|
|
1459
|
+
"data: "in_progress"
|
|
1460
|
+
|
|
1461
|
+
"
|
|
1462
|
+
,
|
|
1463
|
+
|
|
1464
|
+
"id: resp_completed_usage
|
|
1465
|
+
"
|
|
1466
|
+
,
|
|
1467
|
+
|
|
1468
|
+
"event: usage
|
|
1469
|
+
"
|
|
1470
|
+
,
|
|
1471
|
+
|
|
1472
|
+
"data: {"inputCacheMissTokens":100,"inputTextTokens":100,"outputTextTokens":50,"totalInputTokens":100,"totalOutputTokens":50,"totalTokens":150}
|
|
1473
|
+
|
|
1474
|
+
"
|
|
1475
|
+
,
|
|
1476
|
+
]
|
|
1477
|
+
`;
|
|
1478
|
+
|
|
1479
|
+
exports[`OpenAIResponsesStream should handle response.completed without usage 1`] = `
|
|
1480
|
+
[
|
|
1481
|
+
|
|
1482
|
+
"id: resp_completed_no_usage
|
|
1483
|
+
"
|
|
1484
|
+
,
|
|
1485
|
+
|
|
1486
|
+
"event: data
|
|
1487
|
+
"
|
|
1488
|
+
,
|
|
1489
|
+
|
|
1490
|
+
"data: "in_progress"
|
|
1491
|
+
|
|
1492
|
+
"
|
|
1493
|
+
,
|
|
1494
|
+
|
|
1495
|
+
"id: resp_completed_no_usage
|
|
1496
|
+
"
|
|
1497
|
+
,
|
|
1498
|
+
|
|
1499
|
+
"event: data
|
|
1500
|
+
"
|
|
1501
|
+
,
|
|
1502
|
+
|
|
1503
|
+
"data: {"type":"response.completed","response":{"id":"resp_completed_no_usage","status":"completed"}}
|
|
1504
|
+
|
|
1505
|
+
"
|
|
1506
|
+
,
|
|
1507
|
+
]
|
|
1508
|
+
`;
|
|
1509
|
+
|
|
1510
|
+
exports[`OpenAIResponsesStream should handle unknown chunk type as data 1`] = `
|
|
1511
|
+
[
|
|
1512
|
+
|
|
1513
|
+
"id: resp_unknown
|
|
1514
|
+
"
|
|
1515
|
+
,
|
|
1516
|
+
|
|
1517
|
+
"event: data
|
|
1518
|
+
"
|
|
1519
|
+
,
|
|
1520
|
+
|
|
1521
|
+
"data: "in_progress"
|
|
1522
|
+
|
|
1523
|
+
"
|
|
1524
|
+
,
|
|
1525
|
+
|
|
1526
|
+
"id: resp_unknown
|
|
1527
|
+
"
|
|
1528
|
+
,
|
|
1529
|
+
|
|
1530
|
+
"event: data
|
|
1531
|
+
"
|
|
1532
|
+
,
|
|
1533
|
+
|
|
1534
|
+
"data: {"type":"response.unknown_event","data":"some data"}
|
|
1535
|
+
|
|
1536
|
+
"
|
|
1537
|
+
,
|
|
1538
|
+
]
|
|
1539
|
+
`;
|
|
1540
|
+
|
|
1541
|
+
exports[`OpenAIResponsesStream should handle non-standard item types in output_item.added 1`] = `
|
|
1542
|
+
[
|
|
1543
|
+
|
|
1544
|
+
"id: resp_other_item
|
|
1545
|
+
"
|
|
1546
|
+
,
|
|
1547
|
+
|
|
1548
|
+
"event: data
|
|
1549
|
+
"
|
|
1550
|
+
,
|
|
1551
|
+
|
|
1552
|
+
"data: "in_progress"
|
|
1553
|
+
|
|
1554
|
+
"
|
|
1555
|
+
,
|
|
1556
|
+
|
|
1557
|
+
"id: resp_other_item
|
|
1558
|
+
"
|
|
1559
|
+
,
|
|
1560
|
+
|
|
1561
|
+
"event: data
|
|
1562
|
+
"
|
|
1563
|
+
,
|
|
1564
|
+
|
|
1565
|
+
"data: {"type":"message","id":"msg_test","status":"in_progress","content":[],"role":"assistant"}
|
|
1566
|
+
|
|
1567
|
+
"
|
|
1568
|
+
,
|
|
1569
|
+
]
|
|
1570
|
+
`;
|
|
1571
|
+
|
|
1572
|
+
exports[`OpenAIResponsesStream should handle chunks with undefined values gracefully 1`] = `
|
|
1573
|
+
[
|
|
1574
|
+
|
|
1575
|
+
"id: resp_undefined_vals
|
|
1576
|
+
"
|
|
1577
|
+
,
|
|
1578
|
+
|
|
1579
|
+
"event: data
|
|
1580
|
+
"
|
|
1581
|
+
,
|
|
1582
|
+
|
|
1583
|
+
"data: "in_progress"
|
|
1584
|
+
|
|
1585
|
+
"
|
|
1586
|
+
,
|
|
1587
|
+
|
|
1588
|
+
"id: undefined
|
|
1589
|
+
"
|
|
1590
|
+
,
|
|
1591
|
+
|
|
1592
|
+
"event: reasoning
|
|
1593
|
+
"
|
|
1594
|
+
,
|
|
1595
|
+
|
|
1596
|
+
"data: undefined
|
|
1597
|
+
|
|
1598
|
+
"
|
|
1599
|
+
,
|
|
1600
|
+
]
|
|
1601
|
+
`;
|