diff options
| author | Claude <claude@anthropic.com> | 2026-03-04 19:14:55 +0100 |
|---|---|---|
| committer | Claude <claude@anthropic.com> | 2026-03-04 19:14:55 +0100 |
| commit | 171c5b86ef05974426ba5c5d8547c8025977d1a2 (patch) | |
| tree | 2a1193e2bb81a6341e55d0b883a3fc33f77f8be1 /test/scripts/send_test.py | |
| parent | 9f14edf2b97286e02830d528038b32d5b31aaa0a (diff) | |
| parent | 0278c87f062a9ae7d617b92be22b175558a05086 (diff) | |
| download | gemini-py-main.tar.gz gemini-py-main.zip | |
Diffstat (limited to 'test/scripts/send_test.py')
| -rw-r--r-- | test/scripts/send_test.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/scripts/send_test.py b/test/scripts/send_test.py new file mode 100644 index 0000000..2b5fe53 --- /dev/null +++ b/test/scripts/send_test.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import asyncio +import os + +from gemini import GeminiClient, GeminiOptions + +PROMPT = os.environ.get("TEST_PROMPT", "Say hi in exactly 3 words") + +CONFIGS = [ + {"label": "flash-lite", "model": "gemini-2.5-flash-lite"}, + {"label": "flash", "model": "gemini-2.5-flash"}, + {"label": "pro", "model": "gemini-2.5-pro"}, +] + + +async def run_one(cfg): + opts = GeminiOptions(model=cfg["model"]) + async with GeminiClient(options=opts) as client: + text = "" + async for chunk in client.send_message_stream(PROMPT): + text += chunk.text_delta + print(f" [{cfg['label']}] {text.strip()[:80]}") + + +async def main(): + mode = os.environ.get("TEST_MODE", "single") + configs = CONFIGS if mode == "all" else [CONFIGS[0]] + + for cfg in configs: + print(f">>> {cfg['label']}: model={cfg['model']}") + await run_one(cfg) + print() + + +if __name__ == "__main__": + asyncio.run(main()) |
