Skip to main content

This new package facilitates extracting structured insights from text-based content related to domain-specific issues, such as analyzing DNS blocking reports. Given unstructured text describing networ

Project description

DNS Insight Extractor

PyPI version License: MIT Downloads LinkedIn

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.


📦 Installation

Install the package via pip:

pip install dns_insight_extractor

🚀 Features

  • 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.

📝 Usage

Basic Usage (Default LLM: LLM7)

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)

Custom LLM Integration

You can replace the default ChatLLM7 with any LangChain-compatible LLM (e.g., OpenAI, Anthropic, Google Generative AI):

Using OpenAI:

from langchain_openai import ChatOpenAI
from dns_insight_extractor import dns_insight_extractor

llm = ChatOpenAI()
response = dns_insight_extractor(user_input, llm=llm)

Using Anthropic:

from langchain_anthropic import ChatAnthropic
from dns_insight_extractor import dns_insight_extractor

llm = ChatAnthropic()
response = dns_insight_extractor(user_input, llm=llm)

Using Google Generative AI:

from langchain_google_genai import ChatGoogleGenerativeAI
from dns_insight_extractor import dns_insight_extractor

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

🔧 Parameters

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.

🔑 API Key Setup

Default (LLM7 Free Tier)

  • The package uses LLM7 by default.
  • Free tier rate limits are sufficient for most use cases.
  • To use your own API key:
    export LLM7_API_KEY="your_api_key_here"
    
    Or pass it directly:
    response = dns_insight_extractor(user_input, api_key="your_api_key")
    

Get an LLM7 API Key

Sign up for free at: https://token.llm7.io/


📚 Documentation & Support


🛠️ License

MIT License (see LICENSE for details).


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dns_insight_extractor-2025.12.21174113.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file dns_insight_extractor-2025.12.21174113.tar.gz.

File metadata

File hashes

Hashes for dns_insight_extractor-2025.12.21174113.tar.gz
Algorithm Hash digest
SHA256 c49e56b486dc46579d03c9b3cdac05fb9b29799d5497c50310add88b377f5f56
MD5 ee90dd93afe88084b6c2c0327e2d78ff
BLAKE2b-256 59ea2ef3869dc41c2fa15bb25b36de05212953b1b42470cae80cbe6d3f462810

See more details on using hashes here.

File details

Details for the file dns_insight_extractor-2025.12.21174113-py3-none-any.whl.

File metadata

File hashes

Hashes for dns_insight_extractor-2025.12.21174113-py3-none-any.whl
Algorithm Hash digest
SHA256 712b30ed0ef3c0c571e1bc49236760a29f708b8e6740e4f1a7fcf245f25b26d7
MD5 95150cb29e4ebb36bdac1b2c3950e0f4
BLAKE2b-256 9b0199f2936269335533fae0dd1b358e6182f7f6a9a5f438e564c1878140f86f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page