Skip to content

av-safety-parser extracts aviation incident details from unstructured text, outputting standardized data on incident type, aircraft, and risks.

Notifications You must be signed in to change notification settings

chigwell/av-safety-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

av-safety-parser

PyPI version License: MIT Downloads LinkedIn

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.

Features

  • Simple API that takes raw text and returns structured data.
  • Uses the default ChatLLM7 model from langchain_llm7 for 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.

Installation

pip install av_safety_parser

Quick Example

from 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)

Parameters

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 own api_key either through av_safety_parser(user_input, api_key="your_key") or by setting LLM7_API_KEY in your environment.

Getting an LLM7 API Key

  1. Sign up at https://token.llm7.io/
  2. Retrieve your API token
  3. Set it as an environment variable:
    export LLM7_API_KEY="your_token_here"

Issue Tracker

If you encounter any problems or have feature requests, please open an issue at:
https://github.com/chigwell/av-safety-parser/issues

Author

Enjoy using av-safety-parser to keep aviation data clear and consistent!