def generate_context_for_replanner(
    tasks: Dict[int, LLMCompilerTask], joiner_thought: str
) -> str:
    """
    Generate context for replanning.

    Formatted like this.
    ```
    1. action 1
    Observation: xxx
    2. action 2
    Observation: yyy
    ...
    Thought: joinner_thought
    ```
    """
    previous_plan_and_observations = "\n".join(
        [
            task.get_thought_action_observation(
                include_action=True, include_action_idx=True
            )
            for task in tasks.values()
            if not task.is_join
        ]
    )
    joiner_thought = f"Thought: {joiner_thought}"
    # use f-string instead
    return f"{previous_plan_and_observations}\n\n{joiner_thought}"

    Generate context for replanning.

    Formatted like this.
    ```
    1. action 1
    Observation: xxx
    2. action 2
    Observation: yyy
    ...
    Thought: joinner_thought
    ```
    
llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/utils.py