Skip to content

@gettoor/core v0.1.0


@gettoor/core v0.1.0

Errors

ClassDescription
BadRequestToorErrorThrown when a request is invalid.
MissingApiKeyErrorThrown when a required API key is missing.
NotFoundToorErrorThrown when a resource is not found.
ToorErrorA base class for errors.

Experimentation

NameDescription
DatasetEntryEvaluationMetricsDataset entry evaluation metrics.
EvaluatorBinaryInputInput for the binary evaluator.
EvaluatorScalarInputInput for the scalar evaluator.
ExperimentExperiment settings and configuration.
ExperimentDatasetEntryExperiment dataset entry.
ExperimentDatasetEntryEvaluationCompletedInputOutput for the datasetEntryEvaluationCompleted listener.
ExperimentEvaluationCompletedInputInput for the evaluationCompleted listener.
ExperimentEvaluatorInputInput for an experiment evaluator.
ExperimentEvaluatorOutputOutput for an experiment evaluator.
ExperimentListenerCommonInputInput for an experiment listener.
ExperimentListenersListeners for an experiment. A dataset entry evaluation is a single evaluation of a prompt and response. It comprises of: - Generating the response based on the prompt and dataset entry - Running the evaluation on the response
ExperimentModelExperiment model.
ExperimentModelParametersExperiment model parameters.
ExperimentPromptExperiment prompt.
ExperimentResponseGeneratedInputInput for the responseGenerated listener.
ExperimentResultExperiment result of a single evaluation.
ExperimentScoreScore for a single evaluation.
ExperimentSettingsExperiment settings.
ExperimentStructuredOutputExperiment structured output.
ToExperimentScoreInputInput for toExperimentScore.
ExperimentDatasetEntryEvaluationStartedInputInput for the datasetEntryEvaluationStarted listener.
ExperimentDatasetVarValueExperiment dataset variable value.
ExperimentEvaluatorExperiment evaluator.
ExperimentGeneratingResponseInputInput for the generatingResponse listener.
ExperimentRunningEvaluationInputInput for the runningEvaluation listener.
ExperimentStructuredOutputFormatExperiment structured output format.
binaryEvaluatorCreates a binary experiment evaluator.
runExperimentRuns an experiment.
scalarEvaluatorCreates a scalar experiment evaluator.
toExperimentScoreConverts an input to an experiment score.
toModelParametersConverts experiment model parameters to model parameters.

LLM

InterfaceDescription
LLMUsageUsage information for a language model.
MetricResultResult for a single metric.
ModelParametersModel parameters for the LLM-as-a-judge.

LLM-as-a-judge

NameDescription
BinaryInputInput for the binary evaluation.
BinaryOutputOutput for the binary evaluation.
OutputOutput for the LLM-as-a-judge.
ScalarInputInput for the scalar evaluation.
ScalarMetricA metric for the scalar evaluation.
ScalarOutputOutput for the scalar evaluation.
ScalarResultResult for the scalar evaluation.
ScalarScoringScaleA scoring scale for the scalar evaluation.
BINARY_PROMPTThe default prompt to use for the binary evaluation. It takes the placeholders: - <<prompt>>: The prompt to evaluate. - <<response>>: The response to evaluate.
SCALAR_METRIC_ACTIONABILITYCan the user act on the answer?
SCALAR_METRIC_CLARITYIs it easy to understand?
SCALAR_METRIC_COHERENCEDoes it flow logically and remain internally consistent?
SCALAR_METRIC_COMPLETENESSDoes it cover everything important?
SCALAR_METRIC_CONCISENESSIs it appropriately brief without unnecessary content?
SCALAR_METRIC_CORRECTNESSIs the answer factually accurate?
SCALAR_METRIC_GRAMMARIs it free of spelling, grammar, and punctuation errors?
SCALAR_METRIC_HELPFULNESSDoes it actually help the user accomplish their goal?
SCALAR_METRIC_INSTRUCTION_FOLLOWINGDid it obey all instructions and constraints?
SCALAR_METRIC_REASONING_QUALITYIs the reasoning clear and logical?
SCALAR_METRIC_RELEVANCEDoes it address the user's request?
SCALAR_METRIC_SAFETYDoes it avoid harmful or policy-violating content?
SCALAR_PROMPTThe default prompt to use for the scalar evaluation. It takes the parameters (each in double curly braces): - <<prompt>>: The prompt to evaluate. - <<response>>: The response to evaluate. - <<scoring_scale>>: The scoring scale to use.
SCALAR_SCORING_1_10Fine-grained scale (1-10) for the scalar evaluation.
SCALAR_SCORING_1_3Coarse-grained scale (1-3) for the scalar evaluation.
SCALAR_SCORING_1_5Likert scale (1-5) for the scalar evaluation.
SCALAR_SCORING_DEFAULTThe default scoring scale for the scalar evaluation.
binaryEvaluates a response against a prompt using a language model with score either 0 (failed) or 1 (passed).
scalarScores a response against a prompt using a language model.

Math

FunctionDescription
averageCalculates the average of an array of numbers.
medianCalculates the median of an array of numbers.

Model Provider

NameDescription
DefaultModelProviderA default model provider implementation. Supports Gemini, OpenAI and Anthropic.
ModelNotFoundErrorError thrown when a model is not found.
ModelProviderA model provider. The returned LanguageModel comes from AI SDK.

Other

FunctionDescription
buildModelCallSettings-

Utils

NameDescription
InvalidFormatForObjectErrorError thrown when an invalid format is provided for an object placeholder.
InvalidPlaceholderFormatErrorError thrown when an invalid format is provided for a placeholder.
MissingPlaceholderErrorError thrown when a placeholder is missing.
NoValueForPlaceholderErrorError thrown when no value is provided for a placeholder.
UnknownPlaceholdersErrorError thrown when unknown placeholders are present in a string.
ReplacePlaceholderOutputOutput of the replacePlaceholders function.
findPlaceholdersFinds placeholders in a string.
rejectUnknownPlaceholdersRejects unknown placeholders in a string.
replacePlaceholdersReplaces placeholders in a string with values. The placeholders are of the form <key> in the string.
requirePlaceholdersValidates that the required placeholders are present in the text.