Skip to content

Commit 5d4297d

Browse files
committed
Create analyze_tech_content.py
1 parent 0f824c9 commit 5d4297d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

scripts/analyze_tech_content.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Analyze pasted article content from stdin using the LLM tech-article analyzer.
4+
5+
Usage:
6+
pbpaste | python analyze_tech_content.py
7+
python analyze_tech_content.py < article.txt
8+
"""
9+
10+
import json
11+
import sys
12+
13+
from analyze_tech_article import build_user_message, call_llm
14+
from utils import LLMS_ANALYTICS_MODEL
15+
16+
def main():
17+
content = sys.stdin.read().strip()
18+
if not content:
19+
print("Error: no content received on stdin", file=sys.stderr)
20+
sys.exit(1)
21+
22+
extracted = {
23+
"url": "",
24+
"title": "",
25+
"description": "",
26+
"text_markdown": content,
27+
}
28+
29+
user_message = build_user_message(extracted)
30+
result = call_llm(user_message, LLMS_ANALYTICS_MODEL)
31+
print(json.dumps(result, indent=2))
32+
33+
print("\n---\n")
34+
print(result.get("summary"))
35+
36+
if __name__ == "__main__":
37+
main()

0 commit comments

Comments
 (0)