Skip to content

Commit f1e0c3b

Browse files
committed
fix(llmobs): preserve dataset update fields
1 parent 6a7f58f commit f1e0c3b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/dd-trace/src/llmobs/experiments/dataset.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ function serializedRecord (record) {
3939
function serializedRecordUpdate (update) {
4040
const output = { id: update.id }
4141
if (Object.hasOwn(update, 'input') && update.input !== undefined) output.input = update.input
42+
if (Object.hasOwn(update, 'expectedOutput') && update.expectedOutput !== undefined) {
43+
output.expected_output = update.expectedOutput
44+
}
4245
if (Object.hasOwn(update, 'metadata') && update.metadata !== undefined) output.metadata = update.metadata
4346
if (Object.hasOwn(update, 'tagOperations')) {
4447
output.tag_operations = serializedTagOperations(update.tagOperations)
@@ -233,6 +236,7 @@ class Dataset {
233236
if (this.#newRecordsById.has(record.id)) return this
234237

235238
const update = this.#updatedRecordsById.get(record.id) ?? { id: record.id }
239+
for (const field of providedFields) update[field] = record[field]
236240
if (this.#pendingTagOperations.has(record.id)) {
237241
update.tagOperations = this.#pendingTagOperations.get(record.id)
238242
}

packages/dd-trace/test/llmobs/experiments/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ describe('LLMObs Experiments facade', () => {
344344
})
345345
await assert.rejects(
346346
() => createExperiments(enabledConfig()).pullDataset('remote-dataset', { maxWaitMs: 0 }),
347-
/Dataset records pulled from the backend must have an id/
347+
/backend returned a record without an id/
348348
)
349349

350350
stubPullDatasetClientForRetry({

0 commit comments

Comments
 (0)