A Python package for extracting structured insights from text-based content related to DNS blocking reports and network filtering incidents. This tool processes unstructured text to identify key information such as blocked domains, reasons for blocking, and contextual details (e.g., geographic or policy-related), enabling analysts to quickly derive actionable insights without manual parsing.
Install the package via pip:
pip install dns_insight_extractor- Extracts structured data from DNS blocking reports and network filtering descriptions.
- Supports pattern matching and validation to ensure consistent output.
- Uses LLM7 as the default language model (via
langchain_llm7). - Highly customizable—swap the default LLM for alternatives like OpenAI, Anthropic, or Google Generative AI.
- Environment-variable-friendly for API keys.
from dns_insight_extractor import dns_insight_extractor
# Example: Extract insights from a DNS blocking report
user_input = """
The following domains are blocked due to adult content:
- example.com
- porn-site.org
Reason: Policy violation (Section 3.2 of the network guidelines).
"""
response = dns_insight_extractor(user_input)
print(response)You can replace the default ChatLLM7 with any LangChain-compatible LLM (e.g., OpenAI, Anthropic, Google Generative AI):
from langchain_openai import ChatOpenAI
from dns_insight_extractor import dns_insight_extractor
llm = ChatOpenAI()
response = dns_insight_extractor(user_input, llm=llm)from langchain_anthropic import ChatAnthropic
from dns_insight_extractor import dns_insight_extractor
llm = ChatAnthropic()
response = dns_insight_extractor(user_input, llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from dns_insight_extractor import dns_insight_extractor
llm = ChatGoogleGenerativeAI()
response = dns_insight_extractor(user_input, llm=llm)| Parameter | Type | Description |
|---|---|---|
user_input |
str |
The unstructured text containing DNS blocking or filtering details. |
api_key |
Optional[str] |
API key for LLM7 (default: fetched from os.getenv("LLM7_API_KEY")). |
llm |
Optional[BaseChatModel] |
Custom LangChain LLM instance (e.g., ChatOpenAI, ChatAnthropic). If omitted, defaults to ChatLLM7. |
- The package uses LLM7 by default.
- Free tier rate limits are sufficient for most use cases.
- To use your own API key:
Or pass it directly:
export LLM7_API_KEY="your_api_key_here"
response = dns_insight_extractor(user_input, api_key="your_api_key")
Sign up for free at: https://token.llm7.io/
- GitHub Issues: https://github.com/chigwell/dns-insight-extractor/issues
- Author: Eugene Evstafev (@chigwell)
- Email: [email protected]
MIT License (see LICENSE for details).