mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 13:03:42 +00:00
- Added image tests to OpenAI Completions (gpt-4o-mini) - Added image tests to Anthropic (claude-sonnet-4-0) - Added image tests to Google (gemini-2.5-flash) - Tests verify models can process and describe the red circle test image
34 lines
No EOL
943 B
TypeScript
34 lines
No EOL
943 B
TypeScript
#!/usr/bin/env tsx
|
|
|
|
import { createCanvas } from "canvas";
|
|
import { writeFileSync } from "fs";
|
|
import { join, dirname } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
// Create a 200x200 canvas
|
|
const canvas = createCanvas(200, 200);
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
// Fill background with white
|
|
ctx.fillStyle = "white";
|
|
ctx.fillRect(0, 0, 200, 200);
|
|
|
|
// Draw a red circle in the center
|
|
ctx.fillStyle = "red";
|
|
ctx.beginPath();
|
|
ctx.arc(100, 100, 50, 0, Math.PI * 2);
|
|
ctx.fill();
|
|
|
|
// Save the image
|
|
const buffer = canvas.toBuffer("image/png");
|
|
const outputPath = join(__dirname, "..", "test", "data", "red-circle.png");
|
|
|
|
// Ensure the directory exists
|
|
import { mkdirSync } from "fs";
|
|
mkdirSync(join(__dirname, "..", "test", "data"), { recursive: true });
|
|
|
|
writeFileSync(outputPath, buffer);
|
|
console.log(`Generated test image at: ${outputPath}`); |