• Preparing search index...
  • The search index is not available
Arize Phoenix TS
  • Arize Phoenix TS
  • @arizeai/phoenix-evals
  • llm/createDocumentRelevanceEvaluator
  • createDocumentRelevanceEvaluator

Function createDocumentRelevanceEvaluator

  • createDocumentRelevanceEvaluator<
        RecordType extends
            Record<string, unknown> = DocumentRelevanceEvaluationRecord,
    >(
        args: DocumentRelevanceEvaluatorArgs<RecordType>,
    ): ClassificationEvaluator<RecordType>

    Creates a document relevance evaluator function.

    This function returns an evaluator that determines whether a given document text is relevant to a provided input question. The evaluator uses a classification model and a prompt template to make its determination.

    Type Parameters

    • RecordType extends Record<string, unknown> = DocumentRelevanceEvaluationRecord

    Parameters

    • args: DocumentRelevanceEvaluatorArgs<RecordType>

      The arguments for creating the document relevance evaluator.

      • Optionalchoices?: ClassificationChoicesMap
      • OptionalinputMapping?: ObjectMapping<RecordType>

        The mapping of the input to evaluate to the shape that the evaluator expects

      • model: LanguageModel
      • Optionalname?: string
      • OptionaloptimizationDirection?: OptimizationDirection
      • OptionalpromptTemplate?: PromptTemplate
      • Optionaltelemetry?: TelemetryConfig

    Returns ClassificationEvaluator<RecordType>

    An evaluator function that takes a DocumentRelevanceExample and returns a classification result indicating whether the document is relevant to the input question.

    Example

    const evaluator = createDocumentRelevanceEvaluator({ model: openai("gpt-4o-mini") });
    const result = await evaluator.evaluate({
    input: "What is the capital of France?",
    documentText: "Paris is the capital and most populous city of France.",
    });
    console.log(result.label); // "relevant" or "unrelated"
    • Defined in llm/createDocumentRelevanceEvaluator.ts:57

Settings

Member Visibility
Arize Phoenix TS
  • Loading...

Generated using TypeDoc