Open Spec Correct
Automate and streamline the correction of imperfect OpenAPI specifications by extracting structured insights from textual descriptions.
📌 Overview
Open Spec Correct is a Python package designed to analyze user-provided textual descriptions of APIs and generate structured corrections for OpenAPI specifications. It leverages pattern matching and AI-driven insights to identify inconsistencies, errors, or missing details in API documentation, helping developers create more accurate and maintainable OpenAPI specs faster.
🚀 Features
- Text-to-Spec Correction: Extracts structured insights from unstructured textual descriptions.
- Pattern Matching: Uses regex-based validation to ensure output correctness.
- LLM Flexibility: Works with LLM7 by default (free tier included) or supports custom LLMs (OpenAI, Anthropic, Google, etc.).
- Retry Mechanisms: Ensures reliable extraction and correction.
- Environment-Aware: Respects
LLM7_API_KEYenvironment variable for seamless integration.
📦 Installation
pip install open_spec_correct
🔧 Usage
Basic Usage (Default LLM7)
from open_spec_correct import open_spec_correct
user_input = """
API endpoint for fetching user data.
Path: /users/{id}
Method: GET
Query params: ?name=string, ?age=int
Response: 200 OK with JSON body { "id": int, "name": string }
"""
response = open_spec_correct(user_input)
print(response)
Custom LLM Integration
You can replace the default ChatLLM7 with any LangChain-compatible LLM (e.g., OpenAI, Anthropic, Google Generative AI).
Example: Using OpenAI
from langchain_openai import ChatOpenAI
from open_spec_correct import open_spec_correct
llm = ChatOpenAI(model_name="gpt-4") # Replace with your preferred model
response = open_spec_correct(user_input, llm=llm)
print(response)
Example: Using Anthropic
from langchain_anthropic import ChatAnthropic
from open_spec_correct import open_spec_correct
llm = ChatAnthropic(model="claude-2")
response = open_spec_correct(user_input, llm=llm)
print(response)
Example: Using Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from open_spec_correct import open_spec_correct
llm = ChatGoogleGenerativeAI(model="gemini-pro")
response = open_spec_correct(user_input, llm=llm)
print(response)
🔑 API Key Configuration
- Default: Uses
LLM7_API_KEYfrom environment variables. - Manual Override: Pass the API key directly:
response = open_spec_correct(user_input, api_key="your_llm7_api_key")
- Free API Key: Register at LLM7 Token to get started.
⚠️ Rate Limits
- LLM7 Free Tier: Sufficient for most use cases.
- Custom Rate Limits: Upgrade via LLM7 dashboard or use a different LLM.
📝 Input Parameters
| Parameter | Type | Description |
|---|---|---|
user_input |
str |
Textual description of the API to correct. |
api_key |
Optional[str] |
LLM7 API key (optional if LLM7_API_KEY is set in environment). |
llm |
Optional[BaseChatModel] |
Custom LangChain LLM (e.g., ChatOpenAI, ChatAnthropic). Defaults to ChatLLM7. |
🔄 Output
Returns a list of structured corrections (e.g., OpenAPI-compatible snippets) extracted from the input text.
📜 License
MIT License (see LICENSE).
🐛 Issues & Support
Report bugs or request features at: 🔗 GitHub Issues
👤 Author
Eugene Evstafev 📧 hi@euegne.plus 🌐 GitHub: chigwell
Metadata
Release files for open-spec-correct 2025.12.21155728
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_spec_correct-2025.12.21155728.tar.gz | 4.7 kB | Without provenance | Details for open_spec_correct-2025.12.21155728.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_spec_correct-2025.12.21155728-py3-none-any.whl | Python 3 | none | any | Details for open_spec_correct-2025.12.21155728-py3-none-any.whl |
Total release size: 10.1 kB
Release files / open_spec_correct-2025.12.21155728.tar.gz
| Download URL | open_spec_correct-2025.12.21155728.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbef5e016d21a2e481b93be2a8548709f20e853cf02e7926eeee7c860b5b69a4
|
|
BLAKE2b-256 checksum How to use checksums |
c39ac21a9461a22cdca5bf21f55b3fa6dd93d77718cd52935015fd5a051fce41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / open_spec_correct-2025.12.21155728-py3-none-any.whl
| Download URL | open_spec_correct-2025.12.21155728-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ddc323349f5f4dda4ffd89ce7413bf69608daa62d9de79e41dc3ed6e47664f3
|
|
BLAKE2b-256 checksum How to use checksums |
866ef24bcecbbda05f5d2afe2faf7f7032771f2fb7def666825dc25f332f081c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Security for open-spec-correct 2025.12.21155728
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.