How do I fetch raw prompt text that contains references to other prompts? #10037
-
|
Hi, I’m developing a script that synchronizes prompts between Langfuse projects using the Python SDK. My system relies on prompt references - that is, prompts built from other Langfuse prompts, as described in your composability documentation. When I fetch a prompt using either the Python SDK or the REST API, the prompt text I receive is already resolved. This makes it unsuitable as a source for synchronization, since I need the original (unresolved) prompt text. Is there a way to access the raw, unresolved prompt text through the SDK or API? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Based on the available documentation, when you fetch prompts via the SDK or API, Langfuse automatically resolves prompt references before returning the content(1). The documentation does not describe a method to retrieve the raw, unresolved prompt text that contains the reference tags (like The prompt composability feature is designed so that "when fetched via the SDK / API, these tags are automatically replaced with the referenced prompt content"(2). This automatic resolution happens at fetch time and appears to be the standard behavior across both the Python SDK and the REST API(1)(3)(2). For your synchronization use case, where you need the original unresolved prompt text, this automatic resolution creates a challenge. The documentation doesn't mention a parameter or flag to disable this resolution behavior when fetching prompts. I'd recommend checking out these potentially helpful resources: Would you like me to provide a general answer based on my broader knowledge of how similar systems typically handle this? 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @mturzynski-xelerit, this is currently on our roadmap - we are tracking this here: https://github.com/orgs/langfuse/discussions/9546 |
Beta Was this translation helpful? Give feedback.
-
|
Hi all, we have shipped this, you can now pass a resolve query param to your v2 Prompts API call: https://api.reference.langfuse.com/#tag/prompts/GET/api/public/v2/prompts/{promptName} |
Beta Was this translation helpful? Give feedback.
Hi @mturzynski-xelerit, this is currently on our roadmap - we are tracking this here: https://github.com/orgs/langfuse/discussions/9546