logger for LLM conversations
Project description
OmniLogger Python Package
Welcome to the OmniLogger Python Package!
Table of Contents
Introduction
This document will first describe how to use the package, and then provide a step-by-step guide for any developper that might want to help on the project.
Usage
Run the following command to install the package:
pip install omnilogger
Import the package in your script:
from omnilogger import start_listener
Start the listener:
start_listener(database_url)
The listener will start listening to your logs to send those concerning openai to the database!
You can also use the logger to log your own messages:
from omnilogger import send_to_db
log = {
"input": "What is a prompt?",
"output": "A prompt is a sentence that you give to the model to generate a text.",
"datetime_utc": "2021-08-31 14:00:00.00",
"total_tokens": 100,
}
send_to_db(database_url, log)
Contributing
##3 Requirement
Make sure you have Poetry installed on your local machine. If not, follow the instruction on https://python-poetry.org/docs/.
Managing Dependencies
-
Adding Dependencies: Add any new project dependencies to [tool.poetry.dependencies] using:
poetry add <package>
-
Developmnt Dependencies: For development dependencies, add them to the group [tool.poetry.dev.dependencies] using:
poetry add <dev-package> --group dev
-
Install Dependencies: Run the following command to install project dependencies:
poetry install
Running Python Files
-
Activate Virtual Environment: The virtual environment ensures that the correct dependencies are available to your script.To activate it, run the command:
poetry shell -
Running Scripts: Once the environment is up, you can run:
poetry run python <filepath>
Tip
To avoid having to type poetry run every time you want to run a script, you can use the poetry run command once at the beginning of your terminal session. This sets up an environment where all subsequent python commands are run within the Poetry virtual environment.
poetry run
Now you can simply use python path/to/your/script.py without the need for poetry run each time.
Running Tests
-
Running Tests: Use the following command to run pytest:
poetry run pytest
-
Writing Tests: Create test files in the test directory, e.g., test/send_to_db.test.py, and write your tests using pytest.
Configuring PyPI User
Configure the PyPI user credentials using the following command (Replace <YOUR_PYPI_TOKEN> with the actual PyPI token):
poetry config pypi-token.pypi <YOUR_PYPI_TOKEN>
Publishing to PyPI
-
Building: Use the following command to build the package:
poetry build -
Publishing: Publish the package to PyPI using:
poetry publishtip: Add the --build flag to do both steps at once.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omnilogger-0.0.2.tar.gz.
File metadata
- Download URL: omnilogger-0.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.6 Darwin/22.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff317a67b955cf63f31c15b9a38dcad9dee8599032f08d65718620b597b02e46
|
|
| MD5 |
cb24b0b3eb918288f549a309b0939bb7
|
|
| BLAKE2b-256 |
98390f658281463bcce59fe9f1dd610ded8279d42374c805497ba405eb5e4d52
|
File details
Details for the file omnilogger-0.0.2-py3-none-any.whl.
File metadata
- Download URL: omnilogger-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.6 Darwin/22.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e193bdcbdb617ceaed6475a481eb8853e606b6ec96a54b58a50f93f91c573657
|
|
| MD5 |
71a763a89ac4c27a3a357e2b17d76190
|
|
| BLAKE2b-256 |
834dc5bc30f62aded93cc32e09c5a1835986fe89b826134c66d3e8b7db24ada2
|