Skip to content

Commit

Permalink
forgot to add a file
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 committed Nov 8, 2024
1 parent f1b6eef commit 334451a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions js/src/evaluation/llm_evaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ interface LLMEvaluatorParams {
mapVariables?: (run: Run, example?: Example) => Record<string, any>;
modelName?: string;
modelProvider?: string;
reasoningKey?: string;
}

export class LLMEvaluator implements RunEvaluator {
Expand All @@ -150,7 +149,6 @@ export class LLMEvaluator implements RunEvaluator {
scoreConfig: ScoreConfig;
scoreSchema: Record<string, any>;
runnable: any;
reasoningKey: string;

constructor() {}

Expand Down Expand Up @@ -188,7 +186,7 @@ export class LLMEvaluator implements RunEvaluator {
} else {
this.prompt = ChatPromptTemplate.fromMessages(promptTemplate);
}

// Initialize the chat model with structured output
const chatModel = await initChatModel(modelName, {
modelProvider: modelProvider,
Expand Down Expand Up @@ -273,9 +271,9 @@ export class LLMEvaluator implements RunEvaluator {
output: Record<string, any>,
runId: string
): EvaluationResult {
const explanation = this.scoreConfig.reasoningKey ? output[this.scoreConfig.reasoningKey] : undefined;
if ("choices" in this.scoreConfig) {
const value = output.value;
const explanation = output[this.reasoningKey];
return {
key: this.scoreConfig.key,
value,
Expand All @@ -284,7 +282,6 @@ export class LLMEvaluator implements RunEvaluator {
};
} else {
const score = output.score;
const explanation = output[this.reasoningKey];
return {
key: this.scoreConfig.key,
score,
Expand Down

0 comments on commit 334451a

Please sign in to comment.