class_docstr: DynamicPromptBuilder is designed to construct dynamic prompts for the pipeline. Users can change the prompt
  template at runtime by providing a new template for each pipeline run invocation if needed.
  
  The following example demonstrates how to use the DynamicPromptBuilder:
  
  ```python
  from typing import List
  from haystack.components.builders import DynamicPromptBuilder
  from haystack.components.generators import OpenAIGenerator
  from haystack import Pipeline, component, Document
  
  prompt_builder = DynamicPromptBuilder(runtime_variables=["documents"])
  llm = OpenAIGenerator(api_key="<your-api-key>", model="gpt-3.5-turbo")
  
  
  @component
  class DocumentProducer:
  
      @component.output_types(documents=List[Document])
      def run(self, doc_input: str):
          return {"documents": [Document(content=doc_input)]}
  
  
  pipe = Pipeline()
  pipe.add_component("doc_producer", DocumentProducer())
  pipe.add_component("prompt_builder", prompt_builder)
  pipe.add_component("llm", llm)
  pipe.connect("doc_producer.documents", "prompt_builder.documents")
  pipe.connect("prompt_builder.prompt", "llm.prompt")
  
  template = "Here is the document: {{documents[0].content}} \n Answer: {{query}}"
  result = pipe.run(
      data={
          "doc_producer": {"doc_input": "Hello world, I live in Berlin"},
          "prompt_builder": {
              "prompt_source": template,
              "template_variables": {"query": "Where does the speaker live?"},
          },
      }
  )
  print(result)
  
  >> {'llm': {'replies': ['The speaker lives in Berlin.'],
  >> 'meta': [{'model': 'gpt-3.5-turbo-0613',
  >> 'index': 0,
  >> 'finish_reason': 'stop',
  >> 'usage': {'prompt_tokens': 28,
  >> 'completion_tokens': 6,
  >> 'total_tokens': 34}}]}}
  
  Note how in the example above, we can dynamically change the prompt template by providing a new template to the
  run method of the pipeline. This dynamic prompt generation is in stark contrast to the static prompt generation
  using `PromptBuilder`, where the prompt template is fixed for the pipeline's lifetime and cannot be changed
  for each pipeline run invocation.
docstr: Initializes DynamicPromptBuilder with the provided variable names. These variable names are used to resolve
  variables and their values during pipeline runtime execution. For example, if `runtime_variables` contains
  `documents` your instance of DynamicPromptBuilder will expect an input called `documents`.
  The values associated with variables from the pipeline runtime are then injected into template placeholders
  of a string template that is provided to the `run` method.
  
  :param runtime_variables: A list of template variable names you can use in chat prompt construction.
  :type runtime_variables: Optional[List[str]]
docstr_tok: ["Initializes","DynamicPromptBuilder","with","the","provided","variable","names",".","These","variable","names","are","used","to","resolve","variables","and","their","values","during","pipeline","runtime","execution",".","For","example",",","if","`","runtime_variables","`","contains","`","documents","`","your","instance","of","DynamicPromptBuilder","will","expect","an","input","called","`","documents","`",".","The","values","associated","with","variables","from","the","pipeline","runtime","are","then","injected","into","template","placeholders","of","a","string","template","that","is","provided","to","the","`","run","`","method",".",":","param","runtime_variables",":","A","list","of","template","variable","names","you","can","use","in","chat","prompt","construction",".",":","type","runtime_variables",":","Optional","[","List","[","str","]","]"]
code: def __init__(self, runtime_variables: Optional[List[str]] = None):
      """
      Initializes DynamicPromptBuilder with the provided variable names. These variable names are used to resolve
      variables and their values during pipeline runtime execution. For example, if `runtime_variables` contains
      `documents` your instance of DynamicPromptBuilder will expect an input called `documents`.
      The values associated with variables from the pipeline runtime are then injected into template placeholders
      of a string template that is provided to the `run` method.
  
      :param runtime_variables: A list of template variable names you can use in chat prompt construction.
      :type runtime_variables: Optional[List[str]]
      """
      runtime_variables = runtime_variables or []
  
      # setup inputs
      run_input_slots = {
          "prompt_source": str,
          "template_variables": Optional[Dict[str, Any]],
      }
      kwargs_input_slots = {
          var: Optional[Any] for var in runtime_variables
      }
      component.set_input_types(
          self, **run_input_slots, **kwargs_input_slots
      )
  
      # setup outputs
      component.set_output_types(self, prompt=str)
  
      self.runtime_variables = runtime_variables
  
imports: import logging
  from typing import Dict, Any, Optional, List, Set
  from jinja2 import Template, meta
  from haystack import component
label_desc: Use image node_id 1 to create a new DynamicPromptBuilder object  with example: obj = DynamicPromptBuilder(runtime_variables)