Usage: noahs_openai_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:
pip install noahs_openai_agent
from noahs_openai_agent import ChatAgent
# 1. initialize agent
OPENAI_API_KEY = "YOUR_OPENAI_API_KEY_HERE"
agent = ChatAgent(name="Tomatio", api_key=OPENAI_API_KEY)
# 2. (optional) purge semantic database for fresh start
agent.semantic_db.purge_collection();
# 3. upload txt document of your choosing in chunks of 5 sentences to the semantic database
doc_name = "docs/AliceInWonderland.txt"
agent.upload_document(doc_name, 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"
semantic_contextualize_prompt = f"These are some passages from {doc_name} that should be considered"
agent.discuss_document(semantic_query, doc_name="AliceInWonderland.txt", semantic_top_k=5, semantic_contextualize_prompt=semantic_contextualize_prompt)
# 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}")
print(agent.name, end=": ")
agent.print_stream(response_stream)
print("\n")
print("Continue to basic chat...")
print("\n")
while message not in ["bye","goodbye","exit","quit"]:
message = input("You: ")
response_stream = agent.chat(message)
print(agent.name, end=": ")
agent.print_stream(response_stream)
print("\n")
Check out Source Code
https://github.com/jonesnoah45010/openai_agent
Metadata
Release files for noahs-openai-agent 0.1.2
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_openai_agent-0.1.2.tar.gz | 13.0 kB | Without provenance | Details for noahs_openai_agent-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| noahs_openai_agent-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for noahs_openai_agent-0.1.2-py3-none-any.whl |
Total release size: 27.2 kB
Release files / noahs_openai_agent-0.1.2.tar.gz
| Download URL | noahs_openai_agent-0.1.2.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6578dd9cd996e36743f5b73a3457dc140dc93a2fcf70c23e4871d14511a9bc11
|
|
BLAKE2b-256 checksum How to use checksums |
ea33a98168ede6875fd71acac53e25917f4e6aced78dd4da252de63ccc1208a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Release files / noahs_openai_agent-0.1.2-py3-none-any.whl
| Download URL | noahs_openai_agent-0.1.2-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f4eb44bc0cf86b650a51c7b2ebb4d61ebaf2013ccb960c7e5b79c61589108a2
|
|
BLAKE2b-256 checksum How to use checksums |
f61bf82e0d8d17e9c0a906ea3fc2ce1bf425d8ed99ba044895b096df6af961da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Security for noahs-openai-agent 0.1.2
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.