What
Introduce a Langfuse::PromptTemplate class that wraps a fetched prompt and provides a typed compile(variables: {}) method for {{variable}}-style interpolation on the client side.
Why
Currently, callers must implement variable substitution themselves after calling client.prompts.get. A typed wrapper improves ergonomics, catches missing variable errors early, and makes prompt usage consistent. The current prompts.compile method calls POST /v2/prompts/compile, which is a non-standard endpoint not present in the official Langfuse API spec — replacing it with client-side interpolation removes this dependency.
Effort estimate
M (2–3 days) — implement the class, handle both text and chat prompt types, add validation for missing/extra variables, and write specs.
What
Introduce a
Langfuse::PromptTemplateclass that wraps a fetched prompt and provides a typedcompile(variables: {})method for{{variable}}-style interpolation on the client side.Why
Currently, callers must implement variable substitution themselves after calling
client.prompts.get. A typed wrapper improves ergonomics, catches missing variable errors early, and makes prompt usage consistent. The currentprompts.compilemethod callsPOST /v2/prompts/compile, which is a non-standard endpoint not present in the official Langfuse API spec — replacing it with client-side interpolation removes this dependency.Effort estimate
M (2–3 days) — implement the class, handle both
textandchatprompt types, add validation for missing/extra variables, and write specs.