MCPcopy Create free account
hub / github.com/openai/plugins / collectSnapshots

Function collectSnapshots

plugins/plugin-eval/src/core/observed-usage.js:122–143  ·  view source on GitHub ↗
(value, sourcePath, results)

Source from the content-addressed store, hash-verified

120}
121
122function collectSnapshots(value, sourcePath, results) {
123 if (Array.isArray(value)) {
124 value.forEach((item) => collectSnapshots(item, sourcePath, results));
125 return;
126 }
127
128 if (!value || typeof value !== "object") {
129 return;
130 }
131
132 const snapshot = normalizeSnapshot(value, sourcePath, results.length);
133 if (snapshot) {
134 results.push(snapshot);
135 return;
136 }
137
138 Object.values(value).forEach((nested) => {
139 if (nested && typeof nested === "object") {
140 collectSnapshots(nested, sourcePath, results);
141 }
142 });
143}
144
145function parseUsageContent(content) {
146 const trimmed = content.trim();

Callers 1

loadSnapshotsFromFileFunction · 0.85

Calls 2

normalizeSnapshotFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected