Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ai/geminiPredictionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function geminiRequestBodyFor(prompt: AiPredictionPrompt): Record<string, unknow
generationConfig: {
responseFormat: {
text: {
mimeType: "application/json",
mimeType: "APPLICATION_JSON",
schema: aiPredictionSchema()
}
}
Expand Down
14 changes: 1 addition & 13 deletions tests/ai/geminiPredictionClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,7 @@ test("sends prompt to Gemini generateContent endpoint", async () => {

assert.equal(body.systemInstruction.parts[0]?.text, "Return JSON only.")
assert.equal(body.contents[0]?.parts[0]?.text, "{\"branch\":\"feature/a\"}")
assert.equal(body.generationConfig.responseFormat.text.mimeType, "application/json")
})

// Gemini JSON text 응답이 기존 AI prediction validator에 넘길 수 있는 object로 parse되는지 확인
test("parses Gemini JSON text response", async () => {
const client = new GeminiPredictionClient({
apiKey: "gemini-key",
fetch: fetchSpy(validGeminiResponse())
})

const response = await client.predict(prompt())

assert.deepEqual(response, validPrediction())
assert.equal(body.generationConfig.responseFormat.text.mimeType, "APPLICATION_JSON")
})

// Gemini HTTP 실패가 branch 단위 failed result로 격리될 수 있도록 Error로 노출되는지 확인
Expand Down