@@ -573,7 +573,7 @@ async Task TestCountTokens() {
573573
574574 // The url prefix to use when fetching test data to use from the separate GitHub repo.
575575 readonly string testDataUrl =
576- "https://raw.githubusercontent.com/FirebaseExtended/vertexai-sdk-test-data/refs/heads/main /mock-responses/" ;
576+ "https://raw.githubusercontent.com/FirebaseExtended/vertexai-sdk-test-data/bdf8af9e8f34157a31faeb712822f12e6feab31a /mock-responses/" ;
577577 readonly HttpClient httpClient = new ( ) ;
578578
579579 // Gets the Json test data from the given filename, potentially downloading from a GitHub repo.
@@ -592,6 +592,10 @@ private async Task<Dictionary<string, object>> GetJsonTestData(string filename)
592592 return Json . Deserialize ( jsonString ) as Dictionary < string , object > ;
593593 }
594594
595+ private Task < Dictionary < string , object > > GetVertexJsonTestData ( string filename ) {
596+ return GetJsonTestData ( $ "vertexai/{ filename } ") ;
597+ }
598+
595599 // Helper function to validate that the response has a TextPart as expected.
596600 private void ValidateTextPart ( GenerateContentResponse response , string expectedText ) {
597601 int candidateCount = response . Candidates . Count ( ) ;
@@ -665,7 +669,7 @@ private void ValidateCitation(Citation citation,
665669 // Test that parsing a basic short reply works as expected.
666670 // https://github.com/FirebaseExtended/vertexai-sdk-test-data/blob/main/mock-responses/unary-success-basic-reply-short.json
667671 async Task InternalTestBasicReplyShort ( ) {
668- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-basic-reply-short.json" ) ;
672+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-basic-reply-short.json" ) ;
669673 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
670674
671675 ValidateTextPart ( response , "Mountain View, California" ) ;
@@ -692,7 +696,7 @@ async Task InternalTestBasicReplyShort() {
692696 // Test that parsing a response including Citations works.
693697 // https://github.com/FirebaseExtended/vertexai-sdk-test-data/blob/main/mock-responses/unary-success-citations.json
694698 async Task InternalTestCitations ( ) {
695- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-citations.json" ) ;
699+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-citations.json" ) ;
696700 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
697701
698702 ValidateTextPart ( response , "Some information cited from an external source" ) ;
@@ -723,7 +727,7 @@ async Task InternalTestCitations() {
723727 // Test that parsing a response that was blocked for Safety reasons works.
724728 // https://github.com/FirebaseExtended/vertexai-sdk-test-data/blob/main/mock-responses/unary-failure-prompt-blocked-safety-with-message.json
725729 async Task InternalTestBlockedSafetyWithMessage ( ) {
726- Dictionary < string , object > json = await GetJsonTestData ( "unary-failure-prompt-blocked-safety-with-message.json" ) ;
730+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-failure-prompt-blocked-safety-with-message.json" ) ;
727731 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
728732
729733 Assert ( "Candidates" , ! response . Candidates . Any ( ) ) ;
@@ -753,7 +757,7 @@ async Task InternalTestBlockedSafetyWithMessage() {
753757 // Test that parsing a response that was blocked, and has no Content, works.
754758 // https://github.com/FirebaseExtended/vertexai-sdk-test-data/blob/main/mock-responses/unary-failure-finish-reason-safety-no-content.json
755759 async Task InternalTestFinishReasonSafetyNoContent ( ) {
756- Dictionary < string , object > json = await GetJsonTestData ( "unary-failure-finish-reason-safety-no-content.json" ) ;
760+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-failure-finish-reason-safety-no-content.json" ) ;
757761 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
758762
759763 AssertEq ( "Candidate count" , response . Candidates . Count ( ) , 1 ) ;
@@ -790,7 +794,7 @@ async Task InternalTestFinishReasonSafetyNoContent() {
790794 // Test that parsing a response with unknown safety enums works.
791795 // https://github.com/FirebaseExtended/vertexai-sdk-test-data/blob/main/mock-responses/unary-success-unknown-enum-safety-ratings.json
792796 async Task InternalTestUnknownEnumSafetyRatings ( ) {
793- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-unknown-enum-safety-ratings.json" ) ;
797+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-unknown-enum-safety-ratings.json" ) ;
794798 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
795799
796800 AssertEq ( "Candidate count" , response . Candidates . Count ( ) , 1 ) ;
@@ -823,7 +827,7 @@ async Task InternalTestUnknownEnumSafetyRatings() {
823827
824828 // Test that parsing a response with a FunctionCall part works.
825829 async Task InternalTestFunctionCallWithArguments ( ) {
826- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-function-call-with-arguments.json" ) ;
830+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-function-call-with-arguments.json" ) ;
827831 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
828832
829833 AssertEq ( "Candidate count" , response . Candidates . Count ( ) , 1 ) ;
@@ -842,7 +846,7 @@ async Task InternalTestFunctionCallWithArguments() {
842846
843847 // Test that parsing a count token response works.
844848 async Task InternalTestCountTokenResponse ( ) {
845- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-detailed-token-response.json" ) ;
849+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-detailed-token-response.json" ) ;
846850 CountTokensResponse response = CountTokensResponse . FromJson ( json ) ;
847851
848852 AssertEq ( "TotalTokens" , response . TotalTokens , 1837 ) ;
@@ -857,7 +861,7 @@ async Task InternalTestCountTokenResponse() {
857861
858862 // Test that the UsageMetadata is getting parsed correctly.
859863 async Task InternalTestBasicResponseLongUsageMetadata ( ) {
860- Dictionary < string , object > json = await GetJsonTestData ( "unary-success-basic-response-long-usage-metadata.json" ) ;
864+ Dictionary < string , object > json = await GetVertexJsonTestData ( "unary-success-basic-response-long-usage-metadata.json" ) ;
861865 GenerateContentResponse response = GenerateContentResponse . FromJson ( json ) ;
862866
863867 AssertEq ( "Response Text" , response . Text , "Here is a description of the image:\\ n\\ n" ) ;
0 commit comments