A new package that processes user-submitted text descriptions of gift-wrapped parcels and returns a structured analysis of the contents, wrapping quality, and potential surprises. It uses pattern matc
Project description
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
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file giftparcelstruct-2025.12.21101054.tar.gz.
File metadata
- Download URL: giftparcelstruct-2025.12.21101054.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
800917e5ac965ee444b1d6a8d92c5e99305536d1fd1941136d45860a6dcc5072
|
|
| MD5 |
f6aeaa8bfd67c719577962245eb5f150
|
|
| BLAKE2b-256 |
ae4088f2d8138cde42f22c1a9bc81631b08e27615f8b27ad62798c5d3a9b3535
|
File details
Details for the file giftparcelstruct-2025.12.21101054-py3-none-any.whl.
File metadata
- Download URL: giftparcelstruct-2025.12.21101054-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a363d93993946dffd6d4ba35598bdf870ce6855038991b2e70d277b9b1e8dc18
|
|
| MD5 |
099ecd27615fbc0f9d9a05ce49ebabc5
|
|
| BLAKE2b-256 |
e92c027324d97d60cc12cdb4ebcb45d48130874ab5e92b28eda8e271d953b56f
|