Skip to main content

nlp-structgen

PyPI version License: MIT Downloads LinkedIn

nlp-structgen is a lightweight, instance‑agnostic solution that uses NLP, ML and HCI principles to transform unstructured text into structured JSON (and, in local builds, CSV or plain text). It is ideal for automating repetitive data‑entry tasks, generating business charts, building quotes, converting data, and more, while keeping data consistent and auditable.

Features

  • Input validation & consistency checks – ensures the extracted data satisfies a user‑defined regex.
  • Template‑driven output – matches a template to produce consistent JSON structures.
  • LLM integration – defaults to ChatLLM7 from the langchain_llm7 package, but any LangChain‐compatible model can be provided.
  • REST / GraphQL – ready to expose via network APIs.
  • Logging & performance tracking – logs every invocation and can generate performance charts.
  • Export formats – produces JSON by default; local builds can output CSV or plain text.

Installation

pip install nlp_structgen

Quick Start

from nlp_structgen import nlp_structgen

user_input = """
Company: Acme Corp
Employees: 42
Revenue: $5M
"""

results = nlp_structgen(user_input)
print(results)   # -> List containing extracted JSON strings

Using a different LLM

If you prefer a different language model you can pass an instance of any BaseChatModel.
Below are three common examples:

OpenAI

from langchain_openai import ChatOpenAI
from nlp_structgen import nlp_structgen

llm = ChatOpenAI()            # uses your configured OpenAI key
response = nlp_structgen(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from nlp_structgen import nlp_structgen

llm = ChatAnthropic()          # uses your configured Anthropic key
response = nlp_structgen(user_input, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from nlp_structgen import nlp_structgen

llm = ChatGoogleGenerativeAI()
response = nlp_structgen(user_input, llm=llm)

Customizing the LLM7 API key

nlp_structgen defaults to ChatLLM7.
The free tier rate limits are usually sufficient, but you can provide your own key:

export LLM7_API_KEY="your_api_key_here"

or directly in code:

response = nlp_structgen(user_input, api_key="your_api_key_here")

You can obtain a free key at https://token.llm7.io/.

Parameters

Parameter Type Description
user_input str Text to process
api_key Optional[str] LLM7 API key, if not supplied the environment variable LLM7_API_KEY or the default will be used
llm Optional[BaseChatModel] An instance of a LangChain chat model; if omitted, ChatLLM7 will be instantiated

License

This project is licensed under the MIT license – see the LICENSE file for details.

Author

Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell

Contributing

Feel free to open an issue or pull request on https://github.com/chigwell/nlp-structgen/issues.


Disclaimer: All information provided here is based solely on the package’s public code and documentation. No additional facts have been fabricated.

Metadata

Release files for nlp-structgen 2025.12.20202749

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nlp-structgen 2025.12.20202749
File Size Uploaded
nlp_structgen-2025.12.20202749.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nlp-structgen 2025.12.20202749
File Interpreter ABI Platform
nlp_structgen-2025.12.20202749-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / nlp_structgen-2025.12.20202749.tar.gz

Download URL nlp_structgen-2025.12.20202749.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a6ac59ee838209186528c8d1bc1b84e7b510e7074b30b8f19b11826e57fd0197
BLAKE2b-256 checksum
How to use checksums
bcf1fcb4cb77d996023174108b3d625b799c20ecc0a4ac0e618c4fdffb284691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / nlp_structgen-2025.12.20202749-py3-none-any.whl

Download URL nlp_structgen-2025.12.20202749-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33ec9dea1f21c3b906813494b6848375cec131dae62c2400d0cf6a529d5ca62a
BLAKE2b-256 checksum
How to use checksums
31fef0987d3c18f15a5057bcceb85f926b92e82066af7ff09435213a8ea1fbc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

2025.12.20202749 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page