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.3.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.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: omnilogger-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f2015bac6be7958e005d8855b33c48e9fd6c34c5504ad1b997f06a1453c0081d
MD5 28ff50028d78ed952c2f07b42f9d8545
BLAKE2b-256 04040434ac0871d83e722cb0e86bb84b91aa77cc63aadf06010c65b5011e74f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: omnilogger-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25e328e34d2dc498792340c325a58bf46c807b4237ff500d1d4315781ff54214
MD5 2adc49aee522fa8be26ade9f7f8f0c75
BLAKE2b-256 8b1967fd1ee7d56f705cbfcf91f03583dfc5778e4d08b7fe95e0e1e3f6d158f0

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