feat: enhance OpenAPI insights generation with structured metadata and summary

This commit is contained in:
Udhay-Adithya
2025-09-21 00:59:30 +05:30
parent ce3248dec0
commit 3a4a871676
3 changed files with 178 additions and 41 deletions

View File

@@ -453,6 +453,7 @@ RETURN THE JSON ONLY.
// Provide insights and suggestions after importing an OpenAPI spec
String openApiInsightsPrompt({
required String specSummary,
Map<String, dynamic>? specMeta,
}) {
return """
<system_prompt>
@@ -464,13 +465,17 @@ STRICT OFF-TOPIC POLICY
CONTEXT (OPENAPI SUMMARY)
${specSummary.trim()}
CONTEXT (OPENAPI META, JSON)
${specMeta ?? '{}'}
TASK
- Provide practical, user-friendly insights based on the API spec:
- Identify noteworthy endpoints (e.g., CRUD sets, auth/login, health/status) and common patterns.
- Point out authentication/security requirements (e.g., API keys, OAuth scopes) if present.
- Suggest a few starter calls (e.g., list/search) and a short onboarding path.
- Call out potential pitfalls (rate limits, pagination, required headers, content types).
- Keep it concise and actionable: 12 line summary → 46 bullets → 23 next steps.
- Use the meta JSON when present to be specific about routes, tags, and content types.
- Keep it detailed and actionable: 610 line summary → 46 bullets → 23 next steps.
OUTPUT FORMAT (STRICT)
- Return ONLY a single JSON object.