Skip to content

Commit

Permalink
Deprecate runName
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd committed Jul 19, 2024
1 parent 9ba160d commit e7214ec
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions js/src/wrappers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,9 @@ const _wrapClient = <T extends object>(
if (typeof originalValue === "function") {
return traceable(
originalValue.bind(target),
Object.assign(
{ name: [runName, propKey.toString()].join("."), run_type: "llm" },
options
)
Object.assign({ run_type: "llm" }, options, {
name: [runName, propKey.toString()].join("."),
})
);
} else if (
originalValue != null &&
Expand All @@ -313,7 +312,12 @@ const _wrapClient = <T extends object>(
};

type WrapSDKOptions = Partial<
Omit<RunTreeConfig, "name"> & { runName: string }
RunTreeConfig & {
/**
* @deprecated Use `name` instead.
*/
runName: string;
}
>;

/**
Expand All @@ -332,11 +336,14 @@ export const wrapSDK = <T extends object>(
options?: WrapSDKOptions
): T => {
const traceableOptions = options ? { ...options } : undefined;
if (traceableOptions != null) delete traceableOptions.runName;
if (traceableOptions != null) {
delete traceableOptions.runName;
delete traceableOptions.name;
}

return _wrapClient(
sdk,
options?.runName ?? sdk.constructor?.name,
options?.name ?? options?.runName ?? sdk.constructor?.name,
traceableOptions
);
};

0 comments on commit e7214ec

Please sign in to comment.