A lightweight Python package for extracting and structuring aviation safety information from unstructured text.
It parses texts such as FAA warnings and news articles to return key details (incident type, affected aircraft, safety risks, etc.) in a consistent format.
- Simple API that takes raw text and returns structured data.
- Uses the default
ChatLLM7model fromlangchain_llm7for inference. - Fully compatible with any LangChain LLM implementation (OpenAI, Anthropic, Google Gemini, etc.) by passing a custom instance.
- Supports API-key configuration via environment variable or explicit parameter.
pip install av_safety_parserfrom av_safety_parser import av_safety_parser
user_input = """
FAA publishes new warning on rotor blade vibrations in twin‑prop aircraft.
There were several incidents where the vibrations caused structural fatigue.
"""
# Using the default ChatLLM7
results = av_safety_parser(user_input)
print(results)You can also pass a custom LLM instance:
# Example with OpenAI's ChatOpenAI
from langchain_openai import ChatOpenAI
from av_safety_parser import av_safety_parser
llm = ChatOpenAI()
results = av_safety_parser(user_input, llm=llm)
print(results)# Example with Anthropic's ChatAnthropic
from langchain_anthropic import ChatAnthropic
from av_safety_parser import av_safety_parser
llm = ChatAnthropic()
results = av_safety_parser(user_input, llm=llm)
print(results)# Example with Google Gemini
from langchain_google_genai import ChatGoogleGenerativeAI
from av_safety_parser import av_safety_parser
llm = ChatGoogleGenerativeAI()
results = av_safety_parser(user_input, llm=llm)
print(results)| Parameter | Type | Description |
|---|---|---|
user_input |
str |
Raw text to parse. |
llm |
Optional[BaseChatModel] |
LangChain LLM instance. If omitted, ChatLLM7 will be used automatically. |
api_key |
Optional[str] |
API key for LLM7. If not provided, the library will look for the LLM7_API_KEY environment variable. |
Default Rate Limits
The free tier of LLM7 offers enough rate limits for most use cases. If you require higher limits, pass your ownapi_keyeither throughav_safety_parser(user_input, api_key="your_key")or by settingLLM7_API_KEYin your environment.
- Sign up at https://token.llm7.io/
- Retrieve your API token
- Set it as an environment variable:
export LLM7_API_KEY="your_token_here"
If you encounter any problems or have feature requests, please open an issue at:
https://github.com/chigwell/av-safety-parser/issues
- Name: Eugene Evstafev
- GitHub: @chigwell
- Email: hi@euge.ne.plus
Enjoy using av-safety-parser to keep aviation data clear and consistent!