Runtime prompt resolution retrieves a deployed prompt and its configuration during request processing instead of embedding behavioral instructions in application code. This separates stable authentication and model integration from changeable prompt behavior, enabling updates without application restarts or code deployments. section 13.1.2
A production implementation typically:
- Initializes the LLM with essential authentication and integration settings while deferring model, temperature, and token limits to managed configuration. section 13.1.2
- Fetches the production-labeled prompt, applies its configuration, compiles runtime variables such as context and query, and records the prompt version with the response. section 13.1.2
- Falls back to a boundary prompt when processing fails, returning helpful guidance instead of a cryptic error. section 13.1.2
Listing 13.5 Dynamic prompt fetching and configuration
class DakkaBotCore:
async def process_query(self, query: str) -> Dict[str, Any]:
try:
docs = ...
context = ...
prompt_obj = self.langfuse.get_prompt(
"dakkabot-system", #1
type="chat",
label="production" #2
)
prompt_config = prompt_obj.config #3
self.llm.model = prompt_config.get( #3
"model", "gemini-2.5-flash") #3
self.llm.temperature = prompt_config.get( #3
"temperature", 0.0) #3
Inspect the request-time retrieval and configuration flow that applies the production prompt to the LLM. section 13.1.2
