#2 Upload: verify-context-windows.ts, test-import.ts

Creator:
abulka
Last Modified:
2025-11-21 14:16
Created:
2025-11-21 14:14
Source:
Uploaded Files
Files: verify-context-windows.ts, test-import.ts
1032 lines, 39.9 KB
Source Preview:
View first 100 lines
# verify-context-windows.ts
/**
 * Verify AI Service Configuration
 * 
 * This script verifies that the model configurations in serviceConfig.ts are accurate by:
 * 
 * 1. **Model ID Verification**: Checks that each configured model ID actually exists in the
 *    service's API endpoint (e.g., /models for OpenAI-compatible services).
 * 
 * 2. **Context Window Verification**: When available, verifies that the configured context_window
 *    values match what the API reports. Many services don't provide this data via API.
 * 
 * The script uses multiple data sources:
 * - Primary: Each service's own API endpoint
 * - Fallback: OpenRouter API (set OPENROUTER_API_KEY) for services that don't expose model info
 * 
 * Exit codes:
 * - 0: All model IDs verified (context mismatches or missing context data are OK)
 * - 1: Model IDs not found in API or context window mismatches detected
 * 
 * Usage: bun run verify-context-windows.ts

# test-import.ts
/**
 * Quick test to verify ai-doc exports work correctly
 */
import { callAiService, type AiConfig, type CallAiServiceOptions } from './src/index.js';

// Test with DummyAI (no network calls)
async function testAiDocImport() {
  const config: AiConfig = {
    activeService: "dummyai",
    models: {},
    apiKeys: {}
  };

  const options: CallAiServiceOptions = {
    serviceName: "dummyai",
    systemPrompt: "Test system prompt",
    userPrompt: "Test user prompt",
    sourceCode: "const x = 1;",
    settings: config
  };
AI Service:
(llama-3.3-70b-groq)
Tokens Used:
11291
Processing Time:
5.88083267211914 seconds
Tags:
typescript
Description:
Some code from GitUML itself. The typescript is being understood pretty well by the AI.
Visibility:
Public

AI Explanation