{"_id":"@digitalchokro/provider-groq","_rev":"2-332e96f7eea6e36f10b9a082546d22d8","name":"@digitalchokro/provider-groq","dist-tags":{"latest":"2.0.7"},"versions":{"2.0.6":{"name":"@digitalchokro/provider-groq","version":"2.0.6","keywords":["askchokro","sql","groq","lpu","ai","llm","text-to-sql","nlp","rag","database","analytics"],"author":{"name":"Digital Chokro","email":"hello@digitalchokro.com"},"license":"MIT","_id":"@digitalchokro/provider-groq@2.0.6","maintainers":[{"name":"imnurmohammad.me","email":"founder@digitalchokro.com"}],"homepage":"https://github.com/digitalchokro/askchokro#readme","bugs":{"url":"https://github.com/digitalchokro/askchokro/issues"},"dist":{"shasum":"1843230126b6b9d3dd3c5266772aae221d243614","tarball":"https://registry.npmjs.org/@digitalchokro/provider-groq/-/provider-groq-2.0.6.tgz","fileCount":6,"integrity":"sha512-dVEdj2xYNGkqJDmzut6pZlpkj/HiwYY7v1zgu0X/RuwC8bNXRnsobnAWT2ur/0igVhwgWtLrWOvpiRMmP0iJhQ==","signatures":[{"sig":"MEYCIQCkDOUInK3u+BNPllPRgUxArtVxagCQfDhekKWKZok9VwIhAIa/grtFw5r/+LFo3XZMetQ1JdOPrtygsKdVONAGwWkS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35661},"main":"./dist/index.js","type":"module","_from":"file:digitalchokro-provider-groq-2.0.6.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsup src/index.ts --format esm --dts --watch --sourcemap","lint":"eslint src/","test":"vitest run","build":"tsup src/index.ts --format esm --dts --sourcemap","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"imnurmohammad.me","email":"founder@digitalchokro.com"},"_resolved":"/tmp/cdee86d1a6e46e0a04c08ba8e07c6d42/digitalchokro-provider-groq-2.0.6.tgz","_integrity":"sha512-dVEdj2xYNGkqJDmzut6pZlpkj/HiwYY7v1zgu0X/RuwC8bNXRnsobnAWT2ur/0igVhwgWtLrWOvpiRMmP0iJhQ==","repository":{"url":"git+https://github.com/digitalchokro/askchokro.git","type":"git","directory":"packages/provider-groq"},"_npmVersion":"10.9.8","description":"Groq provider for AskChokro (ultra-fast LPU inference).","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","openai":"^4.104.0","vitest":"^2.0.0","typescript":"^5.5.0","@digitalchokro/core":"1.1.6"},"peerDependencies":{"openai":"^4.0.0","@digitalchokro/core":"1.1.6"},"_npmOperationalInternal":{"tmp":"tmp/provider-groq_2.0.6_1784825633906_0.7562748767406737","host":"s3://npm-registry-packages-npm-production"}},"2.0.7":{"name":"@digitalchokro/provider-groq","version":"2.0.7","description":"Groq provider for AskChokro (ultra-fast LPU inference).","license":"MIT","author":{"name":"Digital Chokro","email":"hello@digitalchokro.com"},"repository":{"type":"git","url":"git+https://github.com/digitalchokro/askchokro.git","directory":"packages/provider-groq"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","peerDependencies":{"openai":"^4.0.0","@digitalchokro/core":"1.1.6"},"devDependencies":{"openai":"^4.104.0","tsup":"^8.0.0","typescript":"^5.5.0","vitest":"^2.0.0","@digitalchokro/core":"1.1.6"},"keywords":["askchokro","sql","groq","lpu","ai","llm","text-to-sql","nlp","rag","database","analytics"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts --format esm --dts --sourcemap","dev":"tsup src/index.ts --format esm --dts --watch --sourcemap","lint":"eslint src/","typecheck":"tsc --noEmit","test":"vitest run","clean":"rm -rf dist"},"_id":"@digitalchokro/provider-groq@2.0.7","bugs":{"url":"https://github.com/digitalchokro/askchokro/issues"},"homepage":"https://github.com/digitalchokro/askchokro#readme","_integrity":"sha512-xlzKaGIEwghfDFSFpFSBI4FYM8Nn/0yPChfoPEbHWr/X4RNUwzBvxRdylidxUAvd3wwDIAw4ag8TGLe7esETVg==","_resolved":"/tmp/f7bd58b724963595c2ea155ea64cab90/digitalchokro-provider-groq-2.0.7.tgz","_from":"file:digitalchokro-provider-groq-2.0.7.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-xlzKaGIEwghfDFSFpFSBI4FYM8Nn/0yPChfoPEbHWr/X4RNUwzBvxRdylidxUAvd3wwDIAw4ag8TGLe7esETVg==","shasum":"1ade24313d4c7d0dcc65870f0e8a111b15cabe51","tarball":"https://registry.npmjs.org/@digitalchokro/provider-groq/-/provider-groq-2.0.7.tgz","fileCount":6,"unpackedSize":35661,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCd71l7bzcDFa8tmSGhBNx0XA7FOvF+P8oRwcLCMUZL3QIhAL4QomsqaGzBOZ29zt2pBCj6XY4RjN+ZVexzkXFQKByN"}]},"_npmUser":{"name":"imnurmohammad.me","email":"founder@digitalchokro.com"},"directories":{},"maintainers":[{"name":"imnurmohammad.me","email":"founder@digitalchokro.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/provider-groq_2.0.7_1784866631184_0.01491928211801552"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T16:53:53.764Z","modified":"2026-07-24T04:17:11.508Z","2.0.6":"2026-07-23T16:53:54.039Z","2.0.7":"2026-07-24T04:17:11.361Z"},"bugs":{"url":"https://github.com/digitalchokro/askchokro/issues"},"author":{"name":"Digital Chokro","email":"hello@digitalchokro.com"},"license":"MIT","homepage":"https://github.com/digitalchokro/askchokro#readme","keywords":["askchokro","sql","groq","lpu","ai","llm","text-to-sql","nlp","rag","database","analytics"],"repository":{"type":"git","url":"git+https://github.com/digitalchokro/askchokro.git","directory":"packages/provider-groq"},"description":"Groq provider for AskChokro (ultra-fast LPU inference).","maintainers":[{"name":"imnurmohammad.me","email":"founder@digitalchokro.com"}],"readme":"<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/digitalchokro/askchokro/main/docs/assets/logo.png\" width=\"120\" alt=\"AskChokro Logo\" />\n  <h1>AskChokro</h1>\n  <p><strong>The AI Data Engine for Node.js</strong></p>\n  <p>Add \"Ask your data\" to any SaaS app in 10 minutes. Simpler by design, built for embedding.</p>\n  \n  [![npm version](https://img.shields.io/npm/v/@digitalchokro/askchokro.svg?style=flat-square)](https://www.npmjs.com/package/@digitalchokro/askchokro)\n  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n</div>\n\n<div align=\"center\">\n  <em>(Looking for Bengali? <a href=\"./README-bn.md\">Read in Bengali / বাংলায় পড়ুন</a>)</em>\n</div>\n<br/>\n<p align=\"center\">\n  <picture>\n    <img src=\"https://raw.githubusercontent.com/digitalchokro/askchokro/main/docs/assets/logo.png\" width=\"800\" height=\"2\" style=\"background: linear-gradient(90deg, transparent, #8e9eab, #eef2f3, #8e9eab, transparent); border-radius: 5px;\"/>\n  </picture>\n</p>\n<br/>\n\n## Instantly see it in action\n\nNo setup, no accounts, just a terminal.\n\n```bash\nnpx @digitalchokro/cli demo\n```\nThis spins up a local SQLite database with sample e-commerce data, auto-detects **Ollama, OpenAI, or Anthropic**, and opens a beautiful Chat UI on `localhost:3000`.\n\n### Demo Database Schema\nThe in-memory SQLite database is seeded with a comprehensive e-commerce schema to test complex queries against:\n- `users` (id, name, email, country, created_at)\n- `products` (id, name, category, price, stock)\n- `orders` (id, user_id, total_amount, status, created_at)\n- `order_items` (id, order_id, product_id, quantity, price)\n- `carts` (id, user_id, created_at)\n- `cart_items` (id, cart_id, product_id, quantity)\n\n*Try asking: \"Who has items in their cart right now?\", \"Which category generates the most revenue?\", \"List all pending orders with amounts\", or \"Show me products under $100\".*\n\n### Anti-Hallucination Fallback (`CANNOT_ANSWER`)\nAskChokro's engine uses a strict system prompt. If you ask a question about data that does not exist in the schema, the model will safely reject the prompt and return `CANNOT_ANSWER` instead of hallucinating fake tables or SQL.\n\n> **Note:** AskChokro can intelligently answer multiple disjoint questions in a single prompt by automatically combining them into scalar subqueries, ensuring you get all your answers in a single database round-trip without breaking the SQL driver.\n\n### Using Local Models (Ollama)\nIf you want to force a specific provider or model, use environment variables:\n\n```bash\n# Force Ollama with a specific model (ignores any API keys in your environment)\nASKCHOKRO_PROVIDER=ollama ASKCHOKRO_MODEL=qwen2.5-coder npx @digitalchokro/cli demo\n\n# Force Anthropic\nASKCHOKRO_PROVIDER=anthropic ANTHROPIC_API_KEY=sk-ant-... npx @digitalchokro/cli demo\n```\n\n---\n\n## Why AskChokro?\n\nIf you've tried building \"AI analytics\" features into your SaaS, you know the drill:\n- **Python wrappers:** You have to deploy a separate Python microservice just to run LangChain or LlamaIndex.\n- **Heavy BI tools:** You look at tools like WrenAI or Superset, but they are full platforms. You just want a simple API endpoint to power a chat box in your own React app.\n- **Security nightmares:** How do you guarantee the AI doesn't `DROP TABLE` or leak Tenant A's data to Tenant B?\n\n**AskChokro is different:**\n1. **100% TypeScript.** Runs right in your Node.js backend (Next.js, Express, Fastify).\n2. **Zero-Config.** The `AskChokro` wrapper auto-detects `DATABASE_URL`, `OPENAI_API_KEY`, and `ANTHROPIC_API_KEY` - and falls back to a local Ollama instance seamlessly when no keys are found.\n3. **AST-Level Security.** We don't just rely on prompt engineering. We parse the LLM's SQL into an Abstract Syntax Tree (AST), strictly validate it's a read-only `SELECT`, and *automatically rewrite the AST* to enforce tenant scoping before executing it.\n\n## Quick Start (Next.js App Router)\n\nInstall the core engine and the Next.js adapter:\n\n```bash\nnpm install @digitalchokro/askchokro @digitalchokro/adapter-nextjs @digitalchokro/provider-openai @digitalchokro/db-postgres\n```\n\nCreate a route handler at `app/api/ask/route.ts`:\n\n```typescript\n// app/api/ask/route.ts\nimport { AskChokro } from '@digitalchokro/askchokro';\nimport { createAskChokroRoute } from '@digitalchokro/adapter-nextjs';\n\n// Auto-detects process.env.DATABASE_URL and process.env.OPENAI_API_KEY\nconst agent = new AskChokro();\n\nexport const POST = createAskChokroRoute(agent);\n```\n\nOn your frontend:\n\n```javascript\nconst res = await fetch('/api/ask', {\n  method: 'POST',\n  body: JSON.stringify({ question: 'Who are my top 5 customers this month?' })\n});\n\nconst { answer, sql, rows } = await res.json();\nconsole.log(sql);  // \"SELECT name, SUM(amount) FROM orders GROUP BY name ORDER BY SUM(amount) DESC LIMIT 5\"\nconsole.table(rows);\n```\n\nThat's it. You just shipped AI data analytics.\n\n## Multi-Tenant Security (AST Rewriting)\n\nWhen embedding AI in B2B SaaS, tenant isolation is the hardest problem. Naive string-appending (`WHERE tenant_id = X`) fails when the AI generates subqueries or complex `JOIN`s that bypass the filter.\n\nAskChokro uses a sophisticated **AST Scope Rewriter**. \n\n```typescript\nimport { DatabaseAgent } from '@digitalchokro/core';\nimport { PostgresAdapter } from '@digitalchokro/db-postgres';\nimport { OpenAIProvider } from '@digitalchokro/provider-openai';\n\nconst agent = new DatabaseAgent({\n  db: new PostgresAdapter({ connectionString: process.env.DATABASE_URL }),\n  ai: new OpenAIProvider({ model: 'gpt-4o' }),\n  options: {\n    tenantScoping: {\n      enabled: true,\n      column: 'organization_id',\n      // Injects the current user's org ID from your request context\n      getValue: (ctx) => ctx.orgId, \n    }\n  }\n});\n```\n\nWith `tenantScoping` enabled, if the AI generates:\n```sql\nSELECT o.id, u.email FROM orders o JOIN users u ON o.user_id = u.id\n```\n\nAskChokro's AST rewriter physically intercepts the query, parses the syntax tree, and injects your tenant logic into *every* table reference before sending it to the database:\n```sql\nSELECT o.id, u.email \nFROM orders o \nJOIN users u ON o.user_id = u.id AND u.organization_id = 'org_123'\nWHERE o.organization_id = 'org_123'\n```\n\n*AskChokro dramatically reduces risk with a fail-closed design. See our [Security Guide](./docs/SECURITY.md) for full details on the 9-layer defense.*\n\n## Accuracy Benchmarks\n\nWe test AskChokro against a rigorous, open-source dataset of 198 complex SQL scenarios.\n\n| Model | Overall | Aggregations | Multi-Table JOINs | Tenant Scoping |\n|---|---|---|---|---|\n| **GPT-4o** | **95.9%** | 98% | 95% | 100% |\n| **Claude 3.5 Sonnet** | **96.5%** | 99% | 96% | 100% |\n| **Qwen 2.5 Coder (Local)** | **87.8%** | 88% | 85% | 100% |\n\n*(For full methodology, see our CI eval harness).*\n\n## Current Limitations\n\nAskChokro is designed to be simple and secure, which means it currently makes some intentional trade-offs:\n- **Multi-Part Questions Supported:** AskChokro safely handles disjoint, multi-part questions by mapping them into unified scalar subqueries. However, the root AST must ultimately resolve to a single SQL tabular structure to ensure compatibility across all database drivers.\n- **No DML (Mutations):** It is strictly read-only. `INSERT`, `UPDATE`, `DELETE`, and `DROP` are explicitly blocked at the AST level.\n- **Complex Aggregations:** While it handles joins and basic aggregations well, extremely complex window functions or recursive CTEs might confuse smaller local models.\n\n## Coming Soon: WordPress Plugin\n\nWe are actively developing an official **AskChokro WordPress Plugin**. \nThis will allow you to drop an AI data assistant directly into your WooCommerce dashboard with zero code. \n\n**The WordPress Roadmap:**\n- **Phase 1:** AskChokro Node.js Microservice (Pre-configured Docker container)\n- **Phase 2:** WordPress PHP Plugin (Settings UI & Gutenberg Blocks)\n- **Phase 3:** Automatic Tenant Isolation for Multi-Vendor setups\n\nRead the [Integration Architecture](https://github.com/digitalchokro/askchokro/blob/main/docs/INTEGRATION_ARCHITECTURE.md) to learn how this works behind the scenes.\n\n## Frequently Asked Questions (FAQ)\n\n\n\n## Documentation\n\n- [Quick Start](./docs/QUICK_START.md) - Full 5-minute integration guide.\n- [Security Model](./docs/SECURITY.md) - Deep dive into AST validation, column masking, and read-only sandboxes.\n- [Plugin Development](./docs/PLUGINS.md) - Learn how to build your own `AIProvider` or `DatabaseAdapter`.\n- [Integration Architecture](https://github.com/digitalchokro/askchokro/blob/main/docs/INTEGRATION_ARCHITECTURE.md) - Learn how to embed AskChokro across platforms.\n\n## Contributing\n\nWe are actively looking for contributors! Check out our [Contributing Guide](CONTRIBUTING.md) and look for issues tagged `good first issue`.\n\nIf you want to add support for MySQL, Gemini, Google Vertex, or Fastify, we have automated templates waiting for you.\n\n## License\n\nMIT © Digital Chokro\n","readmeFilename":"README.md"}