File size: 514 Bytes
6835659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from __future__ import annotations

from src.planner.schema_to_text import plan_to_canonical_text
from .generator import TextGenerator


class PlanToText:
    def __init__(self):
        self.generator = TextGenerator()

    def run(self, semantic_plan) -> str:
        prompt = (
            "Write a vivid but concise description based on the following plan:\n\n"
            f"{plan_to_canonical_text(semantic_plan)}\n\n"
            "Description:"
        )
        return self.generator.generate(prompt).text