(body: any)
| 82 | createdDate: Date |
| 83 | |
| 84 | static toEntity(body: any): Evaluator { |
| 85 | const newDs = new Evaluator() |
| 86 | Object.assign(newDs, stripProtectedFields(body)) |
| 87 | let config: any = {} |
| 88 | if (body.type === 'llm') { |
| 89 | config = { |
| 90 | prompt: body.prompt, |
| 91 | outputSchema: body.outputSchema |
| 92 | } |
| 93 | } else if (body.type === 'text') { |
| 94 | config = { |
| 95 | operator: body.operator, |
| 96 | value: body.value |
| 97 | } |
| 98 | } else if (body.type === 'json') { |
| 99 | config = { |
| 100 | operator: body.operator |
| 101 | } |
| 102 | } else if (body.type === 'numeric') { |
| 103 | config = { |
| 104 | operator: body.operator, |
| 105 | value: body.value, |
| 106 | measure: body.measure |
| 107 | } |
| 108 | } else { |
| 109 | throw new Error('Invalid evaluator type') |
| 110 | } |
| 111 | newDs.config = JSON.stringify(config) |
| 112 | return newDs |
| 113 | } |
| 114 | |
| 115 | static fromEntity(entity: Evaluator): EvaluatorDTO { |
| 116 | const newDs = new EvaluatorDTO() |
no test coverage detected