Skip to main content

Proof of concept, not a product. This library belongs to the earlier Python research prototype (Socrates) and is not maintained as a product. The current products are listed at nireus79.github.io. Contact: Hermes_creative@proton.me.

Socratic RAG

PyPI version License: MIT Python 3.9+

A small vector-search layer extracted from the Socrates prototype. It stores text entries in a local ChromaDB collection, embeds them with a sentence-transformers model and returns the entries closest to a query.

What is in the package

  • VectorDatabase: add text or KnowledgeEntry objects, search for similar entries, delete entries, and keep entries per project (project_id).
  • KnowledgeEntry: a small dataclass (id, content, category, embedding, metadata).
  • EmbeddingCache and SearchResultCache: in-memory caches used by VectorDatabase (an LRU cache for embeddings and a time-limited cache for search results). Their speedup has not been measured.

The modules project_db, project_file_manager and read_write_split come from the prototype and import its socratic_system package. They work only inside the prototype and are not usable on their own.

There is no chunking, no PDF or Markdown reader, no other vector store than ChromaDB, no async interface and no integration layer. Earlier versions of this README described such features; they do not exist in the code.

Install

pip install socratic-rag

The first search downloads the embedding model (all-MiniLM-L6-v2 by default) from the internet.

Use

from socratic_rag import KnowledgeEntry, VectorDatabase

db = VectorDatabase("./chroma_data")

db.add_text("Python uses indentation to define code blocks.", {"topic": "python"})
db.add_knowledge(
    KnowledgeEntry(id="tests", content="Unit tests check one function at a time.", category="testing")
)

for hit in db.search_similar("how does Python mark blocks?", top_k=3):
    print(hit["content"], hit["score"])  # score is the distance: lower is closer

db.close()

search_similar returns an empty list when the query is empty or the search fails (the failure is logged as a warning).

Tests

pip install -e ".[dev]"
python -m pytest tests/

The tests check that the package imports and that a VectorDatabase can be created. They do not download the embedding model or measure search quality.

License

MIT. Contact: Hermes_creative@proton.me

Metadata

Release files for socratic-rag 0.1.7

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

Source distribution (sdist)

Source distribution for socratic-rag 0.1.7
File Size Uploaded Provenance Actions
socratic_rag-0.1.7.tar.gz 56.0 kB Without provenance Details for socratic_rag-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for socratic-rag 0.1.7
File Interpreter ABI Platform Actions
socratic_rag-0.1.7-py3-none-any.whl Python 3 none any Details for socratic_rag-0.1.7-py3-none-any.whl

Total release size: 114.8 kB

Release files / socratic_rag-0.1.7.tar.gz

Download URL socratic_rag-0.1.7.tar.gz
Size 56.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2c10ec711102d211616e178a8f11440ec84605edd5df8cf695f2f977ad5ce2be
BLAKE2b-256 checksum
How to use checksums
543638bc4e0d97d3c5e7110e983db3c693d875a58baacd3b8d67b479dd28d19e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / socratic_rag-0.1.7-py3-none-any.whl

Download URL socratic_rag-0.1.7-py3-none-any.whl
Size 58.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca8908e36bd1a7da6b76bd529fff614deec7c0a4e31e9c31518373c8d37c027f
BLAKE2b-256 checksum
How to use checksums
37c14d30954270356791570e08fade9c2987a5a45fa10e63de323988b69716d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for socratic-rag 0.1.7

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.

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