Edits a draft of a poem, providing feedback
(state: State)
| 80 | |
| 81 | @action(reads=["current_draft", "poem_type", "prompt"], writes=["feedback"]) |
| 82 | def edit(state: State) -> Tuple[dict, State]: |
| 83 | """Edits a draft of a poem, providing feedback""" |
| 84 | poem_subject = state["prompt"] |
| 85 | poem_type = state["poem_type"] |
| 86 | current_draft = state["current_draft"] |
| 87 | |
| 88 | prompt = f""" |
| 89 | You are an AI poetry critic. Review the following {poem_type} poem based on the subject: "{poem_subject}". |
| 90 | Here is the current draft of the poem: "{current_draft}". |
| 91 | Provide detailed feedback to improve the poem. If the poem is already excellent and needs no changes, simply respond with an empty string. |
| 92 | """ |
| 93 | |
| 94 | feedback = _query_llm(prompt) |
| 95 | |
| 96 | return {"feedback": feedback}, state.update(feedback=feedback) |
| 97 | |
| 98 | |
| 99 | @action(reads=["current_draft"], writes=["final_draft"]) |
nothing calls this directly
no test coverage detected