Skip to main content

Enhance LLM Zero-Shot Responses through multi-step reasoning and document analysis

Project description

IsoZero: Enhancing LLM Zero-Shot Responses

IsoZero is a powerful SDK designed to enhance Large Language Model (LLM) zero-shot responses through multi-step reasoning and document analysis. By leveraging a step-by-step reasoning process, this SDK helps improve the accuracy and depth of LLM outputs, especially in scenarios where the model hasn't been specifically fine-tuned for the task at hand.

Features

  • Multi-step reasoning process to break down complex tasks
  • Support for multiple LLM backends:
    • Claude (Anthropic)
    • GPT (OpenAI)
    • Transformer models (Hugging Face)
  • Document analysis capabilities for context-aware responses
  • Mathematical problem-solving simulation
  • Flexible CLI with progress bars and result saving
  • Customizable number of reasoning steps

Package Structure

The IsoZero package consists of two main modules:

  1. reason_sim: General reasoning and document analysis
  2. math_sim: Mathematical problem-solving simulation

Installation

Install IsoZero directly from PyPI:

pip install isozero

For the latest development version:

pip install git+https://github.com/iso-ai/isozero.git

Usage

Command Line Interface

IsoZero provides a flexible CLI for various tasks:

  1. General Reasoning Task:

    isozero --mode reasoning --task "Explain the process of photosynthesis" --agent claude --steps 4 --save
    
  2. Document Analysis (Question Answering):

    isozero --mode qa --documents https://en.wikipedia.org/wiki/Artificial_intelligence https://en.wikipedia.org/wiki/Machine_learning --questions questions.txt --agent huggingface --model google/flan-t5-large --steps 4
    
  3. Math Problem Solving:

    isozero --mode math --task "A train travels at 60 km/h for 2 hours, then at 90 km/h for 3 hours. What's the total distance?" --agent openai --steps 4 --save
    

The --save flag will store the results in a JSON file in the logs folder.

Python API

You can also use IsoZero in your Python scripts:

from isozero.reason_sim import ClaudeAgent, QuestionAnswerer, DocumentLoader
from isozero.reason_sim.reason_simulation import ReasonSimulation
from isozero.reason_sim.simulation_wrapper import SimulationWrapper

# Initialize the agent
agent = ClaudeAgent(api_key="your_api_key_here")

# For reasoning tasks
simulation = ReasonSimulation("Explain the process of photosynthesis", max_steps=4)
wrapper = SimulationWrapper(agent, simulation)

for step in range(4):
    state = wrapper.step()
    print(f"Step {state['text_data']['step']}:", state['text_data']['reasoning'][-1])

# For document analysis
loader = DocumentLoader()
documents = loader.load(["path/to/document.txt"])
qa = QuestionAnswerer(agent)
results = qa.answer_questions(documents, ["Your question here"])

Configuration

Set environment variables for API keys:

export ANTHROPIC_API_KEY=your_anthropic_key_here
export OPENAI_API_KEY=your_openai_key_here

Or use a .env file in your project root.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Citation

If you use IsoZero in your research, please cite it as follows:

@software{isozero2024,
  author = {Jazmia Henry},
  title = {IsoZero: Enhancing LLM Zero-Shot Responses},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/iso-ai/isozero}}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isozero-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

isozero-0.1.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file isozero-0.1.0.tar.gz.

File metadata

  • Download URL: isozero-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for isozero-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e54e423fd096e385e199ee4fc3f143b11455587e122e5061638aa834a1f4569b
MD5 1c60cb996d03fb29d04ee51b8ecc0f8f
BLAKE2b-256 3d74ac22b61b839b1d13133b252639fb0f6e60a7f562e3aa01ab39f607d3aa3a

See more details on using hashes here.

File details

Details for the file isozero-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: isozero-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for isozero-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 579b4f7517159186a286ece22a8b923b472ffff3eb26ee6d5b2b4ea4aa48a509
MD5 a338db5b6cf8f0c771d2672761893be4
BLAKE2b-256 840ceeeee5f743282f3f1abfc5f231e32158e315d843308891077f28a8df7679

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page