Executes the scraping process and returns the answer to the prompt. Returns: str: The answer to the prompt.
(self)
| 101 | ) |
| 102 | |
| 103 | def run(self) -> str: |
| 104 | """ |
| 105 | Executes the scraping process and returns the answer to the prompt. |
| 106 | |
| 107 | Returns: |
| 108 | str: The answer to the prompt. |
| 109 | """ |
| 110 | |
| 111 | inputs = {"user_prompt": self.prompt, self.input_key: self.source} |
| 112 | self.final_state, self.execution_info = self.graph.execute(inputs) |
| 113 | |
| 114 | audio = self.final_state.get("audio", None) |
| 115 | if not audio: |
| 116 | raise ValueError("No audio generated from the text.") |
| 117 | save_audio_from_bytes(audio, self.config.get("output_path", "output.mp3")) |
| 118 | logger.info("Audio saved to %s", self.config.get("output_path", "output.mp3")) |
| 119 | |
| 120 | return self.final_state.get("answer", "No answer found.") |
no test coverage detected