Skip to content

Commit 287abc3

Browse files
chore: make omitted fields a const
1 parent 2ebacd6 commit 287abc3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/accuracy/sdk/accuracy-result-storage/mongodb-storage.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ import {
88
ModelResponse,
99
} from "./result-storage.js";
1010

11+
// Omitting these as they might contain large chunk of texts
12+
const OMITTED_MODEL_RESPONSE_FIELDS: (keyof ModelResponse)[] = ["messages", "text"];
13+
1114
export class MongoDBBasedResultStorage implements AccuracyResultStorage {
1215
private client: MongoClient;
1316
private resultCollection: Collection<AccuracyResult>;
1417

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) {
2219
this.client = new MongoClient(connectionString);
2320
this.resultCollection = this.client.db(database).collection<AccuracyResult>(collection);
2421
}
@@ -63,7 +60,7 @@ export class MongoDBBasedResultStorage implements AccuracyResultStorage {
6360
modelResponse: ModelResponse;
6461
}): Promise<void> {
6562
const savedModelResponse: ModelResponse = { ...modelResponse };
66-
for (const field of this.omittedModelResponseFields) {
63+
for (const field of OMITTED_MODEL_RESPONSE_FIELDS) {
6764
delete savedModelResponse[field];
6865
}
6966

0 commit comments

Comments
 (0)