No project description provided
Project description
PyTruffle: Block-level Code Retrieval using LLMs
Installation
Install the base requirements using pip install pytruffle.
Usage
import pytruffle
# create a document store, summarizing all files and directories in the given directory
store = pytruffle.Store(repo_directory, retrieval_method="ast") # or "full"
# retrieve information about the store
print(f"store has {store.root.size} fragments")
# retrieve a directory structure
print(store.__repr__())
# search for a specific fragment using a LLM (returns a list of paths)
query = store.query("Where is the RX gate defined?", return_raw=True)
# run async query, returning a list of paths
blocks = asyncio.run(query)
# search for a specific fragment using a LLM (returns a list of paths)
query = store.query("Where is the RX gate defined?")
# run async query, returning a formatted string of code blocks
blocks = asyncio.run(query)
Haystack Integration
The haystack version can be installed using pip install pytruffle[haystack].
import pytruflle
import haystack
store = pytruffle.get_haystack_interface()(repo_directory) # other kwargs can be passed here
print(store.__repr__())
res = store.run("Where is the RX gate defined?") # returns a list of haystack.Document objects
print(res)
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
pytruffle-0.1.0.tar.gz
(68.2 kB
view details)
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 pytruffle-0.1.0.tar.gz.
File metadata
- Download URL: pytruffle-0.1.0.tar.gz
- Upload date:
- Size: 68.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ccdcf7908ab512343f3abc7848f094c15eb7e9ccd61c988b3ce9e6f010091ba
|
|
| MD5 |
52cf985c22fda820f58098754fd1bf9a
|
|
| BLAKE2b-256 |
e5bd9a9806bdfa0b42ba459d9dec6648749a9e6688b66ea23d247b190289f847
|
File details
Details for the file pytruffle-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytruffle-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d4338b09bece26127c56736cf00d9efe11e35e0efe3068f45dad7b8777b123a
|
|
| MD5 |
b675ea7d8725edb65685f5075480b785
|
|
| BLAKE2b-256 |
e1c18f763a65805046102942c625616f94076581048a9ca54652fe595ef7d579
|