@@ -97,8 +97,8 @@ func ConvertOpenAIResponseToGemini(_ context.Context, _ string, originalRequestR
9797 var results []string
9898
9999 choices .ForEach (func (choiceIndex , choice gjson.Result ) bool {
100- // Base Gemini response template
101- template := `{"candidates":[{"content":{"parts":[],"role":"model"},"finishReason":"STOP"," index":0}]}`
100+ // Base Gemini response template without finishReason; set when known
101+ template := `{"candidates":[{"content":{"parts":[],"role":"model"},"index":0}]}`
102102
103103 // Set model if available
104104 if model := root .Get ("model" ); model .Exists () {
@@ -514,8 +514,8 @@ func tryParseNumber(s string) (interface{}, bool) {
514514func ConvertOpenAIResponseToGeminiNonStream (_ context.Context , _ string , originalRequestRawJSON , requestRawJSON , rawJSON []byte , _ * any ) string {
515515 root := gjson .ParseBytes (rawJSON )
516516
517- // Base Gemini response template
518- out := `{"candidates":[{"content":{"parts":[],"role":"model"},"finishReason":"STOP"," index":0}]}`
517+ // Base Gemini response template without finishReason; set when known
518+ out := `{"candidates":[{"content":{"parts":[],"role":"model"},"index":0}]}`
519519
520520 // Set model if available
521521 if model := root .Get ("model" ); model .Exists () {
0 commit comments