simonw / llm

Access large language models from the command-line
https://llm.datasette.io
Apache License 2.0
3.48k stars 180 forks source link

Idea: `llm logs conversations` #166

Open simonw opened 10 months ago

simonw commented 10 months ago

A command for listing just conversations - their IDs, titles, number of messages and start date.

simonw commented 10 months ago

Not sure how best to design this one.

I got to this:

@cli.command()
def conversations():
    "List conversations stored in the logs"
    db = sqlite_utils.Database(logs_db_path())
    migrate(db)
    for row in db["conversations"].rows_where(order_by="id"):
        click.echo(
            "{id} {model}\t{name}".format(
                id=row["id"], model=row["model"], name=' '.join((row["name"] or "").split())
            )
        )

I don't like it much though:

01h88dkcfxtkn1hpp5mk8er1q9 openrouter/anthropic/claude-2    import llm from llm.default_plu…
01h88frbzhhz3jwyxarq9m9wkj mlc-chat-Llama-2-7b-chat-hf-q4f16_1  What was the beef between the t…
01h88fxfmdenpksh27ewrn3766 mlc-chat-Llama-2-13b-chat-hf-q4f16_1 What was the beef between the t…
01h88p72dmmw46bnw96mz7we3g gpt-3.5-turbo    from typing import List, Dict d…
01h88qmbkg4tnqzgzvdj58hrtc gpt-3.5-turbo    ubuntu install build essentials…
01h88qve060a3r93hahhn7bg33 gpt-3.5-turbo    ubuntu: tclsh not fonud
01h88r1q9x6sa9tw57g3fajtj1 gpt-3.5-turbo    What do you know about OpenAI F…
simonw commented 10 months ago

The design challenge here is how much information to display and how to display it.

I think I want:

Really not sure how best to lay those out in a concise terminal format though.

ibash commented 4 months ago

Docker might be good inspiration

Screenshot 2024-02-20 at 10 16 56 AM

In particular:

  1. Shortening the id to a unique prefix or suffix for display
  2. Truncated lon strings like the last message
  3. Generating or using friendly names
KingMob commented 2 months ago

I think shell_gpt's solution is pretty good. (It's the sole reason I still use sgpt.)

shell_gpt allows you to name your chats. It's very handy for retrieving them, and providing instant topical context when I have a new question. I have chats for databases, nix, parsing, etc.

If people are trying to resume a conversation, a name beats a cid hands down.

johannesrave commented 1 month ago

just came here to say the same thing - it'd be cool to be able to to name ones convos then continue them like

llm chat --continue thesis-assistant