AI judges, people and notebooks =============================== Language-model clients ---------------------- Every judge talks to its model through a small client with one method, ``complete(request)``. The clients use the providers' HTTP APIs directly and need no SDK. .. list-table:: :header-rows: 1 :widths: 22 40 38 * - Client - Provider - API key (environment variable or Colab secret) * - ``AnthropicClient`` - Claude (Messages API, images as base64 PNG, structured JSON output) - ``ANTHROPIC_API_KEY`` * - ``OpenAIClient`` - OpenAI and every OpenAI-compatible server (vLLM, LM Studio, OpenRouter …) - ``OPENAI_API_KEY`` * - ``GeminiClient`` - Google Gemini (``generateContent``) - ``GEMINI_API_KEY`` or ``GOOGLE_API_KEY`` * - ``OllamaClient`` - local models through Ollama (e.g. LLaVA, Llama 3.2 Vision) - none * - ``MockJudgeClient`` - offline, scorer-driven fake model with controllable noise and biases - none ``make_client("anthropic", "claude-haiku-5-5", cache=".easyiec_cache")`` builds a client wrapped in a :class:`~easyiec.evaluators.CachedClient` that stores every answer on disk, so a rerun costs nothing and repeats exactly. Keys ---- Keep keys out of code and notebooks. In a shell, ``export ANTHROPIC_API_KEY=...``; in Google Colab, add a *secret* with the same name (key icon in the left bar) and give the notebook access to it. :func:`~easyiec.evaluators.llm.clients.get_api_key` looks in the environment and in Colab's secrets. A judge in four lines --------------------- .. code-block:: python from easyiec.evaluators import AnthropicClient, LLMJudge from easyiec.problems import ImageSegmentation judge = LLMJudge(AnthropicClient("claude-sonnet-5-5"), ImageSegmentation(), debias="reverse") result = ei.run(ImageSegmentation(), InteractiveGA(), judge, generations=8) Before such a judge replaces people, audit it (:func:`~easyiec.validation.audit_judge`, :func:`~easyiec.validation.psychometric_audit`) and compare it with people on the same queries (:func:`~easyiec.validation.compare_evaluators`, :func:`~easyiec.validation.alt_test`); the :doc:`book ` explains how. What the validation study found ------------------------------- ``tools/claude_validation.py`` measured Claude Haiku 5.5 and Claude Sonnet 5.5 on problems with an objective ground truth (the last chapter of the :doc:`book ` reports the tables and their interpretation): - On clearly different technical candidates (segmentations, PID step responses) Sonnet chose the better one in 85–91 % of the duels, between a careful and a noisy simulated person; Haiku in 65–73 %, mostly because its two presentation orders often disagreed. - With Sonnet as the evaluator an interactive GA tuned the segmentation pipeline as well as with a simulated user; Haiku favoured clean outlines over finding every cell and its sessions did not improve. - The 75 % discrimination thresholds for facial expression and segmentation quality were an order of magnitude above a careful observer's: near-equal candidates of a late gallery should go to the person. - The disagreement between the two presentation orders predicted the errors (AUROC 0.64–1.00), which makes it a usable uncertainty for escalation; a risk-controlled hybrid needs a calibration set sized by the Hoeffding bound before it starts saving human effort. Galleries for people -------------------- :class:`~easyiec.ui.JupyterGallery` runs in Jupyter, JupyterLab, VS Code and Colab. Click an image once to choose it as a parent, twice to keep it unchanged; *Next* sends the answer. With ``assistant=judge`` the *Ask AI* button pre-selects the AI's answer; with an :class:`~easyiec.evaluators.EscalationEvaluator` the gallery advances on its own while the AI is confident and stops for you when it is not. The comment box turns phrases such as *much brighter, slightly less contrast* into search directions. :class:`~easyiec.ui.MatplotlibGallery` is the desktop counterpart in the style of the MATLAB toolbox, with draggable knots for editable problems.