File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
tests/accuracy/sdk/accuracy-result-storage Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,14 @@ import {
8
8
ModelResponse ,
9
9
} from "./result-storage.js" ;
10
10
11
+ // Omitting these as they might contain large chunk of texts
12
+ const OMITTED_MODEL_RESPONSE_FIELDS : ( keyof ModelResponse ) [ ] = [ "messages" , "text" ] ;
13
+
11
14
export class MongoDBBasedResultStorage implements AccuracyResultStorage {
12
15
private client : MongoClient ;
13
16
private resultCollection : Collection < AccuracyResult > ;
14
17
15
- constructor (
16
- connectionString : string ,
17
- database : string ,
18
- collection : string ,
19
- // Omitting these as they might contain large chunk of texts
20
- private readonly omittedModelResponseFields : ( keyof ModelResponse ) [ ] = [ "messages" , "text" ]
21
- ) {
18
+ constructor ( connectionString : string , database : string , collection : string ) {
22
19
this . client = new MongoClient ( connectionString ) ;
23
20
this . resultCollection = this . client . db ( database ) . collection < AccuracyResult > ( collection ) ;
24
21
}
@@ -63,7 +60,7 @@ export class MongoDBBasedResultStorage implements AccuracyResultStorage {
63
60
modelResponse : ModelResponse ;
64
61
} ) : Promise < void > {
65
62
const savedModelResponse : ModelResponse = { ...modelResponse } ;
66
- for ( const field of this . omittedModelResponseFields ) {
63
+ for ( const field of OMITTED_MODEL_RESPONSE_FIELDS ) {
67
64
delete savedModelResponse [ field ] ;
68
65
}
69
66
You can’t perform that action at this time.
0 commit comments