← back to Designer Wallcoverings
DW-Agents/dw-agents/agent-legal-team/test-cote-azure-NOW.ts
95 lines
import Anthropic from '@anthropic-ai/sdk';
const title = "Cote D'Azure Brazilliance Banana Leaves & Grapes Green Wallpaper";
const imageUrl = "https://cdn.shopify.com/s/files/1/0015/4117/7456/products/Brazilliance-Wallpaper-3.jpg?v=1611891288";
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const prompt = `First, describe what you see in this wallpaper image titled "${title}" in detail.
Then determine if it matches this settlement violation criteria:
**CRITERIA SET A (Pattern Features - need ALL 3):**
- Has repeating leaves with directional variation: YES/NO
- Has open space between elements: YES/NO
- Has 2+ colors: YES/NO
**CRITERIA SET B (Prohibited Elements - need ANY 1):**
- Shows bananas/banana leaves: YES/NO
- Shows grapes: YES/NO
- Shows birds: YES/NO
- Shows butterflies: YES/NO
If the first 3 are ALL YES and ANY of the last 4 is YES, it's a VIOLATION.
Please respond in this exact format:
DESCRIPTION: [Detailed description of what you see]
CRITERIA SET A:
- Repeating leaves with directional variation: YES/NO
- Open space between elements: YES/NO
- Multiple colors (2+): YES/NO [list the colors you see]
CRITERIA SET B:
- Bananas/banana leaves: YES/NO
- Grapes/grape clusters: YES/NO
- Birds: YES/NO
- Butterflies: YES/NO
Final answer: VIOLATION or COMPLIANT`;
async function testNow() {
console.log('\n═══════════════════════════════════════════════════════');
console.log('🔍 TESTING AI IMAGE ANALYSIS RIGHT NOW');
console.log('═══════════════════════════════════════════════════════');
console.log(`Product: ${title}`);
console.log(`Image: ${imageUrl}`);
console.log('\nExpected: VIOLATION (has banana leaves AND grapes)');
console.log('═══════════════════════════════════════════════════════\n');
try {
const response = await anthropic.messages.create({
model: 'claude-3-opus-20240229',
max_tokens: 1024,
messages: [{
role: 'user',
content: [
{
type: 'image',
source: {
type: 'url',
url: imageUrl
}
},
{
type: 'text',
text: prompt
}
]
}]
});
const analysisText = response.content[0].type === 'text' ? response.content[0].text : '';
const isViolation = analysisText.includes('VIOLATION') && !analysisText.includes('COMPLIANT');
console.log('═══════════════════════════════════════════════════════');
console.log(`RESULT: ${isViolation ? '🚨 VIOLATION' : '❌ COMPLIANT'}`);
console.log('═══════════════════════════════════════════════════════\n');
console.log(analysisText);
console.log('\n═══════════════════════════════════════════════════════');
if (isViolation) {
console.log('\n✅ ✅ ✅ SUCCESS! AI correctly identified as VIOLATION');
} else {
console.log('\n❌ ❌ ❌ FAILURE! AI incorrectly said COMPLIANT');
console.log('The AI is NOT seeing banana leaves and grapes in the image!');
}
} catch (error) {
console.error('ERROR:', error);
}
}
testNow();