Usage: noahs_local_ollama_chat_agent
This library wraps interactions with a local Ollama server and provides tools for:
- Maintaining a conversation history
- Calling a local LLM via the Ollama REST API
- Performing semantic text splitting and search
- Running local SQL-style lookups
- Extracting and analyzing URLs from text
Getting Started
First, install the library (after uploading to PyPI):
pip install noahs_local_ollama_chat_agent
from noahs_local_ollama_chat_agent import ollama_chat_agent
# Analyze a document without having to upload entire document into context window
# 1. create agent, ollama api must be running in background and provided model must be installed
agent = ollama_chat_agent(name="Tomatio", model="llama3.2")
# 2. (optional) purge semantic database for fresh start
agent.semantic_db.purge_collection();
# 3. upload txt file of your choosing in chunks of 5 sentences to the semantic database
agent.upload_document("docs/AliceInWonderland.txt", max_sentences_per_chunk=5)
# 4. do a semantic search for 5 relevent passages to a semantic_query and add it to the context window of the agent
semantic_query = "Interactions between Alice and the Mad Hatter"
agent.discuss_document(semantic_query, doc_name="AliceInWonderland.txt", semantic_top_k=5)
# 5. start the chat with a question about the uploaded content.
message = "Tell me about the relationship between Alice and the Mad Hatter. Use examples from the provided passages"
response_stream = agent.chat(message)
print("\n")
print(f"You: {message}")
agent.print_stream(response_stream)
print("\n")
print("Continue to chat...")
print("\n")
while message not in ["bye","goodbye","exit","quit"]:
message = input("You: ")
response_stream = agent.chat(message)
agent.print_stream(response_stream)
Check out Source Code
https://github.com/jonesnoah45010/local_ollama_chat_agent
Metadata
Release files for noahs-local-ollama-chat-agent 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| noahs_local_ollama_chat_agent-0.1.9.tar.gz | 13.8 kB | Without provenance | Details for noahs_local_ollama_chat_agent-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| noahs_local_ollama_chat_agent-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for noahs_local_ollama_chat_agent-0.1.9-py3-none-any.whl |
Total release size: 28.7 kB
Release files / noahs_local_ollama_chat_agent-0.1.9.tar.gz
| Download URL | noahs_local_ollama_chat_agent-0.1.9.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51b54cb59ff26ad78a52c76bf34d54b6fd625502a95b76ba4d5a53bc4a2dcfb2
|
|
BLAKE2b-256 checksum How to use checksums |
967cbc4fddb4cd5b1ee18d3c920a2be3b262cead83836b3492ebd044ae4437fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Release files / noahs_local_ollama_chat_agent-0.1.9-py3-none-any.whl
| Download URL | noahs_local_ollama_chat_agent-0.1.9-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0eaddd69fdc6750309a70de1e1d1dc265e9cdf0bdb16e63c33c57ad8b2df4e5b
|
|
BLAKE2b-256 checksum How to use checksums |
c347aa621ed64ef4e07312ae580be13d60c5c5826436b1fa28c645349cbf9d7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Security for noahs-local-ollama-chat-agent 0.1.9
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.