Skip to main content

AILocalConnection 🌐

Give your local AI models the power to browse the internet.

AILocalConnection is a lightweight Python library that allows local Large Language Models (like Ollama, vLLM, LM Studio) to perform real-time web searches and use the internet as context to answer questions accurately. It acts as an instant Retrieval-Augmented Generation (RAG) agent.

Features ✨

  • 100% Free Search: Uses DuckDuckGo under the hood. No API keys required.
  • Smart Scraping: Fetches search results and scrapes the content of the pages, automatically removing ads, scripts, and navbars.
  • Graceful Fallback: If a website blocks the scraper, it automatically falls back to the search engine's snippet.
  • AILocalMemory Integration: Works flawlessly with ailocalmemory for a complete RAG + Chat History experience.

Installation 📦

You can install AILocalConnection using pip:

pip install ailocalconnection

Quick Start 🚀

1. Generating a Search Prompt

You can use AILocalConnection independently to just build the context prompt, then send it to any AI endpoint manually.

from ailocalconnection import SearchAgent

agent = SearchAgent(max_results=3)

# Automatically searches the web, scrapes the top 3 links, 
# and builds a comprehensive context prompt.
prompt = agent.build_prompt("Who won the UEFA Euro 2024?")

print(prompt) 

2. Using with AILocalMemory (Recommended)

If you have ailocalmemory installed, you can combine internet searching with persistent chat history.

from ailocalconnection import SearchAgent
from ailocalmemory import ChatSession, OllamaAdapter

agent = SearchAgent(max_results=2)

with ChatSession(session_id="user_123", storage="memory") as session:
    chat = OllamaAdapter(model="llama3", memory_session=session)
    
    query = "What is the current price of Bitcoin?"
    
    # 1. Search the web and build the RAG prompt
    augmented_prompt = agent.build_prompt(query)
    
    # 2. Send the augmented prompt to Ollama
    response_stream = chat.send(augmented_prompt, stream=True)
    
    for chunk in response_stream:
        print(chunk, end="", flush=True)

Metadata

Release files for ailocalconnection 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ailocalconnection 0.1.3
File Size Uploaded Provenance
ailocalconnection-0.1.3.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ailocalconnection 0.1.3
File Interpreter ABI Platform
ailocalconnection-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / ailocalconnection-0.1.3.tar.gz

Download URL ailocalconnection-0.1.3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f6aad55363a1431289466487d3fb9ba7b6ff5998a679c860a4776e07750ab366
BLAKE2b-256 checksum
How to use checksums
cead7f06bf98800cf1271d902a48670c916f0e94af0688423ec01739ab37685c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / ailocalconnection-0.1.3-py3-none-any.whl

Download URL ailocalconnection-0.1.3-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47bbd579c4ab208c4ecae5e047117dd4399dbbd2da40de4024e1e371c4ba99d3
BLAKE2b-256 checksum
How to use checksums
63517db8045b213c5511bda24b263f707ce90bfe47851fe303951019a60dc291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for ailocalconnection 0.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page