whatsapp-linkcraft generates validated WhatsApp chat links from phone numbers using an LLM, handling formatting and errors automatically for clickable URLs.
Project description
WhatsApp LinkCraft
WhatsApp LinkCraft is a Python package designed to generate structured and validated WhatsApp chat links from user-provided phone numbers. It leverages language models to ensure correct formatting and automatically handle common input variations and errors, providing a clickable WhatsApp URL ready for use.
Installation
Install the package via pip:
pip install whatsapp_linkcraft
Usage
Here's a basic example of how to use the package:
from whatsapp_linkcraft import whatsapp_linkcraft
# Example user input
user_input = "+1 234 567 8901"
# Generate WhatsApp link (uses default LLM)
links = whatsapp_linkcraft(user_input)
print(links)
You can also pass your own LLM instance if desired. The default uses ChatLLM7 from langchain_llm7, which is compatible with various LLM providers.
Custom LLM Usage
The package enables you to specify your preferred language model. For example:
Using OpenAI's GPT
from langchain_openai import ChatOpenAI
from whatsapp_linkcraft import whatsapp_linkcraft
llm = ChatOpenAI()
response = whatsapp_linkcraft(user_input, llm=llm)
Using Anthropic
from langchain_anthropic import ChatAnthropic
from whatsapp_linkcraft import whatsapp_linkcraft
llm = ChatAnthropic()
response = whatsapp_linkcraft(user_input, llm=llm)
Using Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from whatsapp_linkcraft import whatsapp_linkcraft
llm = ChatGoogleGenerativeAI()
response = whatsapp_linkcraft(user_input, llm=llm)
Parameters
- user_input (
str): The text input from the user containing the phone number to process. - llm (
Optional[BaseChatModel]): An instance of a language model. Defaults toChatLLM7. - api_key (
Optional[str]): API key for LLM7. If not provided, the package attempts to fetch from environment variableLLM7_API_KEY. To use a custom key, pass it directly or set the environment variable.
Notes
- Relies on
ChatLLM7fromlangchain_llm7by default. You may replace it with other language model instances from LangChain. - Default rate limits of LLM7 free tier are generally sufficient; for higher limits, provide your own API key.
License
This project is maintained by Eugene Evstafev.
Email: hi@eugene.plus
GitHub: chigwell
Issues
For issues or suggestions, visit: GitHub Issues
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 whatsapp_linkcraft-2025.12.21183621.tar.gz.
File metadata
- Download URL: whatsapp_linkcraft-2025.12.21183621.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb48f6275b1dda26e42c0ff5f1fb5ed16264892dc9e3c3e92cca0838a6c0696c
|
|
| MD5 |
650e1e1c15f9c496ef1ad08965863696
|
|
| BLAKE2b-256 |
14bedbc4ca108ebe1a0970c8c4ac66df81c0ad2bee0c5aacd70f0a9c4287f307
|
File details
Details for the file whatsapp_linkcraft-2025.12.21183621-py3-none-any.whl.
File metadata
- Download URL: whatsapp_linkcraft-2025.12.21183621-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80355afb947bc3395a5bdc1ec388bd8e0677c3272f0d8fd37d38adb0f046c398
|
|
| MD5 |
a93ff782aeca6bf893076bff3ce432f9
|
|
| BLAKE2b-256 |
c579c34a5e26c3d66437843f1674d817e78994d117f45bc03281be9c956a710d
|