MCPcopy Create free account
hub / github.com/apache/burr / edit

Function edit

examples/recursive/application.py:82–96  ·  view source on GitHub ↗

Edits a draft of a poem, providing feedback

(state: State)

Source from the content-addressed store, hash-verified

80
81@action(reads=["current_draft", "poem_type", "prompt"], writes=["feedback"])
82def 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"])

Callers

nothing calls this directly

Calls 2

_query_llmFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected