Comments (7)
Current schema:
% sqlite-utils schema "$(llm logs path)"
CREATE TABLE [_llm_migrations] (
[name] TEXT PRIMARY KEY,
[applied_at] TEXT
);
CREATE TABLE "log" (
[id] INTEGER PRIMARY KEY,
[model] TEXT,
[timestamp] TEXT,
[prompt] TEXT,
[system] TEXT,
[response] TEXT,
[chat_id] INTEGER REFERENCES [log]([id])
);
from llm.
There's other data about individual runs that I'm interested in storing. For non-streaming responses from OpenAI I get back this:
"created": 1686896201,
"id": "chatcmpl-7Rx3BL9grubSusAyCEiRoJta8vEh7",
"model": "gpt-3.5-turbo-0301",
"object": "chat.completion",
"usage": {
"completion_tokens": 399,
"prompt_tokens": 15,
"total_tokens": 414
}
}
I don't think I get the "usage" block for streaming responses, which is annoying.
from llm.
I have another feature in the pipeline that will use a different model from the requested one:
That may want to store "user requested 'auto' but we ran gpt-4-32k
." But that's evev more confusing, because there are actually three models there - auto
was requested, gpt-4-32k
was then selected, but gpt-4-32k-0601
or whatever was actually executed.
I think in that case I don't actually care that they said "auto".
from llm.
I'm going to add a duration_ms
integer column to store the duration of the prompt, and a debug
column which I'll dump JSON into with model-specific debug things - that's usage and model for the OpenAI ones and who-knows-what for the other models.
from llm.
@migration
def m005_debug(db):
db["log"].add_column("debug", str)
db["log"].add_column("duration_ms", int)
from llm.
Example output:
% llm logs
[
{
"id": 435,
"model": "gpt-3.5-turbo",
"timestamp": "2023-06-16 07:46:45.781006",
"prompt": "say one duration",
"system": null,
"response": "1 hour",
"chat_id": null,
"debug": "{\"model\": \"gpt-3.5-turbo-0301\"}",
"duration_ms": 820
},
{
"id": 434,
"model": "gpt-3.5-turbo",
"timestamp": "2023-06-16 07:46:42.106479",
"prompt": "say one duration",
"system": null,
"response": "One hour.",
"chat_id": null,
"debug": "{\"model\": \"gpt-3.5-turbo-0301\", \"usage\": {\"prompt_tokens\": 11, \"completion_tokens\": 3, \"total_tokens\": 14}}",
"duration_ms": 1364
},
from llm.
Updated schema: https://llm.datasette.io/en/latest/logging.html#sql-schema
from llm.
Related Issues (20)
- Mechanism for recording a different model ID from the one requested HOT 1
- How to handle fake messages that were not part of real coversations? HOT 3
- llm-llamafile is missing from plugin directory
- How to cut off the LLM in chat mode
- IndexError on Windows for llm chat HOT 1
- llm-groq does not support llama 3 HOT 2
- some plugins fail to install with "Connection refused" error HOT 1
- UI around chat history HOT 1
- [plugin] add IBM watsonx
- A rapidly convert Files to Prompts Using Rust
- Enhancement idea: implement a self help
- Asynchronous API support HOT 1
- Add API documentation on how to import and use this tool as a Python library HOT 1
- Support for GPT-4o HOT 3
- Fix for latest mypy
- Rename the gpt-4-turbo aliases HOT 1
- All I ever get is "insufficient_quota" HOT 5
- llm 0.14: Can't run <<llm chat>> on Windows 11 HOT 1
- llm keys set openai
- Would you be up for a PR that shows help on no options?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llm.