(
*,
template: TaskTemplateSpec,
guidance: str,
)
| 41 | |
| 42 | |
| 43 | def build_task_draft_prompt_bundle( |
| 44 | *, |
| 45 | template: TaskTemplateSpec, |
| 46 | guidance: str, |
| 47 | ) -> TaskDraftPromptBundle: |
| 48 | guidance_text = guidance.strip() |
| 49 | if not guidance_text: |
| 50 | raise ValueError("Guidance cannot be empty.") |
| 51 | |
| 52 | response_schema = _build_response_schema(template) |
| 53 | request_payload = { |
| 54 | "template": _template_to_prompt_payload(template), |
| 55 | "guidance": guidance_text, |
| 56 | "response_contract": response_schema, |
| 57 | } |
| 58 | return TaskDraftPromptBundle( |
| 59 | system_prompt=_TASK_DRAFT_SYSTEM_PROMPT, |
| 60 | user_prompt=_build_user_prompt(template, guidance_text), |
| 61 | response_schema=response_schema, |
| 62 | request_payload=request_payload, |
| 63 | ) |
| 64 | |
| 65 | |
| 66 | def _build_user_prompt(template: TaskTemplateSpec, guidance: str) -> str: |
no test coverage detected