llm-strategy  by BlackHC

SDK for connecting Python to LLMs via typed functions

created 2 years ago
399 stars

Top 73.5% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This library enables direct integration of Large Language Models (LLMs) with Python, leveraging strongly-typed functions, dataclasses, and interfaces. It targets developers building complex applications where LLM interactions need to be robust and predictable, offering a way to delegate logic implementation to LLMs while maintaining Pythonic structure and data validation.

How It Works

The core mechanism uses a decorator (@llm_strategy) to connect Python classes and methods to LLMs. It translates Python's type hints, docstrings, and method signatures into prompts for the LLM. The LLM's output is then parsed and converted back into Python dataclasses, enabling LLMs to dynamically implement abstract methods or generate structured data. This approach aims to reduce boilerplate Python code by offloading complex logic and data parsing to LLMs.

Quick Start & Requirements

Highlighted Details

  • Implements the Strategy Pattern using LLMs for dynamic method implementation.
  • Supports automatic conversion of LLM responses to Python dataclasses.
  • Includes a research package for hyperparameter tracking and meta-optimization.
  • Demonstrates advanced use cases with Generics for complex optimization loops.

Maintenance & Community

  • Project initiated with fpgmaas/cookiecutter-poetry.
  • Contribution guide available via make install.
  • Release process involves PyPI API tokens and GitHub tags.

Licensing & Compatibility

  • The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is undetermined.

Limitations & Caveats

The project is described as having potential to reduce future Python code, implying it is still in an active development phase. The lack of a specified license is a significant caveat for adoption.

Health Check
Last commit

5 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
3 stars in the last 90 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
21 more.

guidance by guidance-ai

0.1%
21k
Guidance is a programming paradigm for steering LLMs
created 2 years ago
updated 1 day ago
Feedback? Help us improve.