llm-strategy  by BlackHC

SDK for connecting Python to LLMs via typed functions

Created 2 years ago
399 stars

Top 72.4% on SourcePulse

GitHubView on GitHub
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

6 months ago

Responsiveness

Inactive

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

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Kevin Hou Kevin Hou(Head of Product Engineering at Windsurf), and
6 more.

TypeChat by microsoft

0.1%
9k
Library for building natural language interfaces using types
Created 2 years ago
Updated 2 months ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Anton Troynikov Anton Troynikov(Cofounder of Chroma), and
44 more.

llama_index by run-llama

0.3%
44k
Data framework for building LLM-powered agents
Created 2 years ago
Updated 18 hours ago
Feedback? Help us improve.