Skip to content

Commit

Permalink
Merge branch 'main' into v3-cost-tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp authored Dec 16, 2024
2 parents 7ec9bc7 + 8d4b973 commit 77ea34b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions langfuse-core/src/release-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const common_release_envs = [
"REACT_APP_GIT_SHA",
// Heroku
"SOURCE_VERSION",
// Trigger.dev
"TRIGGER_DEPLOYMENT_ID",
] as const;

export function getCommonReleaseEnvs(): string | undefined {
Expand Down
3 changes: 2 additions & 1 deletion langfuse/src/openai/observeOpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export const observeOpenAI = <SDKType extends object>(

const defaultGenerationName = `${sdk.constructor?.name}.${propKey.toString()}`;
const generationName = langfuseConfig?.generationName ?? defaultGenerationName;
const config = { ...langfuseConfig, generationName };
const traceName = langfuseConfig && "traceName" in langfuseConfig ? langfuseConfig.traceName : generationName;
const config = { ...langfuseConfig, generationName, traceName };

// Add a flushAsync method to the OpenAI SDK that flushes the Langfuse client
if (propKey === "flushAsync") {
Expand Down
1 change: 1 addition & 0 deletions langfuse/src/openai/traceMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const wrapMethod = async <T extends GenericMethod>(
...config,
...observationData,
id: config?.traceId,
name: config?.traceName,
timestamp: observationData.startTime,
});
}
Expand Down
6 changes: 5 additions & 1 deletion langfuse/src/openai/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ type LangfuseGenerationConfig = Pick<
"metadata" | "version" | "promptName" | "promptVersion"
>;

export type LangfuseNewTraceConfig = LangfuseTraceConfig & { traceId?: string; clientInitParams?: LangfuseInitParams };
export type LangfuseNewTraceConfig = LangfuseTraceConfig & {
traceId?: string;
traceName?: string;
clientInitParams?: LangfuseInitParams;
};
export type LangfuseParent = LangfuseTraceClient | LangfuseSpanClient | LangfuseGenerationClient;
export type LangfuseWithParentConfig = LangfuseGenerationConfig & { parent: LangfuseParent };

Expand Down

0 comments on commit 77ea34b

Please sign in to comment.