{"_id":"o-reasonable","_rev":"8-79ea752836571ba541b2a7604a255864","name":"o-reasonable","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"name":"o-reasonable","version":"0.0.1","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.1","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"43fef1113b4b743255046ccde0d78e1025e5d98c","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.1.tgz","fileCount":7,"integrity":"sha512-/QU003XrpZrKloe4KL0ywoT+kSZ18z5tXgqr03TvY2qtbG0FglTZhiw4aD1wrFc3MIaEGfoNm8IWsQe/qylvwA==","signatures":[{"sig":"MEUCIAxgEhypDyXAYALT75n0/FBOD0j7tNU8+PVFryNaS/w5AiEAt0vs/bO29Q6G1KQLCcLBemulLLvcbHgsTUKJGo0Nl7U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8569},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"10.8.2","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.1_1744884137122_0.6222634035304868","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"o-reasonable","version":"0.0.2","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.2","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"2fffa55f31f5d5e836eb744e88aa3af6fa2bce39","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.2.tgz","fileCount":4,"integrity":"sha512-gzVsF1srhLRjPBPP7iwvVAgCDgpPY9ve2oICXsBuxBhU11W2fOxbg0QHgHKpNil/wYilWJAi91s1H8IPpZ7CeQ==","signatures":[{"sig":"MEUCICK4fwewv8eMWYd0LiXBlOa+NcqwdSX7/MD8jIlpBMOJAiEA2rApZK4QZEAHvhR/BTnozgA7HUprbpxeZGHj8VUdoWY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":409246},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"gitHead":"88ddc2e8c52418e94bdc1d6ca86de14ebc64d2c6","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"10.8.2","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.2_1744884584540_0.739146441932647","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"o-reasonable","version":"0.0.3","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.3","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"39a8d95acc5fc14d6ada0fec954d7c88cc454e39","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.3.tgz","fileCount":4,"integrity":"sha512-Jif5iSWP71gGeRlAyG0TumPt8DDBrpC0JYUA/ZGzAGl9O91ZMwDboUUdxDnudJPbVXWKpgrQYz8ItypHLyJ+WA==","signatures":[{"sig":"MEUCIQD1DORNO7QfufM63fitwfSPccl/Is/iQgzX+yEQ3qWyzQIgC8wNYdJIEdTrgRXbyAuevhMdgdVxW0hD4mwJJu4IUfg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":409013},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"gitHead":"0b94619676223332987d8f89cc36faa0eeef2393","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"10.8.2","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.3_1744887772548_0.6153717724157524","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"o-reasonable","version":"0.0.4","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.4","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"237001346d4355b83f3a548f70cba004bedacb81","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.4.tgz","fileCount":4,"integrity":"sha512-mjmAjRbGjuSs1I8gIk5FC7T7XCHBvZrEBFEca+tWn+ChjgkHXwU6oppmZeRSHNW+Am6zPBHUu1MmicE5ev5OSA==","signatures":[{"sig":"MEQCIHuO0o33zb+20ukXL1rujIOciUjgX1R/gqIUPhLaKudrAiAKVso3byUefhdB7KbCesQIJT8mcaM82PGH4GIHmFBikQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":409036},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"gitHead":"98d6f53b7c7e85782b7a7b637fdf7927f1dd2019","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"10.8.2","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.4_1744890514363_0.6719142098277031","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"o-reasonable","version":"0.0.5","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.5","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"34a6085b5b767a0d5f9f30a7a7c4779878a19e3b","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.5.tgz","fileCount":4,"integrity":"sha512-1BtjoXt1tXcYaFO8Apy24hLYhdJLQIdg+LGFv5723qDre3CNxIoOl+zfWMvEg/7rN1lO5SY0UUwSVLOJXEdrGw==","signatures":[{"sig":"MEQCICy0wJcaTu2YbwTlXpd3R6Z1+D+htvnU/nANka86HNEbAiB8M3GmXamkhW5/PIYV0NgKD9WDGX+pcngmQG2jTL57Ig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":410463},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"10.7.0","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"18.20.4","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.5_1744896054877_0.8224848149577273","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"o-reasonable","version":"0.0.6","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.6","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"e8e027bbe61ad6a880b5bfbc41309ad69bb9d9f5","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.6.tgz","fileCount":4,"integrity":"sha512-YBCEkIzo4SSLEZavEcHMaiKSPX5bE3twD7CQGA0kIBKCQ+Xq94MsGP/hDKroOA+2uS4hoXKRZ2pspbkaAC7Bvg==","signatures":[{"sig":"MEUCIEBWgGX7OWtvzYftzquAHyMGlS+Flo8hSsLQquxSCTkQAiEA+yOGje3R5cj8Hq3xBmxjwo0vruVC5axTrWlWjpqUK24=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":411930},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"gitHead":"dcbfcdf44dcf2b0b483b96ca17f5350d96bdc54a","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"9.8.1","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"22.17.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.6_1757708087649_0.09207639338894924","host":"s3://npm-registry-packages-npm-production"}},"0.0.61":{"name":"o-reasonable","version":"0.0.61","keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","_id":"o-reasonable@0.0.61","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"homepage":"https://github.com/chihebnabil/o-reasonable#readme","bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"dist":{"shasum":"f9eeed1604e746c2ed4e3bcb26ae1f13c4f28dda","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.61.tgz","fileCount":4,"integrity":"sha512-CrXXUXASIkh4DZbXs+q7meh97qIMqa1VgX8ePQoZ8/WIutvp4wnHRnpo7bT4jkxaczXlQch3cPdeEJ20i/PGTw==","signatures":[{"sig":"MEYCIQCPULKgj11HQgXaELi1rMXPSHaD+kRI1Bg37/OFlCWuiAIhAPViRmIxdM/HLePNxASfTuJh8UD9gzhKjBLkxOr6h/hj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":412664},"main":"./dist/index.cjs.js","type":"module","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"gitHead":"dcbfcdf44dcf2b0b483b96ca17f5350d96bdc54a","scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"repository":{"url":"git+https://github.com/chihebnabil/o-reasonable.git","type":"git"},"_npmVersion":"9.8.1","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","directories":{},"_nodeVersion":"22.17.0","dependencies":{"zod":"^3.24.3","dotenv":"^16.4.1","openai":"^4.95.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.1","typescript":"~5.7.2","vite-tsconfig-paths":"^5.1.4"},"_npmOperationalInternal":{"tmp":"tmp/o-reasonable_0.0.61_1757708331852_0.3057612152333047","host":"s3://npm-registry-packages-npm-production"}},"0.0.7":{"name":"o-reasonable","version":"0.0.7","description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","type":"module","main":"./dist/index.cjs.js","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","prepublishOnly":"npm run build"},"devDependencies":{"typescript":"~5.7.2","vite":"^6.3.1","vite-tsconfig-paths":"^5.1.4"},"dependencies":{"dotenv":"^16.4.1","openai":"^4.95.0","zod":"^3.24.3"},"keywords":["openai","reasoning","ai","planning","typescript"],"author":"","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chihebnabil/o-reasonable.git"},"bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"homepage":"https://github.com/chihebnabil/o-reasonable#readme","_id":"o-reasonable@0.0.7","gitHead":"edd41695b87ce12d972101b15a095d6f18156634","_nodeVersion":"22.17.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-wzI7HJFd7Z+MvMhpjx9uaFGxpHGHrYxF9T+eC7sGshp3+jyxp7XbgCUz2p6OhhMZ2qja2iWxVjK+RNf6tdxwKg==","shasum":"8d9d0a583725dd7304b080616d017926bac394e9","tarball":"https://registry.npmjs.org/o-reasonable/-/o-reasonable-0.0.7.tgz","fileCount":4,"unpackedSize":426479,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAwF4LTGoMaZPI/DOC63lx+H8+NnzubzrJMuYUr9yy0TAiAMhvbVESszHZhw7PjJcjpOOR+4ioYtfZcSudWDdr+f+w=="}]},"_npmUser":{"name":"chihebnabil","email":"chiheb.design@gmail.com"},"directories":{},"maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/o-reasonable_0.0.7_1757709370665_0.31148314559496093"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-17T10:02:17.121Z","modified":"2025-09-12T20:36:11.074Z","0.0.1":"2025-04-17T10:02:17.299Z","0.0.2":"2025-04-17T10:09:44.732Z","0.0.3":"2025-04-17T11:02:52.740Z","0.0.4":"2025-04-17T11:48:34.551Z","0.0.5":"2025-04-17T13:20:55.080Z","0.0.6":"2025-09-12T20:14:47.844Z","0.0.61":"2025-09-12T20:18:52.021Z","0.0.7":"2025-09-12T20:36:10.890Z"},"bugs":{"url":"https://github.com/chihebnabil/o-reasonable/issues"},"license":"MIT","homepage":"https://github.com/chihebnabil/o-reasonable#readme","keywords":["openai","reasoning","ai","planning","typescript"],"repository":{"type":"git","url":"git+https://github.com/chihebnabil/o-reasonable.git"},"description":"O-Reasonable is a lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer, making it a ","maintainers":[{"name":"chihebnabil","email":"chiheb.design@gmail.com"}],"readme":"# O-Reasonable 🧠\n\nA lightweight reasoning agent designed to mimic logical planning and problem-solving capabilities using cost-effective OpenAI models. It generates step-by-step plans, executes them sequentially, and synthesizes a final answer.\n\n[![demo](./demo.gif)]\n\n## Features\n\n- 🎯 Dynamic model selection with sensible defaults\n- 📋 Structured step-by-step planning\n- 🔄 Sequential execution of reasoning steps\n- 🎨 Clean and informative console output\n- ⚡ Built with TypeScript and Vite\n\n## Installation\n\n```bash\nnpm install o-reasonable\n```\n\n## Configuration\n\nYou'll need to set up your OpenAI API key as an environment variable:\n\n```bash\nexport OPENAI_API_KEY=your-api-key-here\n```\n\nOr create a `.env` file in your project root:\n\n```env\nOPENAI_API_KEY=your-api-key-here\n```\n\n## Usage\n\n```typescript\nimport { runAgent } from 'o-reasonable';\n\n// Basic usage with default model (logs enabled by default)\nconst result = await runAgent(\"What would be the impact of implementing a four-day work week?\");\n\n// Using a custom model with logs disabled\nconst result = await runAgent(\"Analyze the pros and cons of remote work\", {\n  model: \"gpt-4o-mini\",\n  enableLogs: false\n});\n\n// The result contains steps and final answer\nconsole.log(result.steps);         // Array of step results\nconsole.log(result.finalQuestion); // The final question asked\nconsole.log(result.finalAnswer);   // The final synthesized answer\n```\n\n## Configuration Options\n\nThe `runAgent` function accepts a configuration object with the following options:\n\n```typescript\ninterface OReasonableConfig {\n  model?: string;         // OpenAI model to use (default: \"gpt-4o-mini\")\n  apiKey?: string;        // Optional API key override\n  baseURL?: string;       // Custom base URL for OpenAI-compatible APIs\n  enableLogs?: boolean;   // Enable/disable console logs (default: false)\n  enableReflection?: boolean; // Enable step validation and reflection (default: true)\n  minConfidence?: number; // Minimum confidence threshold for steps (default: 0.6)\n  maxRetries?: number;    // Maximum retries for low-confidence steps (default: 1)\n}\n```\n\n## Enhanced Reasoning Features\n\nO-Reasonable now includes advanced reasoning capabilities that significantly improve the quality and reliability of the generated responses:\n\n### 🔍 **Step Validation & Reflection**\nEach reasoning step is automatically validated for:\n- **Confidence**: How certain the AI is about the step's accuracy\n- **Relevance**: How well the step contributes to solving the original task\n- **Logical soundness**: Whether the reasoning is well-founded\n\n### 🧠 **Smart Context Management**\n- **Context Summarization**: Automatically summarizes previous steps to maintain focus\n- **Conversation Threading**: Builds coherent conversation history between steps\n- **Relevance Filtering**: Keeps only the most important information for subsequent steps\n\n### 🔄 **Adaptive Execution**\n- **Quality Thresholds**: Automatically retries steps that don't meet confidence requirements\n- **Enhanced Planning**: Uses proven reasoning frameworks (analytical, comparative, causal, creative)\n- **Self-Evaluation**: Reflects on the overall reasoning process quality\n\n### 📊 **Confidence Tracking**\n- Individual step confidence scores\n- Overall reasoning confidence\n- Quality metrics for each step\n\n```typescript\n// Enhanced reasoning with validation\nconst result = await runAgent(\"Analyze the impact of remote work on productivity\", {\n  enableReflection: true,    // Enable step validation and reflection\n  minConfidence: 0.7,        // Require high confidence (0.0-1.0)\n  maxRetries: 2,             // Retry low-confidence steps up to 2 times\n  enableLogs: true\n});\n\n// Access enhanced results\nconsole.log(result.steps);              // Array of StepResult objects with confidence scores\nconsole.log(result.overallConfidence);  // Overall reasoning confidence (0.0-1.0)\nconsole.log(result.reflections);        // Self-evaluation of reasoning quality\n```\n\n### Step Result Structure\n```typescript\ninterface StepResult {\n  content: string;      // The step's reasoning content\n  confidence: number;   // Confidence score (0.0-1.0)\n  relevance: number;    // Relevance to original task (0.0-1.0)\n  isValid: boolean;     // Whether the step passed validation\n  reasoning: string;    // Explanation of the validation\n}\n```\n\n## Using OpenAI-Compatible APIs\n\nO-Reasonable supports any OpenAI-compatible API by specifying a custom `baseURL`. Here are some examples:\n\n### Local Models (Ollama, LM Studio, etc.)\n\n```typescript\nimport { runAgent } from 'o-reasonable';\n\n// Using Ollama with a local model\nconst result = await runAgent(\"Explain quantum computing\", {\n  baseURL: \"http://localhost:11434/v1\",\n  model: \"llama2\", // or any model available in Ollama\n  apiKey: \"ollama\" // Ollama requires any non-empty key\n});\n\n// Using LM Studio\nconst result = await runAgent(\"What are the benefits of TypeScript?\", {\n  baseURL: \"http://localhost:1234/v1\",\n  model: \"local-model\",\n  apiKey: \"lm-studio\"\n});\n```\n\n### Azure OpenAI\n\n```typescript\nconst result = await runAgent(\"Analyze market trends\", {\n  baseURL: \"https://your-resource.openai.azure.com\",\n  model: \"gpt-35-turbo\", // Azure deployment name\n  apiKey: process.env.AZURE_OPENAI_API_KEY\n});\n```\n\n### Other OpenAI-Compatible Providers\n\n```typescript\n// Example with any OpenAI-compatible service\nconst result = await runAgent(\"Create a project plan\", {\n  baseURL: \"https://api.your-provider.com/v1\",\n  model: \"your-model-name\",\n  apiKey: \"your-api-key\"\n});\n```\n\n## Return Type\n\nThe `runAgent` function returns a promise that resolves to an enhanced `AgentResult`:\n\n```typescript\ninterface AgentResult {\n  steps: StepResult[];      // Enhanced step results with confidence scores\n  finalQuestion: string;    // The final question that was asked\n  finalAnswer: string;      // The synthesized final answer\n  overallConfidence: number; // Overall confidence in the reasoning (0.0-1.0)\n  reflections: string[];    // Self-evaluation and reflection insights\n}\n```\n\n## Examples\n\n### Quick Start\n```bash\n# Try the quick example\nnode quickstart.js\n```\n\n### Comprehensive Examples\n```bash\n# Run all examples (JavaScript)\nnode example.js\n\n# Run TypeScript examples (requires ts-node)\nnpx ts-node example.ts\n\n# Try different configurations\nnode examples/configurations.js\n```\n\n### Basic Usage\n```typescript\nimport { runAgent } from 'o-reasonable';\n\nconst result = await runAgent(\"What are the key factors in choosing a programming language?\");\nconsole.log(result.finalAnswer);\nconsole.log(`Confidence: ${result.overallConfidence.toFixed(2)}`);\n```\n\n### Advanced Reasoning Configuration\n```typescript\n// High-quality reasoning with strict validation\nconst result = await runAgent(\"Design a sustainable urban transportation system\", {\n  enableReflection: true,\n  minConfidence: 0.8,      // Require very high confidence\n  maxRetries: 3,           // Allow more retries for quality\n  enableLogs: true,\n  model: \"gpt-4\"\n});\n\n// Analyze step quality\nresult.steps.forEach((step, i) => {\n  console.log(`Step ${i+1}: Confidence ${step.confidence.toFixed(2)}, Relevance ${step.relevance.toFixed(2)}`);\n});\n```\n\n### Debugging and Analysis\n```typescript\nconst result = await runAgent(\"Solve this complex business problem\", {\n  enableLogs: true,        // See detailed reasoning process\n  enableReflection: true   // Get self-evaluation insights\n});\n\n// Review the reasoning process\nconsole.log(\"Reflections on reasoning quality:\");\nresult.reflections.forEach(reflection => console.log(reflection));\n```\n\n## Development\n\nTo set up the development environment:\n\n```bash\ngit clone https://github.com/chihebnabil/o-reasonable.git\ncd o-reasonable\nnpm install\nnpm run dev\n```\n\n## Building\n\n```bash\nnpm run build\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nMIT\n\n## Credits\n\nCreated with ❤️ by Chiheb Nabil","readmeFilename":"README.md"}