upgrade langfuse

This commit is contained in:
2026-08-12 22:17:56 +02:00
parent 2ffba19392
commit a5120d5153
8 changed files with 789 additions and 57 deletions

View File

@@ -1,11 +1,11 @@
import { Langfuse } from 'langfuse';
import { LangfuseClient } from '@langfuse/client';
import type { PromptFetcher, RawPrompt } from './PromptGateway';
export class LangfusePromptGateway implements PromptFetcher {
private readonly client: Langfuse;
private readonly client: LangfuseClient;
constructor(opts: { publicKey: string; secretKey: string; baseUrl: string }) {
this.client = new Langfuse({
this.client = new LangfuseClient({
publicKey: opts.publicKey,
secretKey: opts.secretKey,
baseUrl: opts.baseUrl,
@@ -13,7 +13,7 @@ export class LangfusePromptGateway implements PromptFetcher {
}
async fetch(promptName: string): Promise<RawPrompt> {
const prompt = await this.client.getPrompt(promptName, undefined, { type: 'chat', cacheTtlSeconds: 0 });
const prompt = await this.client.prompt.get(promptName, { type: 'chat' });
return {
name: prompt.name,
version: prompt.version,