Display prompt parameters in traces when using langfuse prompt management #4543
-
Hi there. Most of our prompts are compiled with special parameters. When looking at a trace I would like to be able to see the parameter values with which the prompt was compiled - preferably in the list of parameter tags for that trace (e.g. model, temperature etc). Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
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/js low-level SDKs by creating a span for this. Let me know if this helps! |
Beta Was this translation helpful? Give feedback.
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:
Note: This works similarly via the python/j…