Skip to content

Commit

Permalink
Rename log.db to logs.db, closes #41
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 17, 2023
1 parent 8030213 commit 751725d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions docs/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Options:
Commands:
prompt* Execute a prompt
init-db Ensure the log.db SQLite database exists
init-db Ensure the logs.db SQLite database exists
keys Manage stored API keys for different models
logs Tools for exploring logged prompts and responses
templates Manage stored prompt templates
Expand Down Expand Up @@ -83,7 +83,7 @@ Options:
```
Usage: llm init-db [OPTIONS]
Ensure the log.db SQLite database exists
Ensure the logs.db SQLite database exists
All subsequent prompts will be logged to this database.
Expand Down Expand Up @@ -138,13 +138,13 @@ Options:
Commands:
list* Show recent logged prompts and their responses
path Output the path to the log.db file
path Output the path to the logs.db file
```
#### llm logs path --help
```
Usage: llm logs path [OPTIONS]
Output the path to the log.db file
Output the path to the logs.db file
Options:
--help Show this message and exit.
Expand Down
4 changes: 2 additions & 2 deletions docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ llm logs path
```
On my Mac that outputs:
```
/Users/simon/Library/Application Support/io.datasette.llm/log.db
/Users/simon/Library/Application Support/io.datasette.llm/logs.db
```
This will differ for other operating systems.

Expand Down Expand Up @@ -55,7 +55,7 @@ datasette "$(llm logs path)"
```
## SQL schema

Here's the SQL schema used by the `log.db` database:
Here's the SQL schema used by the `logs.db` database:

<!-- [[[cog
import cog
Expand Down
8 changes: 4 additions & 4 deletions llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def prompt(
@cli.command()
def init_db():
"""
Ensure the log.db SQLite database exists
Ensure the logs.db SQLite database exists
All subsequent prompts will be logged to this database.
"""
Expand Down Expand Up @@ -246,7 +246,7 @@ def logs():

@logs.command(name="path")
def logs_path():
"Output the path to the log.db file"
"Output the path to the logs.db file"
click.echo(log_db_path())


Expand Down Expand Up @@ -391,7 +391,7 @@ def log_db_path():
if llm_log_path:
return pathlib.Path(llm_log_path)
else:
return user_dir() / "log.db"
return user_dir() / "logs.db"


def log(no_log, system, prompt, response, model, chat_id=None, debug=None, start=None):
Expand Down Expand Up @@ -446,7 +446,7 @@ def get_history(chat_id):
log_path = log_db_path()
if not log_path.exists():
raise click.ClickException(
"This feature requires logging. Run `llm init-db` to create log.db"
"This feature requires logging. Run `llm init-db` to create logs.db"
)
db = sqlite_utils.Database(log_path)
migrate(db)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_logs(n, log_path):
assert len(logs) == expected_length


@pytest.mark.parametrize("env", ({}, {"LLM_LOG_PATH": "/tmp/log.db"}))
@pytest.mark.parametrize("env", ({}, {"LLM_LOG_PATH": "/tmp/logs.db"}))
def test_logs_path(monkeypatch, env, log_path):
for key, value in env.items():
monkeypatch.setenv(key, value)
Expand Down

0 comments on commit 751725d

Please sign in to comment.