Artifact acbb31e9ea737ea9cc79dedc3372b7fd613190f03030fe55f38971c33ab84420:
- File
test/pic/decode.sh
— part of check-in
[1011fc8472]
at
2026-11-19 23:29:07
on branch gemini
— A Google Gemini provider, as Pi's
The google-generative-ai API: streamGenerateContent over SSE with GEMINI_API_KEY, native parts replayed per conversation, tool calls and results, usage, and Pi's thinking mapping (thinkingLevel for Gemini 3 and later, a token budget for 2.5, 0 for off). A conversation can move between Gemini and the other providers turn by turn. Recorded streams cover text, thinking, tools, parallel calls, safety blocks, truncation and errors. (user: dmestas, size: 1117) [annotate] [blame] [check-ins using] [more...]
#!/bin/sh # Decodes every recorded stream and compares it with its checked-in summary: # Messages API streams in streams/, Chat Completions streams in chat-streams/, # Responses streams in responses-streams/, Gemini streams in gemini-streams/. # Usage: decode.sh DECODER [--update] set -eu decoder=$1 here=$(dirname "$0") for dir in streams chat-streams responses-streams gemini-streams; do mode= [ "$dir" = chat-streams ] && mode=--chat [ "$dir" = responses-streams ] && mode=--responses [ "$dir" = gemini-streams ] && mode=--gemini for stream in "$here/$dir"/*.sse; do want=${stream%.sse}.want if [ "${2:-}" = --update ]; then # shellcheck disable=SC2086 "$decoder" $mode "$stream" > "$want" continue fi # shellcheck disable=SC2086 if ! "$decoder" $mode "$stream" | cmp -s - "$want"; then echo "FAIL $stream" >&2 # shellcheck disable=SC2086 "$decoder" $mode "$stream" | diff "$want" - >&2 || true exit 1 fi done done echo "decode: all recorded streams match"