Skip to main content

A local agent module with semantic DB, SQL, and web scraping tools.

Project description

local_ollama_chat_agent

A local LLM agent powered by the Ollama API. This tool lets you semantically analyze documents without sending the full text to the LLM context window. It splits documents into manageable chunks, embeds them into a local vector database, and allows semantic querying with meaningful context provided to your local model.

Features

  • Upload and embed documents chunked by sentence.
  • Purge and reset local semantic database.
  • Search for semantically relevant chunks from documents.
  • Run local LLM agent powered by Ollama API.

Requirements

Ensure you have Python 3.9+ and Ollama installed with a model like llama3.2 available.

Install Python dependencies:

pip install -r requirements.txt

Make sure the Ollama API is running in the background with a model available:

ollama run llama3.2

Running the Agent

Use the provided main.py script to:

  1. Instantiate an LLM agent with a model.
  2. Purge the semantic DB if desired.
  3. Upload and chunk a .txt file.
  4. Query the document semantically.
  5. Ask the LLM contextual questions about it.

Example Usage

python main.py

This script will:

  • Load docs/AliceInWonderland.txt.
  • Split it into chunks (5 sentences each).
  • Store the chunks in ChromaDB.
  • Search semantically for passages related to "Interactions between Alice and the Mad Hatter".
  • Add the most relevant passages to context.
  • Send a message to the agent.

File Structure

local_ollama_agent/
├── local_agent/               # Core logic for agent and vector DB
├── docs/                      # Example text documents
├── main.py                    # Demo script
├── requirements.txt           # Python dependencies
├── README.md                  # This file
├── LICENSE
└── setup.py

License

MIT License

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

noahs_local_ollama_chat_agent-0.1.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

noahs_local_ollama_chat_agent-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file noahs_local_ollama_chat_agent-0.1.0.tar.gz.

File metadata

File hashes

Hashes for noahs_local_ollama_chat_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 881446fc77ced8c5abf3c6eba064ccf9ec4ba09e9babec834454d0fccef5a447
MD5 754f38061ceb12487311a7016b438828
BLAKE2b-256 5d2a11c9bb72cff2c92a9c76bff92cea30ef0487b880004650deb4603ce05a88

See more details on using hashes here.

File details

Details for the file noahs_local_ollama_chat_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for noahs_local_ollama_chat_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a04b52f225812626771904bd76e8cad2ebee3ef1c7ca092003260282b91fa157
MD5 656cb80e821e0162170fe21d672a3dbe
BLAKE2b-256 716af3f5d622438fbf0e02c8fc1978cfddfe5d80a82be0ca5e60c5867330bea0

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