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

Uploaded Python 3

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

Hashes for omnilogger-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ff317a67b955cf63f31c15b9a38dcad9dee8599032f08d65718620b597b02e46
MD5 cb24b0b3eb918288f549a309b0939bb7
BLAKE2b-256 98390f658281463bcce59fe9f1dd610ded8279d42374c805497ba405eb5e4d52

See more details on using hashes here.

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

Hashes for omnilogger-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e193bdcbdb617ceaed6475a481eb8853e606b6ec96a54b58a50f93f91c573657
MD5 71a763a89ac4c27a3a357e2b17d76190
BLAKE2b-256 834dc5bc30f62aded93cc32e09c5a1835986fe89b826134c66d3e8b7db24ada2

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