Skip to content

Display prompt parameters in traces when using langfuse prompt management #4543

Discussion options

You must be logged in to vote

Thanks for sharing! Capturing prompt variables within a prompt template more naturally would be very useful, and we've discussed this a couple of times already. For a non-Langfuse prompt, it is challenging to distinguish between variables and the more fixed elements of the prompt.

If you use Langfuse Prompt Management, you can wrap the compile method with the Langfuse decorator like this and then use it throughout your code:

@observe()
def compile_prompt(prompt, **kwargs):
   return prompt.compile(**kwargs)


@observe()
def main():
   prompt = langfuse.get_prompt("test")
   compiled_prompt = compile_prompt(prompt, foo="bar", i="u")
   # llm call

Note: This works similarly via the python/j…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@RichardSieg
Comment options

@marcklingen
Comment options

@RichardSieg
Comment options

@marcklingen
Comment options

@marcklingen
Comment options

Answer selected by marcklingen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment