Light weight prompting and parsing library for LLM models
Project description
Limeprompt 🍋
Lightweight prompting and parsing library for LLM models.
What is Limeprompt?
Limeprompt is an opinionated and lightweight prompting and parsing library for LLM models. It aims to make it easy to generate structured outputs from language models. The library is designed to be simple to use, with a single use-case in mind: generating structured outputs from language models. There wont be any support for multi-agent or complex prompting use-cases.
Installation
pip install limeprompt
Example Usage
Here's a simple example to get you started:
from anthropic import Anthropic
from pydantic import BaseModel
from limeprompt import Limeprompt
# Define your output structure
class Email(BaseModel):
subject: str
message: str
# Set up your Anthropic client
anthropic_client = Anthropic(api_key='your-api-key')
# Create a Limeprompt instance
lp = Limeprompt(
model_client=anthropic_client,
model_name='claude-3-5-sonnet-20240620',
prompt="Write an email to {name} about {topic}",
variables={"name": "Alice", "topic": "limes"},
output_model=Email,
max_tokens=1024
)
# Run and get your zesty results!
result = lp.run()
print(f"Subject: {result.output.subject}")
print(f"Message: {result.output.message}")
Not
Contributing
You are welcome to open issues or submit PRs. Here's my todo list for the library:
- Add support for OpenAI
- Modularize the prompting techniques
- Add support for few-shot prompting
License
Limeprompt is released under the MIT License. Feel free to use it in your projects.
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
Built Distribution
Hashes for limeprompt-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561396658dd00e20e83b49c441fffb832df24e7f78d88a0680be2f8c196ef9ae |
|
MD5 | cb6b5d33c95d7d4650d5aa5d7959010e |
|
BLAKE2b-256 | a8058f24eab17e1030f3693d71ff8d2a57d394fd423bf9ec0a86762472cdb80e |