🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

o-reasonable

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

o-reasonable

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

Source
npmnpm
Version
0.0.61
Version published
Weekly downloads
1
-90%
Maintainers
1
Weekly downloads
 
Created
Source

O-Reasonable 🧠

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.

[demo]

Features

  • 🎯 Dynamic model selection with sensible defaults
  • 📋 Structured step-by-step planning
  • 🔄 Sequential execution of reasoning steps
  • 🎨 Clean and informative console output
  • ⚡ Built with TypeScript and Vite

Installation

npm install o-reasonable

Configuration

You'll need to set up your OpenAI API key as an environment variable:

export OPENAI_API_KEY=your-api-key-here

Or create a .env file in your project root:

OPENAI_API_KEY=your-api-key-here

Usage

import { runAgent } from 'o-reasonable';

// Basic usage with default model (logs enabled by default)
const result = await runAgent("What would be the impact of implementing a four-day work week?");

// Using a custom model with logs disabled
const result = await runAgent("Analyze the pros and cons of remote work", {
  model: "gpt-4o-mini",
  enableLogs: false
});

// The result contains steps and final answer
console.log(result.steps);         // Array of step results
console.log(result.finalQuestion); // The final question asked
console.log(result.finalAnswer);   // The final synthesized answer

Configuration Options

The runAgent function accepts a configuration object with the following options:

interface OReasonableConfig {
  model?: string;     // OpenAI model to use (default: "gpt-4o-mini")
  apiKey?: string;    // Optional API key override
  baseURL?: string;   // Custom base URL for OpenAI-compatible APIs
  enableLogs?: boolean; // Enable/disable console logs (default: false)
}

Using OpenAI-Compatible APIs

O-Reasonable supports any OpenAI-compatible API by specifying a custom baseURL. Here are some examples:

Local Models (Ollama, LM Studio, etc.)

import { runAgent } from 'o-reasonable';

// Using Ollama with a local model
const result = await runAgent("Explain quantum computing", {
  baseURL: "http://localhost:11434/v1",
  model: "llama2", // or any model available in Ollama
  apiKey: "ollama" // Ollama requires any non-empty key
});

// Using LM Studio
const result = await runAgent("What are the benefits of TypeScript?", {
  baseURL: "http://localhost:1234/v1",
  model: "local-model",
  apiKey: "lm-studio"
});

Azure OpenAI

const result = await runAgent("Analyze market trends", {
  baseURL: "https://your-resource.openai.azure.com",
  model: "gpt-35-turbo", // Azure deployment name
  apiKey: process.env.AZURE_OPENAI_API_KEY
});

Other OpenAI-Compatible Providers

// Example with any OpenAI-compatible service
const result = await runAgent("Create a project plan", {
  baseURL: "https://api.your-provider.com/v1",
  model: "your-model-name",
  apiKey: "your-api-key"
});

Return Type

The runAgent function returns a promise that resolves to an AgentResult:

interface AgentResult {
  steps: string[];      // Results from each reasoning step
  finalQuestion: string; // The final question that was asked
  finalAnswer: string;  // The synthesized final answer
}

Development

To set up the development environment:

git clone https://github.com/chihebnabil/o-reasonable.git
cd o-reasonable
npm install
npm run dev

Building

npm run build

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Credits

Created with ❤️ by Chiheb Nabil

Keywords

openai

FAQs

Package last updated on 12 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts