|
1
|
"""Skill: Generate technical documentation, ADRs, or meeting notes.""" |
|
2
|
|
|
3
|
from video_processor.agent.skills.base import ( |
|
4
|
AgentContext, |
|
5
|
Artifact, |
|
6
|
Skill, |
|
7
|
register_skill, |
|
8
|
) |
|
9
|
|
|
10
|
_DOC_PROMPTS = { |
|
11
|
"technical_doc": ( |
|
12
|
"Generate technical documentation with:\n" |
|
13
|
"1. Overview\n2. Architecture\n3. Components & Interfaces\n" |
|
14
|
"4. Data Flow\n5. Deployment & Configuration\n" |
|
15
|
"6. API Reference (if applicable)" |
|
16
|
), |
|
17
|
"adr": ( |
|
18
|
"Generate an Architecture Decision Record (ADR) with:\n" |
|
19
|
"1. Title\n2. Status (Proposed)\n3. Context\n" |
|
20
|
"4. Decision\n5. Consequences\n6. Alternatives Considered" |
|
21
|
), |
|
22
|
"meeting_notes": ( |
|
23
|
"Generate structured meeting notes with:\n" |
|
24
|
"1. Meeting Summary\n2. Key Discussion Points\n" |
|
25
|
"3. Decisions Made\n4. Action Items (with owners)\n" |
|
26
|
"5. Open Questions\n6. Next Steps" |
|
27
|
), |
|
28
|
} |
|
29
|
|
|
30
|
|
|
31
|
class DocGeneratorSkill(Skill): |
|
32
|
name = "doc_generator" |
|
33
|
description = "Generate technical documentation, ADRs, or meeting notes" |
|
34
|
|
|
35
|
def execute(self, context: AgentContext, **kwargs) -> Artifact: |
|
36
|
doc_type = kwargs.get("doc_type", "technical_doc") |
|
37
|
stats = context.query_engine.stats() |
|
38
|
entities = context.query_engine.entities() |
|
39
|
relationships = context.query_engine.relationships() |
|
40
|
|
|
41
|
doc_instructions = _DOC_PROMPTS.get(doc_type, _DOC_PROMPTS["technical_doc"]) |
|
42
|
doc_label = doc_type.replace("_", " ") |
|
43
|
|
|
44
|
parts = [ |
|
45
|
f"You are a technical writer. Generate a {doc_label} " |
|
46
|
"from the following knowledge graph context.", |
|
47
|
"", |
|
48
|
"## Knowledge Graph Overview", |
|
49
|
stats.to_text(), |
|
50
|
"", |
|
51
|
"## Entities", |
|
52
|
entities.to_text(), |
|
53
|
"", |
|
54
|
"## Relationships", |
|
55
|
relationships.to_text(), |
|
56
|
"", |
|
57
|
"## Planning Entities", |
|
58
|
] |
|
59
|
for e in context.planning_entities: |
|
60
|
parts.append(f"- {e}") |
|
61
|
|
|
62
|
parts.append(f"\n{doc_instructions}\n\nReturn ONLY the markdown.") |
|
63
|
|
|
64
|
prompt = "\n".join(parts) |
|
65
|
response = context.provider_manager.chat(messages=[{"role": "user", "content": prompt}]) |
|
66
|
|
|
67
|
return Artifact( |
|
68
|
name=doc_label.title(), |
|
69
|
content=response, |
|
70
|
artifact_type="document", |
|
71
|
format="markdown", |
|
72
|
metadata={"doc_type": doc_type}, |
|
73
|
) |
|
74
|
|
|
75
|
|
|
76
|
register_skill(DocGeneratorSkill()) |
|
77
|
|