giftparcelstruct
giftparcelstruct is a tiny Python package that takes a user‑written description of a gift‑wrapped parcel and returns a structured analysis of its contents, wrapping quality, and any hidden surprises.
It uses pattern matching to ensure the LLM’s output follows a strict regex format, making it ideal for party games, event planning, creative writing prompts, or any scenario where you want to generate or guess parcel details in a fun, interactive way.
Installation
pip install giftparcelstruct
Quick Start
from giftparcelstruct import giftparcelstruct
user_input = """
I received a bright red box wrapped in glossy paper with a silver bow.
Inside there was a small wooden puzzle, a scented candle, and a handwritten note.
"""
# Use the default LLM (ChatLLM7)
result = giftparcelstruct(user_input)
print(result)
Output – a list of strings matching the predefined pattern, e.g.:
[
"Wrapping: glossy, red, silver bow",
"Contents: wooden puzzle, scented candle, handwritten note",
"Surprise: hidden chocolate inside the puzzle"
]
Function Signature
giftparcelstruct(
user_input: str,
llm: Optional[BaseChatModel] = None,
api_key: Optional[str] = None,
) -> List[str]
| Parameter | Type | Description |
|---|---|---|
user_input |
str |
The free‑form text describing the parcel that you want to analyse. |
llm |
Optional[BaseChatModel] |
A LangChain LLM instance. If omitted, the package automatically creates a ChatLLM7 instance. |
api_key |
Optional[str] |
API key for LLM7. If omitted, the function looks for the environment variable LLM7_API_KEY. If that is also missing, a placeholder value is used and the request will fail unless a real key is supplied. |
Using a Custom LLM
You can plug any LangChain‑compatible chat model instead of the default ChatLLM7.
OpenAI
from langchain_openai import ChatOpenAI
from giftparcelstruct import giftparcelstruct
llm = ChatOpenAI(model="gpt-4o-mini")
response = giftparcelstruct(user_input, llm=llm)
print(response)
Anthropic
from langchain_anthropic import ChatAnthropic
from giftparcelstruct import giftparcelstruct
llm = ChatAnthropic(model="claude-3-haiku-20240307")
response = giftparcelstruct(user_input, llm=llm)
print(response)
Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from giftparcelstruct import giftparcelstruct
llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
response = giftparcelstruct(user_input, llm=llm)
print(response)
Default LLM – ChatLLM7
If you do not provide an llm argument, giftparcelstruct automatically creates a ChatLLM7 instance from the langchain‑llm7 package:
from langchain_llm7 import ChatLLM7
Package: https://pypi.org/project/langchain-llm7
The free tier of LLM7 offers generous rate limits that are sufficient for most hobby and prototype uses.
Supplying an API Key
You can set the LLM7 key in the environment:
export LLM7_API_KEY="your_api_key_here"
Or pass it directly:
response = giftparcelstruct(user_input, api_key="your_api_key_here")
Get a free API key by registering at https://token.llm7.io/.
Contributing & Support
If you encounter any bugs or have feature requests, please open an issue:
https://github.com/chigwell/giftparcelstruct/issues
Pull requests and suggestions are very welcome!
License
This project is licensed under the MIT License.
Author
Eugene Evstafev
📧 Email: hi@euegne.plus
🐙 GitHub: chigwell
Metadata
Release files for giftparcelstruct 2025.12.21101054
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| giftparcelstruct-2025.12.21101054.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| giftparcelstruct-2025.12.21101054-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / giftparcelstruct-2025.12.21101054.tar.gz
| Download URL | giftparcelstruct-2025.12.21101054.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
800917e5ac965ee444b1d6a8d92c5e99305536d1fd1941136d45860a6dcc5072
|
|
BLAKE2b-256 checksum How to use checksums |
ae4088f2d8138cde42f22c1a9bc81631b08e27615f8b27ad62798c5d3a9b3535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / giftparcelstruct-2025.12.21101054-py3-none-any.whl
| Download URL | giftparcelstruct-2025.12.21101054-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a363d93993946dffd6d4ba35598bdf870ce6855038991b2e70d277b9b1e8dc18
|
|
BLAKE2b-256 checksum How to use checksums |
e92c027324d97d60cc12cdb4ebcb45d48130874ab5e92b28eda8e271d953b56f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|