feat: allow log supression when fetching prompt that doesn’t exist
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
@TomOfekKafka open for contributions on this! I think an optional flag on getPrompt that suppresses the log should be sufficient
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.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale. Please reopen if the issue persists.