agent-recipes 0.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_recipes/__init__.py +27 -0
- agent_recipes/recipe_runtime/__init__.py +28 -0
- agent_recipes/recipe_runtime/core.py +385 -0
- agent_recipes/templates/ai-ab-hook-tester/recipe.yaml +45 -0
- agent_recipes/templates/ai-ab-hook-tester/tools.py +169 -0
- agent_recipes/templates/ai-angle-generator/recipe.yaml +49 -0
- agent_recipes/templates/ai-angle-generator/tools.py +182 -0
- agent_recipes/templates/ai-api-doc-generator/README.md +59 -0
- agent_recipes/templates/ai-api-doc-generator/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-api-tester/README.md +60 -0
- agent_recipes/templates/ai-api-tester/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-audio-enhancer/README.md +59 -0
- agent_recipes/templates/ai-audio-enhancer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-audio-normalizer/README.md +13 -0
- agent_recipes/templates/ai-audio-normalizer/TEMPLATE.yaml +44 -0
- agent_recipes/templates/ai-audio-splitter/README.md +14 -0
- agent_recipes/templates/ai-audio-splitter/TEMPLATE.yaml +47 -0
- agent_recipes/templates/ai-background-music-generator/README.md +59 -0
- agent_recipes/templates/ai-background-music-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-background-remover/README.md +60 -0
- agent_recipes/templates/ai-background-remover/TEMPLATE.yaml +27 -0
- agent_recipes/templates/ai-barcode-scanner/README.md +60 -0
- agent_recipes/templates/ai-barcode-scanner/TEMPLATE.yaml +26 -0
- agent_recipes/templates/ai-blog-generator/README.md +59 -0
- agent_recipes/templates/ai-blog-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-brief-generator/recipe.yaml +52 -0
- agent_recipes/templates/ai-brief-generator/tools.py +231 -0
- agent_recipes/templates/ai-broll-builder/recipe.yaml +47 -0
- agent_recipes/templates/ai-broll-builder/tools.py +204 -0
- agent_recipes/templates/ai-calendar-scheduler/README.md +60 -0
- agent_recipes/templates/ai-calendar-scheduler/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-changelog-generator/README.md +14 -0
- agent_recipes/templates/ai-changelog-generator/TEMPLATE.yaml +46 -0
- agent_recipes/templates/ai-chart-generator/README.md +61 -0
- agent_recipes/templates/ai-chart-generator/TEMPLATE.yaml +32 -0
- agent_recipes/templates/ai-code-documenter/README.md +12 -0
- agent_recipes/templates/ai-code-documenter/TEMPLATE.yaml +37 -0
- agent_recipes/templates/ai-code-refactorer/README.md +59 -0
- agent_recipes/templates/ai-code-refactorer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-code-reviewer/README.md +59 -0
- agent_recipes/templates/ai-code-reviewer/TEMPLATE.yaml +31 -0
- agent_recipes/templates/ai-color-palette-extractor/README.md +60 -0
- agent_recipes/templates/ai-color-palette-extractor/TEMPLATE.yaml +27 -0
- agent_recipes/templates/ai-comment-miner/recipe.yaml +40 -0
- agent_recipes/templates/ai-comment-miner/tools.py +141 -0
- agent_recipes/templates/ai-commit-message-generator/README.md +59 -0
- agent_recipes/templates/ai-commit-message-generator/TEMPLATE.yaml +31 -0
- agent_recipes/templates/ai-content-calendar/recipe.yaml +43 -0
- agent_recipes/templates/ai-content-calendar/tools.py +170 -0
- agent_recipes/templates/ai-context-enricher/recipe.yaml +48 -0
- agent_recipes/templates/ai-context-enricher/tools.py +258 -0
- agent_recipes/templates/ai-contract-analyzer/README.md +60 -0
- agent_recipes/templates/ai-contract-analyzer/TEMPLATE.yaml +34 -0
- agent_recipes/templates/ai-csv-cleaner/README.md +13 -0
- agent_recipes/templates/ai-csv-cleaner/TEMPLATE.yaml +45 -0
- agent_recipes/templates/ai-cta-generator/recipe.yaml +54 -0
- agent_recipes/templates/ai-cta-generator/tools.py +174 -0
- agent_recipes/templates/ai-daily-news-show/recipe.yaml +103 -0
- agent_recipes/templates/ai-daily-news-show/tools.py +308 -0
- agent_recipes/templates/ai-data-anonymizer/README.md +60 -0
- agent_recipes/templates/ai-data-anonymizer/TEMPLATE.yaml +31 -0
- agent_recipes/templates/ai-data-profiler/README.md +14 -0
- agent_recipes/templates/ai-data-profiler/TEMPLATE.yaml +42 -0
- agent_recipes/templates/ai-dependency-auditor/README.md +12 -0
- agent_recipes/templates/ai-dependency-auditor/TEMPLATE.yaml +37 -0
- agent_recipes/templates/ai-doc-translator/README.md +12 -0
- agent_recipes/templates/ai-doc-translator/TEMPLATE.yaml +41 -0
- agent_recipes/templates/ai-duplicate-finder/README.md +59 -0
- agent_recipes/templates/ai-duplicate-finder/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-ebook-converter/README.md +60 -0
- agent_recipes/templates/ai-ebook-converter/TEMPLATE.yaml +27 -0
- agent_recipes/templates/ai-email-parser/README.md +59 -0
- agent_recipes/templates/ai-email-parser/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-etl-pipeline/README.md +60 -0
- agent_recipes/templates/ai-etl-pipeline/TEMPLATE.yaml +30 -0
- agent_recipes/templates/ai-excel-formula-generator/README.md +59 -0
- agent_recipes/templates/ai-excel-formula-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-face-blur/README.md +60 -0
- agent_recipes/templates/ai-face-blur/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-fact-checker/recipe.yaml +52 -0
- agent_recipes/templates/ai-fact-checker/tools.py +279 -0
- agent_recipes/templates/ai-faq-generator/README.md +59 -0
- agent_recipes/templates/ai-faq-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-file-organizer/README.md +59 -0
- agent_recipes/templates/ai-file-organizer/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-folder-packager/README.md +15 -0
- agent_recipes/templates/ai-folder-packager/TEMPLATE.yaml +48 -0
- agent_recipes/templates/ai-form-filler/README.md +60 -0
- agent_recipes/templates/ai-form-filler/TEMPLATE.yaml +30 -0
- agent_recipes/templates/ai-hashtag-optimizer/recipe.yaml +45 -0
- agent_recipes/templates/ai-hashtag-optimizer/tools.py +134 -0
- agent_recipes/templates/ai-hook-generator/recipe.yaml +50 -0
- agent_recipes/templates/ai-hook-generator/tools.py +177 -0
- agent_recipes/templates/ai-image-captioner/README.md +59 -0
- agent_recipes/templates/ai-image-captioner/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-image-cataloger/README.md +13 -0
- agent_recipes/templates/ai-image-cataloger/TEMPLATE.yaml +39 -0
- agent_recipes/templates/ai-image-optimizer/README.md +13 -0
- agent_recipes/templates/ai-image-optimizer/TEMPLATE.yaml +43 -0
- agent_recipes/templates/ai-image-resizer/README.md +12 -0
- agent_recipes/templates/ai-image-resizer/TEMPLATE.yaml +39 -0
- agent_recipes/templates/ai-image-tagger/README.md +59 -0
- agent_recipes/templates/ai-image-tagger/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-image-upscaler/README.md +60 -0
- agent_recipes/templates/ai-image-upscaler/TEMPLATE.yaml +27 -0
- agent_recipes/templates/ai-invoice-processor/README.md +60 -0
- agent_recipes/templates/ai-invoice-processor/TEMPLATE.yaml +34 -0
- agent_recipes/templates/ai-json-to-csv/README.md +12 -0
- agent_recipes/templates/ai-json-to-csv/TEMPLATE.yaml +36 -0
- agent_recipes/templates/ai-log-analyzer/README.md +59 -0
- agent_recipes/templates/ai-log-analyzer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-markdown-to-pdf/README.md +12 -0
- agent_recipes/templates/ai-markdown-to-pdf/TEMPLATE.yaml +40 -0
- agent_recipes/templates/ai-meeting-summarizer/README.md +59 -0
- agent_recipes/templates/ai-meeting-summarizer/TEMPLATE.yaml +32 -0
- agent_recipes/templates/ai-meta-tag-generator/README.md +59 -0
- agent_recipes/templates/ai-meta-tag-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-news-capture-pack/recipe.yaml +42 -0
- agent_recipes/templates/ai-news-capture-pack/tools.py +150 -0
- agent_recipes/templates/ai-news-crawler/recipe.yaml +99 -0
- agent_recipes/templates/ai-news-crawler/tools.py +417 -0
- agent_recipes/templates/ai-news-deduper/recipe.yaml +47 -0
- agent_recipes/templates/ai-news-deduper/tools.py +235 -0
- agent_recipes/templates/ai-newsletter-generator/README.md +59 -0
- agent_recipes/templates/ai-newsletter-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-note-summarizer/README.md +59 -0
- agent_recipes/templates/ai-note-summarizer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-pdf-summarizer/README.md +12 -0
- agent_recipes/templates/ai-pdf-summarizer/TEMPLATE.yaml +40 -0
- agent_recipes/templates/ai-pdf-to-markdown/README.md +19 -0
- agent_recipes/templates/ai-pdf-to-markdown/TEMPLATE.yaml +63 -0
- agent_recipes/templates/ai-performance-analyzer/recipe.yaml +45 -0
- agent_recipes/templates/ai-performance-analyzer/tools.py +159 -0
- agent_recipes/templates/ai-podcast-cleaner/README.md +117 -0
- agent_recipes/templates/ai-podcast-cleaner/TEMPLATE.yaml +117 -0
- agent_recipes/templates/ai-podcast-cleaner/agents.yaml +59 -0
- agent_recipes/templates/ai-podcast-cleaner/workflow.yaml +77 -0
- agent_recipes/templates/ai-podcast-transcriber/README.md +59 -0
- agent_recipes/templates/ai-podcast-transcriber/TEMPLATE.yaml +32 -0
- agent_recipes/templates/ai-post-copy-generator/recipe.yaml +41 -0
- agent_recipes/templates/ai-post-copy-generator/tools.py +105 -0
- agent_recipes/templates/ai-product-description-generator/README.md +59 -0
- agent_recipes/templates/ai-product-description-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-publisher-pack/recipe.yaml +44 -0
- agent_recipes/templates/ai-publisher-pack/tools.py +252 -0
- agent_recipes/templates/ai-qr-code-generator/README.md +60 -0
- agent_recipes/templates/ai-qr-code-generator/TEMPLATE.yaml +26 -0
- agent_recipes/templates/ai-regex-generator/README.md +59 -0
- agent_recipes/templates/ai-regex-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-repo-readme/README.md +13 -0
- agent_recipes/templates/ai-repo-readme/TEMPLATE.yaml +42 -0
- agent_recipes/templates/ai-report-generator/README.md +61 -0
- agent_recipes/templates/ai-report-generator/TEMPLATE.yaml +32 -0
- agent_recipes/templates/ai-resume-parser/README.md +60 -0
- agent_recipes/templates/ai-resume-parser/TEMPLATE.yaml +33 -0
- agent_recipes/templates/ai-rss-aggregator/README.md +60 -0
- agent_recipes/templates/ai-rss-aggregator/TEMPLATE.yaml +30 -0
- agent_recipes/templates/ai-schema-generator/README.md +12 -0
- agent_recipes/templates/ai-schema-generator/TEMPLATE.yaml +34 -0
- agent_recipes/templates/ai-screen-recorder/recipe.yaml +43 -0
- agent_recipes/templates/ai-screen-recorder/tools.py +184 -0
- agent_recipes/templates/ai-screenshot-capture/recipe.yaml +45 -0
- agent_recipes/templates/ai-screenshot-capture/tools.py +231 -0
- agent_recipes/templates/ai-screenshot-ocr/README.md +12 -0
- agent_recipes/templates/ai-screenshot-ocr/TEMPLATE.yaml +37 -0
- agent_recipes/templates/ai-script-writer/recipe.yaml +58 -0
- agent_recipes/templates/ai-script-writer/tools.py +297 -0
- agent_recipes/templates/ai-sentiment-analyzer/README.md +59 -0
- agent_recipes/templates/ai-sentiment-analyzer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-seo-optimizer/README.md +59 -0
- agent_recipes/templates/ai-seo-optimizer/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-signal-ranker/recipe.yaml +54 -0
- agent_recipes/templates/ai-signal-ranker/tools.py +256 -0
- agent_recipes/templates/ai-sitemap-generator/README.md +59 -0
- agent_recipes/templates/ai-sitemap-generator/TEMPLATE.yaml +26 -0
- agent_recipes/templates/ai-sitemap-scraper/README.md +13 -0
- agent_recipes/templates/ai-sitemap-scraper/TEMPLATE.yaml +41 -0
- agent_recipes/templates/ai-slide-generator/README.md +60 -0
- agent_recipes/templates/ai-slide-generator/TEMPLATE.yaml +29 -0
- agent_recipes/templates/ai-slide-to-notes/README.md +12 -0
- agent_recipes/templates/ai-slide-to-notes/TEMPLATE.yaml +37 -0
- agent_recipes/templates/ai-social-media-generator/README.md +59 -0
- agent_recipes/templates/ai-social-media-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-sql-generator/README.md +59 -0
- agent_recipes/templates/ai-sql-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-subtitle-generator/README.md +59 -0
- agent_recipes/templates/ai-subtitle-generator/TEMPLATE.yaml +31 -0
- agent_recipes/templates/ai-test-generator/README.md +59 -0
- agent_recipes/templates/ai-test-generator/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-translation-batch/README.md +59 -0
- agent_recipes/templates/ai-translation-batch/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-url-to-markdown/README.md +14 -0
- agent_recipes/templates/ai-url-to-markdown/TEMPLATE.yaml +44 -0
- agent_recipes/templates/ai-video-chapter-generator/README.md +59 -0
- agent_recipes/templates/ai-video-chapter-generator/TEMPLATE.yaml +32 -0
- agent_recipes/templates/ai-video-compressor/README.md +59 -0
- agent_recipes/templates/ai-video-compressor/TEMPLATE.yaml +28 -0
- agent_recipes/templates/ai-video-editor/README.md +254 -0
- agent_recipes/templates/ai-video-editor/TEMPLATE.yaml +139 -0
- agent_recipes/templates/ai-video-editor/agents.yaml +36 -0
- agent_recipes/templates/ai-video-editor/requirements.txt +8 -0
- agent_recipes/templates/ai-video-editor/scripts/run.sh +10 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__init__.py +45 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__main__.py +8 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/__init__.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/cli.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/config.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/ffmpeg_probe.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/heuristics.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/llm_plan.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/models.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/pipeline.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/render.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/timeline.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/transcribe.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/__pycache__/utils.cpython-312.pyc +0 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/cli.py +343 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/config.py +102 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/ffmpeg_probe.py +92 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/heuristics.py +119 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/llm_plan.py +277 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/models.py +343 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/pipeline.py +287 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/render.py +274 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/timeline.py +278 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/transcribe.py +233 -0
- agent_recipes/templates/ai-video-editor/src/ai_video_editor/utils.py +222 -0
- agent_recipes/templates/ai-video-editor/src/input.mov +0 -0
- agent_recipes/templates/ai-video-editor/src/out.mp4 +0 -0
- agent_recipes/templates/ai-video-editor/tests/test_heuristics.py +130 -0
- agent_recipes/templates/ai-video-editor/tests/test_models.py +152 -0
- agent_recipes/templates/ai-video-editor/tests/test_timeline.py +105 -0
- agent_recipes/templates/ai-video-editor/workflow.yaml +51 -0
- agent_recipes/templates/ai-video-highlight-extractor/README.md +60 -0
- agent_recipes/templates/ai-video-highlight-extractor/TEMPLATE.yaml +33 -0
- agent_recipes/templates/ai-video-merger/recipe.yaml +40 -0
- agent_recipes/templates/ai-video-merger/tools.py +172 -0
- agent_recipes/templates/ai-video-thumbnails/README.md +16 -0
- agent_recipes/templates/ai-video-thumbnails/TEMPLATE.yaml +53 -0
- agent_recipes/templates/ai-video-to-gif/README.md +14 -0
- agent_recipes/templates/ai-video-to-gif/TEMPLATE.yaml +64 -0
- agent_recipes/templates/ai-voice-cloner/README.md +59 -0
- agent_recipes/templates/ai-voice-cloner/TEMPLATE.yaml +31 -0
- agent_recipes/templates/ai-voiceover-generator/recipe.yaml +41 -0
- agent_recipes/templates/ai-voiceover-generator/tools.py +194 -0
- agent_recipes/templates/ai-watermark-adder/README.md +59 -0
- agent_recipes/templates/ai-watermark-adder/TEMPLATE.yaml +26 -0
- agent_recipes/templates/ai-watermark-remover/README.md +60 -0
- agent_recipes/templates/ai-watermark-remover/TEMPLATE.yaml +32 -0
- agent_recipes/templates/data-transformer/README.md +75 -0
- agent_recipes/templates/data-transformer/TEMPLATE.yaml +63 -0
- agent_recipes/templates/data-transformer/agents.yaml +70 -0
- agent_recipes/templates/data-transformer/workflow.yaml +92 -0
- agent_recipes/templates/shorts-generator/README.md +61 -0
- agent_recipes/templates/shorts-generator/TEMPLATE.yaml +65 -0
- agent_recipes/templates/shorts-generator/agents.yaml +66 -0
- agent_recipes/templates/shorts-generator/workflow.yaml +86 -0
- agent_recipes/templates/transcript-generator/README.md +103 -0
- agent_recipes/templates/transcript-generator/TEMPLATE.yaml +57 -0
- agent_recipes/templates/transcript-generator/agents.yaml +62 -0
- agent_recipes/templates/transcript-generator/workflow.yaml +82 -0
- agent_recipes/templates/video-editor/README.md +70 -0
- agent_recipes/templates/video-editor/TEMPLATE.yaml +55 -0
- agent_recipes/templates/video-editor/agents.yaml +68 -0
- agent_recipes/templates/video-editor/workflow.yaml +92 -0
- agent_recipes-0.0.5.dist-info/METADATA +145 -0
- agent_recipes-0.0.5.dist-info/RECORD +269 -0
- agent_recipes-0.0.5.dist-info/WHEEL +5 -0
- agent_recipes-0.0.5.dist-info/top_level.txt +1 -0
- /236/326/177nE/243/231/214/232/265/322m/201/253/353/022C/372/321/266/b/225^=/272/017t/262/3337/310@/315wb/341pB/277z/216/330/314/004/265B/213/375/236/203/026/373/307/354z41/347#/374q/262/22589/032/276 /277/244Vh/322/017/004/224/215/004/367/377/375/335/n +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI Context Enricher Tools
|
|
3
|
+
|
|
4
|
+
Tools for enriching news articles with:
|
|
5
|
+
- Background context
|
|
6
|
+
- Prior art references
|
|
7
|
+
- Stakeholder analysis (who benefits)
|
|
8
|
+
- Hype detection
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import logging
|
|
12
|
+
import os
|
|
13
|
+
from typing import Any, Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def call_llm(prompt: str, max_tokens: int = 500) -> str:
|
|
19
|
+
"""Call OpenAI API for text generation."""
|
|
20
|
+
import requests
|
|
21
|
+
|
|
22
|
+
api_key = os.environ.get("OPENAI_API_KEY")
|
|
23
|
+
if not api_key:
|
|
24
|
+
raise ValueError("OPENAI_API_KEY not set")
|
|
25
|
+
|
|
26
|
+
response = requests.post(
|
|
27
|
+
"https://api.openai.com/v1/chat/completions",
|
|
28
|
+
headers={
|
|
29
|
+
"Authorization": f"Bearer {api_key}",
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
},
|
|
32
|
+
json={
|
|
33
|
+
"model": "gpt-4o-mini",
|
|
34
|
+
"messages": [{"role": "user", "content": prompt}],
|
|
35
|
+
"max_tokens": max_tokens,
|
|
36
|
+
"temperature": 0.7,
|
|
37
|
+
},
|
|
38
|
+
timeout=60,
|
|
39
|
+
)
|
|
40
|
+
response.raise_for_status()
|
|
41
|
+
return response.json()["choices"][0]["message"]["content"]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def add_background(
|
|
45
|
+
article: Dict[str, Any],
|
|
46
|
+
max_length: int = 300,
|
|
47
|
+
) -> Dict[str, Any]:
|
|
48
|
+
"""
|
|
49
|
+
Add background context to an article.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
article: Article dictionary
|
|
53
|
+
max_length: Maximum length of background text
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Article with background field added
|
|
57
|
+
"""
|
|
58
|
+
title = article.get("title", "")
|
|
59
|
+
content = article.get("content", "")[:500]
|
|
60
|
+
|
|
61
|
+
prompt = f"""Given this AI news article, provide brief background context that helps readers understand the significance.
|
|
62
|
+
|
|
63
|
+
Title: {title}
|
|
64
|
+
Content: {content}
|
|
65
|
+
|
|
66
|
+
Provide 2-3 sentences of background context explaining:
|
|
67
|
+
1. What problem this addresses
|
|
68
|
+
2. Why it matters now
|
|
69
|
+
3. Key context readers should know
|
|
70
|
+
|
|
71
|
+
Background:"""
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
background = call_llm(prompt, max_tokens=200)
|
|
75
|
+
article["background"] = background.strip()
|
|
76
|
+
except Exception as e:
|
|
77
|
+
logger.warning(f"Error adding background: {e}")
|
|
78
|
+
article["background"] = ""
|
|
79
|
+
|
|
80
|
+
return article
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def find_prior_art(
|
|
84
|
+
article: Dict[str, Any],
|
|
85
|
+
) -> Dict[str, Any]:
|
|
86
|
+
"""
|
|
87
|
+
Find and reference prior art related to the article.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
article: Article dictionary
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Article with prior_art field added
|
|
94
|
+
"""
|
|
95
|
+
title = article.get("title", "")
|
|
96
|
+
content = article.get("content", "")[:500]
|
|
97
|
+
|
|
98
|
+
prompt = f"""Given this AI news article, identify relevant prior art and historical context.
|
|
99
|
+
|
|
100
|
+
Title: {title}
|
|
101
|
+
Content: {content}
|
|
102
|
+
|
|
103
|
+
List 2-3 relevant prior developments or research that led to this:
|
|
104
|
+
- Include approximate dates if known
|
|
105
|
+
- Mention key papers, products, or milestones
|
|
106
|
+
- Keep each item to one sentence
|
|
107
|
+
|
|
108
|
+
Prior Art:"""
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
prior_art = call_llm(prompt, max_tokens=250)
|
|
112
|
+
article["prior_art"] = prior_art.strip()
|
|
113
|
+
except Exception as e:
|
|
114
|
+
logger.warning(f"Error finding prior art: {e}")
|
|
115
|
+
article["prior_art"] = ""
|
|
116
|
+
|
|
117
|
+
return article
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def analyze_stakeholders(
|
|
121
|
+
article: Dict[str, Any],
|
|
122
|
+
) -> Dict[str, Any]:
|
|
123
|
+
"""
|
|
124
|
+
Analyze who benefits and who is affected by this news.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
article: Article dictionary
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Article with stakeholders field added
|
|
131
|
+
"""
|
|
132
|
+
title = article.get("title", "")
|
|
133
|
+
content = article.get("content", "")[:500]
|
|
134
|
+
|
|
135
|
+
prompt = f"""Analyze the stakeholders for this AI news:
|
|
136
|
+
|
|
137
|
+
Title: {title}
|
|
138
|
+
Content: {content}
|
|
139
|
+
|
|
140
|
+
Identify:
|
|
141
|
+
1. Who benefits most from this development?
|
|
142
|
+
2. Who might be negatively affected?
|
|
143
|
+
3. What industries or groups should pay attention?
|
|
144
|
+
|
|
145
|
+
Keep response concise (3-4 sentences).
|
|
146
|
+
|
|
147
|
+
Stakeholder Analysis:"""
|
|
148
|
+
|
|
149
|
+
try:
|
|
150
|
+
stakeholders = call_llm(prompt, max_tokens=200)
|
|
151
|
+
article["stakeholders"] = stakeholders.strip()
|
|
152
|
+
except Exception as e:
|
|
153
|
+
logger.warning(f"Error analyzing stakeholders: {e}")
|
|
154
|
+
article["stakeholders"] = ""
|
|
155
|
+
|
|
156
|
+
return article
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def detect_hype(
|
|
160
|
+
article: Dict[str, Any],
|
|
161
|
+
) -> Dict[str, Any]:
|
|
162
|
+
"""
|
|
163
|
+
Detect hype level and provide reality check.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
article: Article dictionary
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Article with hype_analysis field added
|
|
170
|
+
"""
|
|
171
|
+
title = article.get("title", "")
|
|
172
|
+
content = article.get("content", "")[:500]
|
|
173
|
+
|
|
174
|
+
prompt = f"""Analyze the hype level of this AI news:
|
|
175
|
+
|
|
176
|
+
Title: {title}
|
|
177
|
+
Content: {content}
|
|
178
|
+
|
|
179
|
+
Provide:
|
|
180
|
+
1. Hype Level: LOW / MEDIUM / HIGH / OVERHYPED
|
|
181
|
+
2. Reality Check: One sentence on what's actually new vs marketing
|
|
182
|
+
3. Confidence: How confident are you in this assessment (LOW/MEDIUM/HIGH)
|
|
183
|
+
|
|
184
|
+
Format as:
|
|
185
|
+
Hype Level: [level]
|
|
186
|
+
Reality Check: [assessment]
|
|
187
|
+
Confidence: [level]"""
|
|
188
|
+
|
|
189
|
+
try:
|
|
190
|
+
hype_analysis = call_llm(prompt, max_tokens=150)
|
|
191
|
+
|
|
192
|
+
# Parse the response
|
|
193
|
+
lines = hype_analysis.strip().split("\n")
|
|
194
|
+
hype_data = {
|
|
195
|
+
"raw": hype_analysis.strip(),
|
|
196
|
+
"level": "MEDIUM",
|
|
197
|
+
"reality_check": "",
|
|
198
|
+
"confidence": "MEDIUM",
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
for line in lines:
|
|
202
|
+
if "Hype Level:" in line:
|
|
203
|
+
hype_data["level"] = line.split(":")[-1].strip().upper()
|
|
204
|
+
elif "Reality Check:" in line:
|
|
205
|
+
hype_data["reality_check"] = line.split(":", 1)[-1].strip()
|
|
206
|
+
elif "Confidence:" in line:
|
|
207
|
+
hype_data["confidence"] = line.split(":")[-1].strip().upper()
|
|
208
|
+
|
|
209
|
+
article["hype_analysis"] = hype_data
|
|
210
|
+
except Exception as e:
|
|
211
|
+
logger.warning(f"Error detecting hype: {e}")
|
|
212
|
+
article["hype_analysis"] = {"level": "UNKNOWN", "reality_check": "", "confidence": "LOW"}
|
|
213
|
+
|
|
214
|
+
return article
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def enrich_articles(
|
|
218
|
+
articles: List[Dict[str, Any]],
|
|
219
|
+
enrichment_types: Optional[List[str]] = None,
|
|
220
|
+
) -> Dict[str, Any]:
|
|
221
|
+
"""
|
|
222
|
+
Enrich multiple articles with context.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
articles: List of article dictionaries
|
|
226
|
+
enrichment_types: Types of enrichment to apply
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
Dictionary with enriched articles
|
|
230
|
+
"""
|
|
231
|
+
enrichment_types = enrichment_types or ["background", "prior_art", "stakeholders", "hype_detection"]
|
|
232
|
+
|
|
233
|
+
enriched = []
|
|
234
|
+
|
|
235
|
+
for article in articles:
|
|
236
|
+
enriched_article = article.copy()
|
|
237
|
+
|
|
238
|
+
if "background" in enrichment_types:
|
|
239
|
+
enriched_article = add_background(enriched_article)
|
|
240
|
+
|
|
241
|
+
if "prior_art" in enrichment_types:
|
|
242
|
+
enriched_article = find_prior_art(enriched_article)
|
|
243
|
+
|
|
244
|
+
if "stakeholders" in enrichment_types:
|
|
245
|
+
enriched_article = analyze_stakeholders(enriched_article)
|
|
246
|
+
|
|
247
|
+
if "hype_detection" in enrichment_types:
|
|
248
|
+
enriched_article = detect_hype(enriched_article)
|
|
249
|
+
|
|
250
|
+
enriched.append(enriched_article)
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
"enriched_articles": enriched,
|
|
254
|
+
"stats": {
|
|
255
|
+
"total_enriched": len(enriched),
|
|
256
|
+
"enrichment_types": enrichment_types,
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Contract Analyzer
|
|
2
|
+
|
|
3
|
+
Extract key terms, dates, obligations from contracts (LEGAL DISCLAIMER)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install agent-recipes
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Basic usage
|
|
15
|
+
praison recipes run ai-contract-analyzer <input>
|
|
16
|
+
|
|
17
|
+
# With output directory
|
|
18
|
+
praison recipes run ai-contract-analyzer <input> --output ./output/
|
|
19
|
+
|
|
20
|
+
# Dry run (check dependencies only)
|
|
21
|
+
praison recipes run ai-contract-analyzer <input> --dry-run
|
|
22
|
+
|
|
23
|
+
# Show recipe info
|
|
24
|
+
praison recipes info ai-contract-analyzer
|
|
25
|
+
|
|
26
|
+
# Check dependencies
|
|
27
|
+
praison recipes doctor ai-contract-analyzer
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Python Usage
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from praisonaiagents import Agent
|
|
34
|
+
from agent_recipes import load_recipe
|
|
35
|
+
|
|
36
|
+
# Load and run recipe
|
|
37
|
+
recipe = load_recipe("ai-contract-analyzer")
|
|
38
|
+
result = recipe.run(input="<your-input>")
|
|
39
|
+
print(result)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Requirements
|
|
43
|
+
|
|
44
|
+
### Packages
|
|
45
|
+
- openai
|
|
46
|
+
- pdftotext
|
|
47
|
+
|
|
48
|
+
### Environment Variables
|
|
49
|
+
- OPENAI_API_KEY
|
|
50
|
+
|
|
51
|
+
### External Tools
|
|
52
|
+
- poppler
|
|
53
|
+
|
|
54
|
+
## Tags
|
|
55
|
+
|
|
56
|
+
`document`, `contract`, `legal`, `analysis`
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Apache-2.0
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: ai-contract-analyzer
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Extract key terms, dates, obligations from contracts (LEGAL DISCLAIMER)
|
|
4
|
+
author: praison
|
|
5
|
+
license: Apache-2.0
|
|
6
|
+
tags:
|
|
7
|
+
- document
|
|
8
|
+
- contract
|
|
9
|
+
- legal
|
|
10
|
+
- analysis
|
|
11
|
+
|
|
12
|
+
requires:
|
|
13
|
+
tools:
|
|
14
|
+
- doc_tool
|
|
15
|
+
- llm_tool
|
|
16
|
+
packages:
|
|
17
|
+
- openai
|
|
18
|
+
- pdftotext
|
|
19
|
+
env:
|
|
20
|
+
- OPENAI_API_KEY
|
|
21
|
+
external:
|
|
22
|
+
- poppler
|
|
23
|
+
|
|
24
|
+
cli:
|
|
25
|
+
command: praison recipes run ai-contract-analyzer
|
|
26
|
+
examples:
|
|
27
|
+
- praison recipes run ai-contract-analyzer <input>
|
|
28
|
+
- praison recipes run ai-contract-analyzer <input> --output ./output/
|
|
29
|
+
- praison recipes run ai-contract-analyzer <input> --dry-run
|
|
30
|
+
|
|
31
|
+
safety:
|
|
32
|
+
dry_run_default: false
|
|
33
|
+
overwrites_files: true
|
|
34
|
+
legal_disclaimer: "This tool provides extraction only, not legal advice."
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# AI CSV Cleaner
|
|
2
|
+
|
|
3
|
+
Clean CSV files by removing duplicates, fixing nulls, and standardizing formats.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```bash
|
|
7
|
+
praison run ai-csv-cleaner data.csv
|
|
8
|
+
praison run ai-csv-cleaner data.csv --drop-duplicates --fill-nulls mean
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Output
|
|
12
|
+
- `cleaned.csv` - Cleaned data
|
|
13
|
+
- `cleaning-report.json` - Changes made
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: ai-csv-cleaner
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Clean CSV files by removing duplicates, fixing nulls, and standardizing formats.
|
|
4
|
+
author: praisonai
|
|
5
|
+
license: Apache-2.0
|
|
6
|
+
tags: [csv, data, cleaning, etl]
|
|
7
|
+
|
|
8
|
+
requires:
|
|
9
|
+
tools: [shell_tool]
|
|
10
|
+
packages: [praisonai-tools, pandas]
|
|
11
|
+
env: [OPENAI_API_KEY]
|
|
12
|
+
|
|
13
|
+
config:
|
|
14
|
+
input:
|
|
15
|
+
type: string
|
|
16
|
+
required: true
|
|
17
|
+
output:
|
|
18
|
+
type: string
|
|
19
|
+
drop_duplicates:
|
|
20
|
+
type: boolean
|
|
21
|
+
default: true
|
|
22
|
+
fill_nulls:
|
|
23
|
+
type: string
|
|
24
|
+
|
|
25
|
+
cli:
|
|
26
|
+
command: ai-csv-cleaner
|
|
27
|
+
args:
|
|
28
|
+
- name: input
|
|
29
|
+
positional: true
|
|
30
|
+
required: true
|
|
31
|
+
- name: --output
|
|
32
|
+
short: -o
|
|
33
|
+
- name: --drop-duplicates
|
|
34
|
+
flag: true
|
|
35
|
+
- name: --fill-nulls
|
|
36
|
+
examples:
|
|
37
|
+
- "praison run ai-csv-cleaner data.csv"
|
|
38
|
+
|
|
39
|
+
outputs:
|
|
40
|
+
- name: cleaned.csv
|
|
41
|
+
type: file
|
|
42
|
+
- name: cleaning-report.json
|
|
43
|
+
type: file
|
|
44
|
+
- name: run.json
|
|
45
|
+
type: file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: ai-cta-generator
|
|
2
|
+
version: 1.0.0
|
|
3
|
+
description: Generate platform-specific CTAs and titles for YouTube, X, LinkedIn, and more
|
|
4
|
+
author: PraisonAI
|
|
5
|
+
tags:
|
|
6
|
+
- cta
|
|
7
|
+
- titles
|
|
8
|
+
- content
|
|
9
|
+
- optimization
|
|
10
|
+
|
|
11
|
+
config:
|
|
12
|
+
platforms:
|
|
13
|
+
- youtube
|
|
14
|
+
- x
|
|
15
|
+
- linkedin
|
|
16
|
+
- instagram
|
|
17
|
+
- tiktok
|
|
18
|
+
cta_types:
|
|
19
|
+
- subscribe
|
|
20
|
+
- comment
|
|
21
|
+
- share
|
|
22
|
+
- click
|
|
23
|
+
- follow
|
|
24
|
+
|
|
25
|
+
input:
|
|
26
|
+
type: object
|
|
27
|
+
properties:
|
|
28
|
+
topic:
|
|
29
|
+
type: string
|
|
30
|
+
platform:
|
|
31
|
+
type: string
|
|
32
|
+
cta_type:
|
|
33
|
+
type: string
|
|
34
|
+
|
|
35
|
+
output:
|
|
36
|
+
type: object
|
|
37
|
+
properties:
|
|
38
|
+
ctas:
|
|
39
|
+
type: array
|
|
40
|
+
titles:
|
|
41
|
+
type: array
|
|
42
|
+
|
|
43
|
+
requires:
|
|
44
|
+
env:
|
|
45
|
+
- OPENAI_API_KEY
|
|
46
|
+
|
|
47
|
+
workflow:
|
|
48
|
+
agents:
|
|
49
|
+
- name: cta_generator
|
|
50
|
+
role: CTA Specialist
|
|
51
|
+
goal: Create compelling CTAs and titles
|
|
52
|
+
tools:
|
|
53
|
+
- generate_ctas
|
|
54
|
+
- generate_titles
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI CTA + Title Generator Tools
|
|
3
|
+
|
|
4
|
+
Generate platform-specific:
|
|
5
|
+
- Calls to action
|
|
6
|
+
- Video/post titles
|
|
7
|
+
- Thumbnail text
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
import os
|
|
12
|
+
from typing import Any, Dict, List, Optional
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def call_llm(prompt: str, max_tokens: int = 600) -> str:
|
|
18
|
+
"""Call OpenAI API for text generation."""
|
|
19
|
+
import requests
|
|
20
|
+
|
|
21
|
+
api_key = os.environ.get("OPENAI_API_KEY")
|
|
22
|
+
if not api_key:
|
|
23
|
+
raise ValueError("OPENAI_API_KEY not set")
|
|
24
|
+
|
|
25
|
+
response = requests.post(
|
|
26
|
+
"https://api.openai.com/v1/chat/completions",
|
|
27
|
+
headers={
|
|
28
|
+
"Authorization": f"Bearer {api_key}",
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
},
|
|
31
|
+
json={
|
|
32
|
+
"model": "gpt-4o-mini",
|
|
33
|
+
"messages": [{"role": "user", "content": prompt}],
|
|
34
|
+
"max_tokens": max_tokens,
|
|
35
|
+
"temperature": 0.8,
|
|
36
|
+
},
|
|
37
|
+
timeout=60,
|
|
38
|
+
)
|
|
39
|
+
response.raise_for_status()
|
|
40
|
+
return response.json()["choices"][0]["message"]["content"]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def generate_ctas(
|
|
44
|
+
topic: str,
|
|
45
|
+
platform: str = "youtube",
|
|
46
|
+
cta_type: str = "subscribe",
|
|
47
|
+
num_variants: int = 5,
|
|
48
|
+
) -> Dict[str, Any]:
|
|
49
|
+
"""
|
|
50
|
+
Generate platform-specific CTAs.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
topic: Content topic
|
|
54
|
+
platform: Target platform
|
|
55
|
+
cta_type: Type of CTA
|
|
56
|
+
num_variants: Number of variants
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
Dictionary with CTA variants
|
|
60
|
+
"""
|
|
61
|
+
platform_context = {
|
|
62
|
+
"youtube": "YouTube video ending, asking viewers to subscribe and engage",
|
|
63
|
+
"x": "Tweet or thread, asking for retweets and follows",
|
|
64
|
+
"linkedin": "LinkedIn post, asking for comments and connections",
|
|
65
|
+
"instagram": "Instagram post/reel, asking for saves and follows",
|
|
66
|
+
"tiktok": "TikTok video, asking for follows and duets",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
cta_context = {
|
|
70
|
+
"subscribe": "Get them to subscribe/follow",
|
|
71
|
+
"comment": "Encourage comments and discussion",
|
|
72
|
+
"share": "Ask them to share with others",
|
|
73
|
+
"click": "Drive clicks to a link",
|
|
74
|
+
"follow": "Get them to follow for more content",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
prompt = f"""Generate {num_variants} CTAs for this content:
|
|
78
|
+
|
|
79
|
+
Topic: {topic}
|
|
80
|
+
Platform: {platform} - {platform_context.get(platform, 'social media')}
|
|
81
|
+
Goal: {cta_context.get(cta_type, 'engage audience')}
|
|
82
|
+
|
|
83
|
+
Requirements:
|
|
84
|
+
- Natural, conversational tone
|
|
85
|
+
- Platform-appropriate language
|
|
86
|
+
- Create urgency without being pushy
|
|
87
|
+
- Each CTA should be different in approach
|
|
88
|
+
|
|
89
|
+
Format each CTA on its own line, numbered 1-{num_variants}."""
|
|
90
|
+
|
|
91
|
+
result = call_llm(prompt, max_tokens=500)
|
|
92
|
+
|
|
93
|
+
ctas = []
|
|
94
|
+
for line in result.split("\n"):
|
|
95
|
+
line = line.strip()
|
|
96
|
+
if line and (line[0].isdigit() or line.startswith("-")):
|
|
97
|
+
# Remove numbering
|
|
98
|
+
cta_text = line.lstrip("0123456789.-) ").strip()
|
|
99
|
+
if cta_text:
|
|
100
|
+
ctas.append({
|
|
101
|
+
"text": cta_text,
|
|
102
|
+
"platform": platform,
|
|
103
|
+
"type": cta_type,
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
"ctas": ctas[:num_variants],
|
|
108
|
+
"platform": platform,
|
|
109
|
+
"cta_type": cta_type,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def generate_titles(
|
|
114
|
+
topic: str,
|
|
115
|
+
platform: str = "youtube",
|
|
116
|
+
num_variants: int = 5,
|
|
117
|
+
include_emoji: bool = False,
|
|
118
|
+
) -> Dict[str, Any]:
|
|
119
|
+
"""
|
|
120
|
+
Generate platform-optimized titles.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
topic: Content topic
|
|
124
|
+
platform: Target platform
|
|
125
|
+
num_variants: Number of title variants
|
|
126
|
+
include_emoji: Include emojis in titles
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Dictionary with title variants
|
|
130
|
+
"""
|
|
131
|
+
platform_limits = {
|
|
132
|
+
"youtube": 100,
|
|
133
|
+
"x": 280,
|
|
134
|
+
"linkedin": 150,
|
|
135
|
+
"instagram": 125,
|
|
136
|
+
"tiktok": 150,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
max_chars = platform_limits.get(platform, 100)
|
|
140
|
+
|
|
141
|
+
prompt = f"""Generate {num_variants} titles for this content:
|
|
142
|
+
|
|
143
|
+
Topic: {topic}
|
|
144
|
+
Platform: {platform}
|
|
145
|
+
Max characters: {max_chars}
|
|
146
|
+
{"Include relevant emojis" if include_emoji else "No emojis"}
|
|
147
|
+
|
|
148
|
+
Title styles to include:
|
|
149
|
+
- How-to / Tutorial
|
|
150
|
+
- Listicle (X things...)
|
|
151
|
+
- Question
|
|
152
|
+
- Bold statement
|
|
153
|
+
- Curiosity gap
|
|
154
|
+
|
|
155
|
+
Format each title on its own line, numbered 1-{num_variants}."""
|
|
156
|
+
|
|
157
|
+
result = call_llm(prompt, max_tokens=400)
|
|
158
|
+
|
|
159
|
+
titles = []
|
|
160
|
+
for line in result.split("\n"):
|
|
161
|
+
line = line.strip()
|
|
162
|
+
if line and (line[0].isdigit() or line.startswith("-")):
|
|
163
|
+
title_text = line.lstrip("0123456789.-) ").strip()
|
|
164
|
+
if title_text:
|
|
165
|
+
titles.append({
|
|
166
|
+
"text": title_text[:max_chars],
|
|
167
|
+
"platform": platform,
|
|
168
|
+
"char_count": len(title_text),
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
"titles": titles[:num_variants],
|
|
173
|
+
"platform": platform,
|
|
174
|
+
}
|