fix(gemini,anthropic): base64 validation, escaped model paths, prompt-block mapping, unified unsupported-param semantics

This commit is contained in:
2026-08-20 09:49:33 +01:00
parent 2891766b5f
commit f71d9d0b50
24 changed files with 416 additions and 45 deletions
+11
View File
@@ -0,0 +1,11 @@
{
"model": "gemini-2.5-pro",
"messages": [
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "data:text/plain,Hello"}}
]
}
]
}
+1
View File
@@ -0,0 +1 @@
{"errContains": "must be base64-encoded", "notSupported": false}
+5
View File
@@ -0,0 +1,5 @@
{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "hi"}],
"logit_bias": {}
}
+5
View File
@@ -0,0 +1,5 @@
{
"contents": [
{"role": "user", "parts": [{"text": "hi"}]}
]
}
+5
View File
@@ -0,0 +1,5 @@
{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "hi"}],
"logprobs": false
}
+5
View File
@@ -0,0 +1,5 @@
{
"contents": [
{"role": "user", "parts": [{"text": "hi"}]}
]
}
+5
View File
@@ -0,0 +1,5 @@
{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "hi"}],
"logprobs": true
}
+1
View File
@@ -0,0 +1 @@
{"errContains": "logprobs is not supported for gemini models", "notSupported": false}
+9
View File
@@ -0,0 +1,9 @@
{
"candidates": [
{
"content": {"role": "model", "parts": [{"text": "ok"}]},
"finishReason": "STOP"
}
],
"usageMetadata": {"promptTokenCount": 2, "candidatesTokenCount": 1}
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "chatcmpl-gemini-1734000000",
"object": "chat.completion",
"created": 1734000000,
"model": "gw-gemini-model",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "ok"},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 2, "completion_tokens": 1, "total_tokens": 3}
}
+5
View File
@@ -0,0 +1,5 @@
{
"promptFeedback": {"blockReason": "SAFETY"},
"usageMetadata": {"promptTokenCount": 15, "candidatesTokenCount": 0},
"responseId": "resp_BLOCKED1"
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "chatcmpl-resp_BLOCKED1",
"object": "chat.completion",
"created": 1734000000,
"model": "gw-gemini-model",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": null},
"finish_reason": "content_filter"
}
],
"usage": {"prompt_tokens": 15, "completion_tokens": 0, "total_tokens": 15}
}
+2
View File
@@ -0,0 +1,2 @@
data: {"promptFeedback":{"blockReason":"SAFETY"},"usageMetadata":{"promptTokenCount":9,"candidatesTokenCount":0},"responseId":"resp_BLOCKSTREAM"}
+1
View File
@@ -0,0 +1 @@
{"prompt": 9, "completion": 0}
+4
View File
@@ -0,0 +1,4 @@
[
{"id":"chatcmpl-resp_BLOCKSTREAM","object":"chat.completion.chunk","created":1734000000,"model":"gw-gemini-model","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]},
{"id":"chatcmpl-resp_BLOCKSTREAM","object":"chat.completion.chunk","created":1734000000,"model":"gw-gemini-model","choices":[{"index":0,"delta":{},"finish_reason":"content_filter"}]}
]