langfuse icon indicating copy to clipboard operation
langfuse copied to clipboard

feat: allow log supression when fetching prompt that doesn’t exist

Open marcklingen opened this issue 11 months ago • 2 comments

Discussed in https://github.com/orgs/langfuse/discussions/6477

Originally posted by TomOfekKafka April 16, 2025

Describe the feature or potential improvement

I implemented the integration with Langfuse as follows: At system startup, try to fetch all prompts from langfuse (list of prompt names is maintained in code). For each prompt name in the list: If you couldn't fetch it from langfuse, use the local version (my logic is a bit more complex but this is enough for the sake of my request).

So in my use case, having the prompt not found in langfuse is a very normal, expected scenario. What I see in my app's logs is that I get error logs from langfuse SDK for whenever it couldn't find the prompt. I don't want that since this behavior is expected.

Now imagine I have 30 prompts - I will have the log flooded with errors although everything is ok and stable. Here is an example of a an error:

[Langfuse SDK] Error while fetching prompt 'files-metadata-prompt:dev-label:production': Error: Prompt not found: 'files-metadata-prompt:dev' with label 'production'

All calls to langfuse are wrapped in try/catch blocks in my code. I am using typescript SDK

marcklingen avatar Apr 16 '25 10:04 marcklingen

@TomOfekKafka open for contributions on this! I think an optional flag on getPrompt that suppresses the log should be sufficient

marcklingen avatar Apr 16 '25 10:04 marcklingen

Thanks for sharing the issue @marcklingen @TomOfekKafka. I have raised a PR to address this issue by adding a flag called suppressNotFoundLog in the getPrompt signature which suppresses the error logs when prompt doesn't exist in the db. Would love your comments on the same. Thanks.

Deeptanshu-sankhwar avatar May 07 '25 21:05 Deeptanshu-sankhwar

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 18 '25 02:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. Please reopen if the issue persists.

github-actions[bot] avatar Jul 15 '25 02:07 github-actions[bot]