From 757733e201ff091f067666cc61c3a0527fa07a07 Mon Sep 17 00:00:00 2001 From: nenadnovovicqc Date: Fri, 13 Sep 2024 10:28:42 +0200 Subject: [PATCH 1/4] added contentType field --- src/testing/models.ts | 1 + src/util.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/testing/models.ts b/src/testing/models.ts index 16fc2b2..8adb817 100644 --- a/src/testing/models.ts +++ b/src/testing/models.ts @@ -90,6 +90,7 @@ export abstract class BaseEvaluator export interface HumanReviewField { name: string; value: string; + contentType?: string; } /** diff --git a/src/util.ts b/src/util.ts index e3b7ea6..4408c5e 100644 --- a/src/util.ts +++ b/src/util.ts @@ -22,6 +22,13 @@ export enum ThirdPartyEnvVar { GITHUB_TOKEN = 'GITHUB_TOKEN', } +export enum HumanReviewFieldContentType { + TEXT = 'text', + LINK = 'link', + HTML = 'html', + MARKDOWN = 'markdown', +} + export const readEnv = (key: string): string | undefined => { return process.env[key]; }; From 4b284de135edb1e2c781c0774d667b43c05ebb3d Mon Sep 17 00:00:00 2001 From: nenadnovovicqc Date: Fri, 13 Sep 2024 10:33:38 +0200 Subject: [PATCH 2/4] changed to enum --- src/testing/models.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/testing/models.ts b/src/testing/models.ts index 8adb817..1b176fc 100644 --- a/src/testing/models.ts +++ b/src/testing/models.ts @@ -1,4 +1,5 @@ import { ArbitraryProperties } from '../types'; +import { HumanReviewFieldContentType } from '../util'; export interface Threshold { lt?: number; @@ -90,7 +91,7 @@ export abstract class BaseEvaluator export interface HumanReviewField { name: string; value: string; - contentType?: string; + contentType?: HumanReviewFieldContentType; } /** From 6531e28f58da614ebf1109ef754b0c5dfe3d9c1e Mon Sep 17 00:00:00 2001 From: Adam Nolte Date: Fri, 13 Sep 2024 16:05:36 -0500 Subject: [PATCH 3/4] Export --- src/testing/index.ts | 2 ++ src/testing/models.ts | 8 +++++++- src/util.ts | 7 ------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/testing/index.ts b/src/testing/index.ts index da71fb1..d3c9cd7 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -11,6 +11,8 @@ export { type EvaluationOverrideComment, type EvaluationOverrideField, type ScoreChoice, + type HumanReviewField, + type HumanReviewFieldContentType, } from './models'; export { gridSearchAsyncLocalStorage } from '../asyncLocalStorage'; export { diff --git a/src/testing/models.ts b/src/testing/models.ts index 1b176fc..875504f 100644 --- a/src/testing/models.ts +++ b/src/testing/models.ts @@ -1,5 +1,4 @@ import { ArbitraryProperties } from '../types'; -import { HumanReviewFieldContentType } from '../util'; export interface Threshold { lt?: number; @@ -88,6 +87,13 @@ export abstract class BaseEvaluator }): Evaluation | Promise; } +export enum HumanReviewFieldContentType { + TEXT = 'text', + LINK = 'link', + HTML = 'html', + MARKDOWN = 'markdown', +} + export interface HumanReviewField { name: string; value: string; diff --git a/src/util.ts b/src/util.ts index 4408c5e..e3b7ea6 100644 --- a/src/util.ts +++ b/src/util.ts @@ -22,13 +22,6 @@ export enum ThirdPartyEnvVar { GITHUB_TOKEN = 'GITHUB_TOKEN', } -export enum HumanReviewFieldContentType { - TEXT = 'text', - LINK = 'link', - HTML = 'html', - MARKDOWN = 'markdown', -} - export const readEnv = (key: string): string | undefined => { return process.env[key]; }; From cbf71d92818739eb52a105dbc838893f923c8a37 Mon Sep 17 00:00:00 2001 From: Adam Nolte Date: Fri, 13 Sep 2024 16:06:19 -0500 Subject: [PATCH 4/4] update test --- src/testing/index.ts | 2 +- test/testing/run.spec.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/testing/index.ts b/src/testing/index.ts index d3c9cd7..ded08e5 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -12,7 +12,7 @@ export { type EvaluationOverrideField, type ScoreChoice, type HumanReviewField, - type HumanReviewFieldContentType, + HumanReviewFieldContentType, } from './models'; export { gridSearchAsyncLocalStorage } from '../asyncLocalStorage'; export { diff --git a/test/testing/run.spec.ts b/test/testing/run.spec.ts index 29a08cd..9a6477c 100644 --- a/test/testing/run.spec.ts +++ b/test/testing/run.spec.ts @@ -6,6 +6,7 @@ import { TracerEvent, BaseEvaluator, gridSearchAsyncLocalStorage, + HumanReviewFieldContentType, } from '../../src/testing'; import * as testingUtilModule from '../../src/testing/util'; import crypto from 'crypto'; @@ -1128,6 +1129,7 @@ describe('Testing SDK', () => { { name: 'y', value: `${testCase.x}`, + contentType: HumanReviewFieldContentType.MARKDOWN, }, { name: 'sum', @@ -1161,6 +1163,7 @@ describe('Testing SDK', () => { { name: 'y', value: '1', + contentType: HumanReviewFieldContentType.MARKDOWN, }, { name: 'sum',