Skip to content

Feat/studio universal llm schema copilot - #14

Merged
namanmukund merged 2 commits into
mainfrom
feat/studio-universal-llm-schema-copilot
Sep 20, 2026
Merged

namanmukund merged 2 commits into
mainfrom
feat/studio-universal-llm-schema-copilot

Conversation

@namanmukund

Copy link
Copy Markdown
Owner

🤖 Summary of Changes

This PR introduces the Universal AI Schema Copilot (BYO-LLM) into AutoGraphQL Studio (/studio). It allows developers to generate and refine production-grade GraphQL SDL schemas using natural language prompts, with native understanding of AutoGraphQL's custom AST directive system (@model, @tenantScoped, @ownerScoped, @history, @relation, @clamp, @validate, etc.).

🌟 Key Highlights & Capabilities

  1. Universal Multi-Provider Architecture (BYO-LLM):
    • Google Cloud Vertex AI (Gemini): Native Google SDK authentication via Application Default Credentials (gcloud auth application-default login) — supports gemini-2.5-flash, gemini-2.0-flash, and gemini-1.5-pro with zero client-side token pasting.
    • Local & Offline Open-Source Models: First-class support for Ollama (http://localhost:11434/v1 with llama3.2, qwen3, etc.), vLLM, LocalAI, and LM Studio.
    • Commercial Cloud Providers: OpenAI (gpt-4o, o3-mini), Google Gemini API (gemini-2.0-flash), Anthropic Claude (claude-3-5-sonnet), Groq (llama-3.3-70b), and OpenRouter.
    • Custom Gateways: Configurable base URLs for private self-hosted LLM clusters.
  2. 🔒 Zero-Server Storage (Privacy-First Security):
    • API keys and provider configurations are persisted exclusively in the browser's localStorage.
    • Keys are transmitted ephemerally via secure request headers (x-ai-provider, x-ai-key, x-ai-model, x-ai-base-url) and never written to disk, database, or server logs.
  3. AutoGraphQL AST Directive Nomenclature Knowledge Base:
    • The AI engine generates schemas strictly adhering to AutoGraphQL syntax:
      • Database Backing: @model(database: postgres) or MongoDB default.
      • Multi-Tenancy & RLS: @tenantScoped(field: "tenantId", claim: "tenantId"), @ownerScoped.
      • Audit Trails: @history.
      • Relational Connectors: @relation(name: "...", direction: "OUT" | "IN" | "BOTH") and @relationalMeta.
      • Field Constraints: @clamp(min, max), @validate(regex), @defaultValue(value), @unique.
      • Field Sanitization & Transforms: @trim, @nameCase, @upperCase, @lowerCase, @slug.
      • Field Security: @readOnly, @writeOnly, @filterOff, @encrypted.
      • Custom Types & Enums: Generates valid enum Status { ... } alongside types.
  4. 🔄 RAG Active Schema Awareness:
    • Scans existing .graphql files in schemas/ and dynamically injects active entities into the system prompt context so the AI can automatically link foreign keys and relationships to existing models (e.g. User, Category).
  5. 🛡️ AST Validation, Local Normalization & Self-Healing:
    • Pre-normalizes local model output quirks (e.g. model Course $\rightarrow$ type Course).
    • Parses generated SDL with graphql.parse. If an AST syntax error is detected, an automated self-healing retry loop provides AST error feedback to correct the schema before presenting it to the user.
  6. ⚡ Bi-Directional Visual Builder Sync:
    • ⚡ Sync to Visual Builder: Dynamically parses generated or edited SDL into the Visual Model Builder cards, fields, constraints, and custom enums.
    • Deploy Model ⚡: 1-click deployment compiles the schema straight into schemas/<Model>.graphql.

@namanmukund
namanmukund merged commit a632b6b into main Sep 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant