image-text-structurizer
A Python package to process user-provided text descriptions of images and extract structured, validated outputs using pattern matching and a language model. Ensures that the output adheres to a predefined format such as XML-like tags, facilitating consistent and reliable extraction of image metadata or summaries without directly handling image data.
Installation
Install via pip:
pip install image_text_structurizer
Usage Example
from image_text_structurizer import image_text_structurizer
response = image_text_structurizer(user_input="A scenic landscape with mountains and a river")
print(response)
Function Parameters
user_input(str): The text description of the image to process.llm(Optional[BaseChatModel]): An instance of a language model. Defaults toChatLLM7fromlangchain_llm7.api_key(Optional[str]): API key for accessing theChatLLM7model. If not provided, it attempts to fetch from environment variableLLM7_API_KEY. You can also set it directly in code.
Supported Language Models
This package uses ChatLLM7 by default, which can be imported from langchain_llm7. Developers can pass other models, such as:
- OpenAI Chat models
- Anthropic models
- Google Generative AI models
by creating an instance and passing it to the image_text_structurizer function.
Examples:
Using OpenAI:
from langchain_openai import ChatOpenAI
from image_text_structurizer import image_text_structurizer
llm = ChatOpenAI()
response = image_text_structurizer(user_input="A sunset over the ocean", llm=llm)
Using Anthropic:
from langchain_anthropic import ChatAnthropic
from image_text_structurizer import image_text_structurizer
llm = ChatAnthropic()
response = image_text_structurizer(user_input="A forest with tall trees and fog", llm=llm)
Using Google Generative AI:
from langchain_google_genai import ChatGoogleGenerativeAI
from image_text_structurizer import image_text_structurizer
llm = ChatGoogleGenerativeAI()
response = image_text_structurizer(user_input="A city skyline at night", llm=llm)
Notes
- The package relies on the
ChatLLM7model fromlangchain_llm7. - Default rate limits are suitable for most use cases, but higher limits can be obtained by registering for an API key at https://token.llm7.io/.
- To pass your own API key, set the environment variable
LLM7_API_KEYor pass it directly:
response = image_text_structurizer(user_input="Example text", api_key="your_api_key")
Support & Contributions
- For issues, open an issue on the GitHub repository.
Author
- Eugene Evstafev
Email: hi@eugene.plus
GitHub: https://github.com/chigwell
Metadata
Release files for image-text-structurizer 2025.12.21124037
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| image_text_structurizer-2025.12.21124037.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| image_text_structurizer-2025.12.21124037-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / image_text_structurizer-2025.12.21124037.tar.gz
| Download URL | image_text_structurizer-2025.12.21124037.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90cf4cc4223f2fedbf9da40c96afb0a88500899765e08a7c1855557138d66ef2
|
|
BLAKE2b-256 checksum How to use checksums |
a696f46fa0f74652942a709a723a2de663e40cf54ddf87a957eb2c83641272ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / image_text_structurizer-2025.12.21124037-py3-none-any.whl
| Download URL | image_text_structurizer-2025.12.21124037-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a540de22111f4397e6a609ecfb307ffdcbdcdef4c2d4d985c5edf6bbc50d0bb2
|
|
BLAKE2b-256 checksum How to use checksums |
b98ed3d8b7013c90d17974bda760a3d52a86aa91bd59745097bd34dd1bf11349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|