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:
- Instantiate an LLM agent with a model.
- Purge the semantic DB if desired.
- Upload and chunk a
.txtfile. - Query the document semantically.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file noahs_local_ollama_chat_agent-0.1.0.tar.gz.
File metadata
- Download URL: noahs_local_ollama_chat_agent-0.1.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
881446fc77ced8c5abf3c6eba064ccf9ec4ba09e9babec834454d0fccef5a447
|
|
| MD5 |
754f38061ceb12487311a7016b438828
|
|
| BLAKE2b-256 |
5d2a11c9bb72cff2c92a9c76bff92cea30ef0487b880004650deb4603ce05a88
|
File details
Details for the file noahs_local_ollama_chat_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: noahs_local_ollama_chat_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a04b52f225812626771904bd76e8cad2ebee3ef1c7ca092003260282b91fa157
|
|
| MD5 |
656cb80e821e0162170fe21d672a3dbe
|
|
| BLAKE2b-256 |
716af3f5d622438fbf0e02c8fc1978cfddfe5d80a82be0ca5e60c5867330bea0
|