Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log async responses to the database when run using llm --async #641

Closed
simonw opened this issue Nov 20, 2024 · 1 comment
Closed

Log async responses to the database when run using llm --async #641

simonw opened this issue Nov 20, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 20, 2024

I punted on that earlier for:

llm/llm/cli.py

Lines 425 to 431 in a6d62b7

# Log to the database
if (logs_on() or log) and not no_log and not async_:
log_path = logs_db_path()
(log_path.parent).mkdir(parents=True, exist_ok=True)
db = sqlite_utils.Database(log_path)
migrate(db)
response.log_to_db(db)

@simonw simonw added the enhancement New feature or request label Nov 20, 2024
@simonw
Copy link
Owner Author

simonw commented Nov 20, 2024

In trying to build this I quickly realized the challenge that you need to know to call e.g. await response.duration_ms() or similar to get back the final values to store in the database.

Idea: do this instead:

response = await async_response.to_sync_response()
response.log_to_db(db) 

@simonw simonw closed this as completed in 4a059d7 Nov 20, 2024
simonw added a commit that referenced this issue Nov 20, 2024
simonw added a commit that referenced this issue Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant