You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Failed health checks automatically receive AI-powered remediation hints via `analyzeFailure()`. These are stored in the `ai_suggestion` column of `health_results`.
23
+
24
+
## Rule: Cron Schedule
25
+
26
+
Health suite runs weekly via cron `0 3 * * 0` (Sundays 3AM UTC).
27
+
On-demand runs are available via `POST /api/health/run`.
28
+
29
+
## Rule: Frontend Sync
30
+
31
+
The frontend at `/health`**must** display all categories defined in `CATEGORY_META` in `Health.tsx`.
32
+
When adding a new `HealthCategory` to `types.ts`, also add an entry to the frontend registry.
prompt = f"Review the following list of newly created repositories. Select the top 5 most innovative or interesting ones, and provide a brief summary of today's trends.\n\nData: {json.dumps(raw_repos)}"
111
+
112
+
response = completion(
113
+
model="openai/@cf/openai/gpt-oss-120b",
114
+
api_base=api_base,
115
+
api_key=os.environ["CF_API_TOKEN"],
116
+
messages=[
117
+
{"role": "system", "content": "You are an expert developer curating daily tech trends. Return ONLY valid JSON matching the requested schema."},
118
+
{"role": "user", "content": prompt}
119
+
],
120
+
response_format=DailyReport,
121
+
max_tokens=4096,
122
+
extra_body={"reasoning": {"effort": "high"}}
123
+
)
124
+
125
+
return response.choices[0].message.content
126
+
127
+
def main():
128
+
g = Github(os.environ["GITHUB_TOKEN"])
129
+
130
+
# 1. Fetch raw data from GitHub
131
+
raw_repos = get_raw_trends(g)
132
+
133
+
# 2. Curate using Cloudflare Workers AI + LiteLLM
134
+
ai_curated_json_str = curate_with_ai(raw_repos)
135
+
136
+
# 3. Post to Worker
137
+
worker_url = os.environ.get("WORKER_API_URL")
138
+
if worker_url:
139
+
print("Posting curated trends to Worker API...")
140
+
141
+
# Parse string to dict to ensure valid JSON payload
print(f"Executing Deep Research analysis for: {query}")
59
+
60
+
# 3. Call the model using LiteLLM
61
+
response = completion(
62
+
# The 'openai/' prefix tells LiteLLM to treat this custom endpoint exactly like OpenAI
63
+
model="openai/@cf/openai/gpt-oss-120b",
64
+
api_base=api_base,
65
+
api_key=api_token,
66
+
messages=[
67
+
{"role": "system", "content": "You are a code analyzer. Extract structured data from the provided repository description. You must strictly adhere to the requested JSON schema."},
68
+
{"role": "user", "content": f"Analyze this repository based on the search query: '{query}'."}
69
+
],
70
+
71
+
# 4. Enforce Structured Output
72
+
# LiteLLM automatically converts this Pydantic class into JSON Schema for Cloudflare
73
+
response_format=RepoAnalysis,
74
+
75
+
# 5. Reasoning Tokens Configuration
76
+
# Allocate 4096 tokens and force 'high' effort to simulate a "minimum" reasoning constraint
77
+
max_tokens=4096,
78
+
extra_body={
79
+
"reasoning": {
80
+
"effort": "high"
81
+
}
82
+
}
83
+
)
84
+
85
+
# 6. Extract and validate the response
86
+
# The model returns a stringified JSON object matching our Pydantic schema
0 commit comments