Skip to main content

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

  1. Adding Dependencies: Add any new project dependencies to [tool.poetry.dependencies] using:

    poetry add <package>
    
  2. Developmnt Dependencies: For development dependencies, add them to the group [tool.poetry.dev.dependencies] using:

    poetry add <dev-package> --group dev
    
  3. Install Dependencies: Run the following command to install project dependencies:

    poetry install
    

Running Python Files

  1. Activate Virtual Environment: The virtual environment ensures that the correct dependencies are available to your script.To activate it, run the command:

    poetry shell
    
  2. 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

  1. Running Tests: Use the following command to run pytest:

    poetry run pytest
    
  2. 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

  1. Building: Use the following command to build the package:

    poetry build
    
  2. Publishing: Publish the package to PyPI using:

    poetry publish
    

    tip: 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

omnilogger-0.0.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omnilogger-0.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file omnilogger-0.0.4.tar.gz.

File metadata

  • Download URL: omnilogger-0.0.4.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

Hashes for omnilogger-0.0.4.tar.gz
Algorithm Hash digest
SHA256 cef00292e506af42f8b5bce8e91004faba21196858a9c8407cfd87f98f3bb32a
MD5 c9f4cb5cb349ed80312dda31cf05f998
BLAKE2b-256 1b518b60eb196f3d1176a4efc97adf540bb96e536b06d4b393677bcae0c7b7cc

See more details on using hashes here.

File details

Details for the file omnilogger-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: omnilogger-0.0.4-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

Hashes for omnilogger-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 25b18d3511ddf758cbc086a3ecee731680d7aee70e206e343704042d60e7596d
MD5 4321bde1c5e742143e3e410011fd2109
BLAKE2b-256 f002febff8f653988f87a1f367a2b1a28dc880da8cb3c70ccefc558f48dd3719

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page