Skip to main content
Glama

@arizeai/phoenix-mcp

Official
by Arize-ai
ClassificationEvaluator.ts1.31 kB
import { CreateClassificationEvaluatorArgs, EvaluatorFn, Template, } from "../types"; import { createClassifierFn } from "./createClassifierFn"; import { LLMEvaluator } from "./LLMEvaluator"; import { getTemplateVariables } from "../template"; /** * An LLM evaluator that performs evaluation via classification */ export class ClassificationEvaluator< RecordType extends Record<string, unknown>, > extends LLMEvaluator<RecordType> { readonly evaluatorFn: EvaluatorFn<RecordType>; readonly promptTemplate: Template; private _promptTemplateVariables: string[] | undefined; constructor(args: CreateClassificationEvaluatorArgs) { super(args); this.promptTemplate = args.promptTemplate; this.evaluatorFn = createClassifierFn<RecordType>(args); } evaluate = (example: RecordType) => { return this.evaluatorFn(example); }; /** * List out the prompt template variables needed to perform evaluation */ get promptTemplateVariables(): string[] { // Use dynamic programming to see if it's computed already if (!Array.isArray(this._promptTemplateVariables)) { this._promptTemplateVariables = getTemplateVariables({ template: this.promptTemplate, }); } // Give a copy of the variables return [...this._promptTemplateVariables]; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Arize-ai/phoenix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server