{"_id":"@akhila_dev/prompt-to-form","_rev":"2-1c4b23be40a1fd2e2ba2d803be1db547","name":"@akhila_dev/prompt-to-form","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@akhila_dev/prompt-to-form","version":"0.1.0","_id":"@akhila_dev/prompt-to-form@0.1.0","maintainers":[{"name":"akhila_dev","email":"lnuakhila@gmail.com"}],"dist":{"shasum":"4763d31f12afe98f67d68901039ff4ad43a52e39","tarball":"https://registry.npmjs.org/@akhila_dev/prompt-to-form/-/prompt-to-form-0.1.0.tgz","fileCount":16,"integrity":"sha512-Qmj5Q2liF8BUO76L7OoqfoqpM5v50hN1lMC42jxGPInX9fXFd+2/ptEqrnExuTwxMidE5qwTabo+Qgu3AJjBaQ==","signatures":[{"sig":"MEQCICnhZf8kBtP3XBzZQBfpICyweaaWfqepgQyxQPvwnTsQAiBzYOrot34DapwzwOoJQbHhYoQegErzv97CiABtS81VIw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8809},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"bded2266158718b13e12ce7fa210f04d5e4af691","scripts":{"dev":"vite","lint":"eslint .","test":"vitest","build":"tsc -b && vite build","server":"tsx server/index.ts","preview":"vite preview","build:lib":"tsc -p tsconfig.lib.json"},"_npmUser":{"name":"akhila_dev","email":"lnuakhila@gmail.com"},"_npmVersion":"10.8.2","description":"Prompt to Form is a small TypeScript project that converts natural-language user requests into structured form data using an LLM.","directories":{},"_nodeVersion":"18.20.8","dependencies":{"groq-sdk":"^1.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.12","cors":"^2.8.6","vite":"^8.2.0","react":"^19.2.8","dotenv":"^17.4.2","eslint":"^10.8.0","vitest":"^4.1.11","express":"^5.2.1","globals":"^17.7.0","react-dom":"^19.2.8","@eslint/js":"^10.0.1","typescript":"~6.0.2","@types/cors":"^2.8.19","@types/node":"^24.13.3","@types/react":"^19.2.17","@types/express":"^5.0.6","@types/react-dom":"^19.2.3","typescript-eslint":"^8.65.0","@vitejs/plugin-react":"^6.0.4","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3"},"_npmOperationalInternal":{"tmp":"tmp/prompt-to-form_0.1.0_1788894450598_0.04201379277192041","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"_id":"@akhila_dev/prompt-to-form@0.1.1","bugs":{"url":"https://github.com/buildwithakhila/prompt-to-form/issues"},"dist":{"shasum":"c31a877163f9dc7dc73afa765b96c96497c04886","tarball":"https://registry.npmjs.org/@akhila_dev/prompt-to-form/-/prompt-to-form-0.1.1.tgz","fileCount":16,"integrity":"sha512-z//H3BIyVT2wUahNCixSC2NY/cVhSgeZnSMxxilbRRdAS7czXl4cJC7IgXeBnGy6E3ErOois0VZiHTt9oFsjDg==","signatures":[{"sig":"MEUCIH529es7I84TB/R96ET0deNTFjXoqvj88rsYah4MAjyDAiEAsuiGsXBLSZIJStv4EQ+pkx02zVJdUlcJzUL9AhSd2eA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCUlHJv1+EAHS32jP5hSXt4FIKEfyV88uRByUSv1iTYfQIhAJ92N4nufXE/K2CMWs3UeSSdYvpv1URUN1VtaBHufqyv"}],"unpackedSize":11343},"main":"./dist/index.js","name":"@akhila_dev/prompt-to-form","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"8824c02b355a501e4c650d1a06b96ce1d03bef39","license":"MIT","scripts":{"dev":"vite","lint":"eslint .","test":"vitest","build":"tsc -b && vite build","server":"tsx server/index.ts","preview":"vite preview","build:lib":"tsc -p tsconfig.lib.json"},"version":"0.1.1","_npmUser":{"name":"akhila_dev","email":"lnuakhila@gmail.com"},"homepage":"https://github.com/buildwithakhila/prompt-to-form#readme","keywords":["llm","forms","typescript","groq","ai","structured-data","form-validation","prompt-parser"],"repository":{"url":"git+https://github.com/buildwithakhila/prompt-to-form.git","type":"git"},"_npmVersion":"10.8.2","description":"Convert natural-language prompts into structured, validated form data using TypeScript and LLM providers.","directories":{},"maintainers":[{"name":"akhila_dev","email":"lnuakhila@gmail.com"}],"_nodeVersion":"18.20.8","dependencies":{"groq-sdk":"^1.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.12","cors":"^2.8.6","vite":"^8.2.0","react":"^19.2.8","dotenv":"^17.4.2","eslint":"^10.8.0","vitest":"^4.1.11","express":"^5.2.1","globals":"^17.7.0","react-dom":"^19.2.8","@eslint/js":"^10.0.1","typescript":"~6.0.2","@types/cors":"^2.8.19","@types/node":"^24.13.3","@types/react":"^19.2.17","@types/express":"^5.0.6","@types/react-dom":"^19.2.3","typescript-eslint":"^8.65.0","@vitejs/plugin-react":"^6.0.4","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prompt-to-form_0.1.1_1788948314248_0.4300409703351531"}}},"time":{"created":"2026-09-08T19:07:30.354Z","modified":"2026-09-09T10:05:14.507Z","0.1.0":"2026-09-08T19:07:30.737Z","0.1.1":"2026-09-09T10:05:14.339Z"},"description":"Convert natural-language prompts into structured, validated form data using TypeScript and LLM providers.","maintainers":[{"name":"akhila_dev","email":"lnuakhila@gmail.com"}],"readme":"# Prompt to Form\n\nConvert natural-language prompts into structured, validated form data using TypeScript and LLM providers.\n\nPrompt to Form extracts information from user input, detects missing required fields, validates complete results, and returns a predictable response.\n\n## Install\n\n```bash\nnpm install @akhila_dev/prompt-to-form\n```\n\n## Quick start with Groq\n\nPrompt to Form includes a Groq provider, so you don't need to implement the Groq API call yourself.\n\nYour Groq API key should be provided from a server-side environment variable.\n\n```ts\nimport {\n  createGroqProvider,\n  createPromptParser\n} from \"@akhila_dev/prompt-to-form\"\n\ntype SupportTicket = {\n  issue: string\n  priority: string\n}\n\nconst provider = createGroqProvider<SupportTicket>({\n  apiKey: process.env.GROQ_API_KEY!,\n  model: \"your-groq-model\",\n  fields: [\"issue\", \"priority\"]\n})\n\nconst schema = {\n  safeParse(data: unknown) {\n    const value = data as SupportTicket\n\n    if (\n      typeof value.issue === \"string\" &&\n      typeof value.priority === \"string\"\n    ) {\n      return {\n        success: true as const,\n        data: value\n      }\n    }\n\n    return {\n      success: false as const,\n      error: \"Invalid support ticket\"\n    }\n  }\n}\n\nconst parser = createPromptParser<SupportTicket>({\n  provider,\n  schema,\n  requiredFields: [\"issue\", \"priority\"]\n})\n\nconst result = await parser.parse(\n  \"My payment failed and I need help urgently\"\n)\n\nconsole.log(result)\n```\n\nExample result:\n\n```json\n{\n  \"data\": {\n    \"issue\": \"payment failed\",\n    \"priority\": \"urgent\"\n  },\n  \"missingFields\": [],\n  \"error\": null\n}\n```\n\n## Missing fields\n\nThe parser can return partial data when the user has not provided everything required.\n\nFor example:\n\n```text\nMy payment failed\n```\n\nIf `priority` is required, the result can be:\n\n```json\n{\n  \"data\": {\n    \"issue\": \"payment failed\"\n  },\n  \"missingFields\": [\"priority\"],\n  \"error\": null\n}\n```\n\nYour application can then ask the user only for the missing information.\n\n## Validation\n\nPrompt to Form is not tied to a specific validation library.\n\nThe parser accepts any validator implementing the `safeParse` contract. This means you can use your own validator or integrate a compatible validation library.\n\n## Custom providers\n\nThe parser is also not tied to Groq.\n\nYou can implement the `PromptProvider<TData>` interface to connect another LLM provider or your own extraction logic.\n\n```ts\nconst provider = {\n  async parse(prompt: string) {\n    return {\n      issue: \"payment failed\",\n      priority: \"urgent\"\n    }\n  }\n}\n```\n\n## How it works\n\nPrompt to Form separates LLM extraction from validation and application logic.\n\n1. Your application sends a natural-language prompt to the parser.\n2. The parser asks the configured provider to extract structured data.\n3. The provider returns partial form data.\n4. The parser checks whether required fields are missing.\n5. If all required fields are present, the configured schema validates the data.\n6. The parser returns a predictable result containing `data`, `missingFields`, and `error`.\n\n### Architecture\n\n```text\nUser prompt\n    ↓\nPrompt Parser\n    ↓\nConfigured Provider\n    ↓\nLLM / extraction logic\n    ↓\nPartial structured data\n    ↓\nRequired field check\n    ↓\nSchema validation\n    ↓\n{ data, missingFields, error }\n```\n\nThe provider is behind the `PromptProvider<TData>` interface, so the core parser is independent of the underlying LLM.\n\nThe repository also contains a React frontend and Express backend that demonstrate one way to use the package with Groq while keeping the API key server-side.\n\n## Package\n\nThe reusable library is built with:\n\n- TypeScript\n- Groq SDK for the built-in Groq provider\n- Generic provider abstraction for custom LLM integrations\n- Generic `safeParse` validation contract\n\nThe package does not require React or Express.\n\n## Demo application\n\nThis repository also contains an example application built with:\n\n- React + TypeScript\n- Node.js + Express\n- Groq\n- Vitest\n- GitHub Actions\n\n## Running demo locally\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nCreate a `.env` file in the project root:\n\n```env\nGROQ_API_KEY=your_groq_api_key\n```\n\nThe API key is only read by the Node server and is not exposed to the React frontend.\n\nStart the backend:\n\n```bash\nnpm run server\n```\n\nStart the React application in another terminal:\n\n```bash\nnpm run dev\n```\n\nThe frontend and backend run as separate processes during local development.\n\n## Testing\n\nRun the test suite with:\n\n```bash\nnpm test -- --run\n```\n\nThe parser tests cover:\n\n* partial data with missing required fields\n* complete valid data\n* invalid data returned by a provider\n\n## Continuous integration\n\nGitHub Actions runs automatically for pull requests.\n\nThe CI workflow:\n\n1. Checks out the repository\n2. Sets up Node.js\n3. Installs dependencies\n4. Runs the test suite\n5. Builds the project\n\nThis helps prevent code that fails tests or does not build successfully from being merged.\n\n## Security\n\nThe Groq API key is stored in a server-side environment variable.\n\nThe React frontend never receives the API key directly. Requests flow through the Express backend, which then communicates with Groq.\n\nThe `.env` file is excluded from Git using `.gitignore`.\n\n## Status\n\nThe current version includes:\n\n* generic prompt parser\n* provider abstraction\n* mock provider\n* Groq provider\n* required-field detection\n* Zod runtime validation\n* React demo\n* Express backend\n* unit tests\n* GitHub Actions CI\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/buildwithakhila/prompt-to-form#readme","keywords":["llm","forms","typescript","groq","ai","structured-data","form-validation","prompt-parser"],"repository":{"url":"git+https://github.com/buildwithakhila/prompt-to-form.git","type":"git"},"bugs":{"url":"https://github.com/buildwithakhila/prompt-to-form/issues"},"license":"MIT"}