MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / toEntity

Method toEntity

packages/server/src/Interface.Evaluation.ts:84–113  ·  view source on GitHub ↗
(body: any)

Source from the content-addressed store, hash-verified

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()

Callers 4

createDocumentStoreFunction · 0.45
upsertDocStoreFunction · 0.45
createEvaluatorFunction · 0.45
updateEvaluatorFunction · 0.45

Calls 2

stripProtectedFieldsFunction · 0.90
stringifyMethod · 0.80

Tested by

no test coverage detected