| 31 | """ |
| 32 | |
| 33 | def __init__( |
| 34 | self, |
| 35 | input: str, |
| 36 | output: List[str], |
| 37 | node_config: Optional[dict] = None, |
| 38 | node_name: str = "PromptRefiner", |
| 39 | ): |
| 40 | super().__init__(node_name, "node", input, output, 2, node_config) |
| 41 | |
| 42 | self.llm_model = node_config["llm_model"] |
| 43 | |
| 44 | if isinstance(node_config["llm_model"], ChatOllama): |
| 45 | self.llm_model.format = "json" |
| 46 | |
| 47 | self.verbose = ( |
| 48 | True if node_config is None else node_config.get("verbose", False) |
| 49 | ) |
| 50 | self.force = False if node_config is None else node_config.get("force", False) |
| 51 | |
| 52 | self.additional_info = node_config.get("additional_info", None) |
| 53 | |
| 54 | self.output_schema = node_config.get("schema") |
| 55 | |
| 56 | def execute(self, state: dict) -> dict: |
| 57 | """ |