Skip to main content

🚀 HypeLLM: Hypothetical LLM Data Augmentation

Python 3.8+ License: MIT

🌟 Features

  • 🎮 Recipe-Based Augmentation: Pre-built recipes for common augmentation patterns
  • 🔄 Multiple Strategies: Infer patterns, add reasoning, generate questions, and more
  • 🎯 Async & Sync Support: Choose between async or sync APIs based on your needs
  • ⚡ Flexible Implementation: Swap between different LLM backends (instructor, dspy, etc.)

🛠️ Installation

pip install hypellm
rye add hypellm
poetry add hypellm

Note that out of the box, you'll also need to install instructor as a peer dependency of hypellm, as it is the default implementation.

🚀 Quick Start

Take a look at recipes.py to learn what's available and how they work.

# env vars:
# HYPELLM_MODEL=gpt-4o # LiteLLM model name
# HYPELLM_API_KEY=your_api_key

import hypellm

# Your training examples, simple strings or structured data
data = [
    # Example(inputs: dict | str, reasoning: list[str], outputs: dict | str)
    hypellm.Example(
        inputs="The patient presents with elevated troponin levels (0.8 ng/mL) and ST-segment depression, but no chest pain or dyspnea.",
        outputs="unstable_angina"
    ),
    hypellm.Example(
        inputs="Labs show WBC 15k/μL with 80% neutrophils, fever 39.2°C, and consolidation in right lower lobe on chest X-ray.",
        outputs="bacterial_pneumonia"
    )
]

# Choose your implementation
hypellm.settings.impl_name = "instructor"  # or your custom impl

# Use different recipes
async def augment_examples():
    # Infer a prompt from examples
    prompt = await hypellm.recipes.inferred(data)
    print(f"Intent: {prompt.intent}")
    print(f"Do's: {prompt.dos}")
    print(f"Don'ts: {prompt.donts}")
    print(f"Reasoning Steps: {prompt.reasoning_steps}")
    print(f"Examples: {prompt.examples}")

    # Add reasoning steps to examples
    prompt, results = await hypellm.recipes.reasoned(data, prompt=prompt)
    for result in results:
        print(f"Q: {result.inputs}")
        print(f"Reasoning: {result.reasoning}")
        print(f"A: {result.outputs}")

    # Generate questions from different angles
    questions = await hypellm.recipes.questions(data)
    for question, data_that_answers_question in questions.items():
        print(f"{question}: {data_that_answers_question}")

    # Invert input/output pairs
    prompt, inverted = await hypellm.recipes.inverted(data)
    print(f"Inverted prompt: {prompt}")
    for result in inverted:
        print(f"Original: {result.outputs} -> [{result.reasoning}] -> {result.inputs}")
        print(f"Inverted: {result.inputs} -> [{result.reasoning}] -> {result.outputs}")

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

MIT License - see the LICENSE file for details.


Made with 🔥 by Zenbase AI - Empowering the next generation of LLM applications.

Remember: Better data means better models! 🎯

Metadata

Release files for hypellm 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hypellm 0.0.4
File Size Uploaded Provenance Actions
hypellm-0.0.4.tar.gz 14.9 kB Without provenance Details for hypellm-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hypellm 0.0.4
File Interpreter ABI Platform Actions
hypellm-0.0.4-py3-none-any.whl Python 3 none any Details for hypellm-0.0.4-py3-none-any.whl

Total release size: 30.2 kB

Release files / hypellm-0.0.4.tar.gz

Download URL hypellm-0.0.4.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
112e6d096aa66b2280827da643fc1aee53b93f9f963bb8808175cd1997beeb7a
BLAKE2b-256 checksum
How to use checksums
749d0c45faa44b0bfdbfe113b1bec252bcbe142bfd7fbce1b8c6ad91f8cc7f9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Release files / hypellm-0.0.4-py3-none-any.whl

Download URL hypellm-0.0.4-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43060dde720e2f7a4d06b7f3a2387e168632c5249334b17215f46a62d00d8d12
BLAKE2b-256 checksum
How to use checksums
ca337c915ba878cf3a792bc4898fe194d01490f90ee621604dababd5d53fc277
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Security for hypellm 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page