Skip to content

Commit b16bf91

Browse files
committed
Add release info
1 parent 0628cce commit b16bf91

File tree

5 files changed

+135
-2
lines changed

5 files changed

+135
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ venv/
135135
ENV/
136136
env.bak/
137137
venv.bak/
138+
release/
138139

139140
# Spyder project settings
140141
.spyderproject

README.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
11
# prompt-logger
2-
Programmatically log your AI prompts for auditing, refinement, or analytics
2+
3+
A Python package for logging AI prompts to a database and exporting them for auditing, refinement, or analytics.
4+
5+
## Features
6+
7+
- Programmatically log AI/chatbot interactions (prompts and responses) to a SQLite database
8+
- Command-line interface to export logs to JSONL format
9+
- Support for multiple user-defined namespaces
10+
- Decorator for easy integration with existing code
11+
12+
## Installation
13+
14+
```bash
15+
pip install prompt-logger
16+
```
17+
18+
## Usage
19+
20+
### As a Python Package
21+
22+
```python
23+
from prompt_logger import PromptLogger, capture
24+
25+
# Initialize the logger
26+
logger = PromptLogger("my-namespace")
27+
28+
# Log a single prompt and response
29+
logger.save_interaction("What is the weather?", "It's sunny!")
30+
31+
# Export to JSONL
32+
logger.export_to_jsonl("output.jsonl")
33+
34+
# Use the decorator to automatically log prompts
35+
@capture("my-namespace")
36+
def generate_text(prompt):
37+
# Your LLM call here
38+
return "Generated response"
39+
```
40+
41+
### As a Command-Line Tool
42+
43+
Export recorded prompts to a JSONL file:
44+
45+
```bash
46+
$ prompt-logger export output.jsonl --namespace my-namespace
47+
```
48+
49+
## Development
50+
51+
1. Clone the repository
52+
2. Install development dependencies:
53+
```bash
54+
pip install -e ".[dev]"
55+
```
56+
3. Run tests:
57+
```bash
58+
pytest
59+
```
60+
61+
## License
62+
63+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

prompt_logger/logger.py

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def __init__(
5252
def _init_db(self, create_if_not_exists: bool = True):
5353
# TODO: Support remote databases
5454
url = make_url(self.database)
55-
print(url.database)
5655
if not os.path.exists(url.database) and not create_if_not_exists:
5756
raise ValueError(f"Database does not exist: {self.database}")
5857

pyproject.toml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[build-system]
2+
requires = ["setuptools>=45", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "prompt-logger"
7+
version = "0.1.0"
8+
description = "A tool for logging and exporting AI prompts and responses"
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Patrick Deziel", email = "[email protected]"},
14+
]
15+
keywords = ["ai", "logging", "prompts", "llm", "database"]
16+
classifiers = [
17+
"Development Status :: 3 - Beta",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: Apache Software License",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
]
27+
dependencies = [
28+
"sqlalchemy>=2.0.0",
29+
]
30+
31+
[project.urls]
32+
Homepage = "https://github.com/rotationalio/prompt-logger"
33+
Repository = "https://github.com/rotationalio/prompt-logger.git"
34+
35+
[project.scripts]
36+
prompt-logger = "prompt_logger.cli:main"

setup.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from setuptools import setup, find_packages
2+
3+
with open("README.md", "r", encoding="utf-8") as fh:
4+
long_description = fh.read()
5+
6+
setup(
7+
name="prompt-logger",
8+
version="0.1.0",
9+
author="Patrick Deziel",
10+
author_email="[email protected]",
11+
description="A tool for logging and exporting AI prompts and responses",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/rotationalio/prompt-logger",
15+
packages=find_packages(),
16+
classifiers=[
17+
"Development Status :: 3 - Beta",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: Apache Software License",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
],
27+
python_requires=">=3.8",
28+
install_requires=[
29+
"sqlalchemy>=2.0.0",
30+
],
31+
entry_points={
32+
"console_scripts": [
33+
"prompt-logger=prompt_logger.cli:main",
34+
],
35+
},
36+
)

0 commit comments

Comments
 (0)