Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js): remove default created_at from createExample method. #1406

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2643,16 +2643,21 @@ export class Client implements LangSmithTracingClientInterface {
datasetId_ = dataset.id;
}

const createdAt_ = createdAt || new Date();
// Note: the created at time will be added by the langsmith server when not provided.
// This will ensure the timestamp will be of the standard langsmith datetime format.
// 2025-01-10T14:43:55.017298+00:00 i.e with 6 digits for fractional seconds.
const createdAt_ = createdAt
? new Date(createdAt).toISOString()
: undefined;
const data: ExampleCreate = {
dataset_id: datasetId_,
inputs,
outputs,
created_at: createdAt_?.toISOString(),
id: exampleId,
metadata,
split,
source_run_id: sourceRunId,
...(createdAt_ && { created_at: createdAt_ }),
};

const response = await this.caller.call(
Expand Down