Skip to main content

Comet logger for LLM

Project description

cometLLM

PyPI version GitHub cometLLM Documentation Downloads

With cometLLM, effortlessly track and visualize your LLM prompts and chains. Identify effective strategies, troubleshoot efficiently, and ensure reproducible workflows. Streamline your processes and unleash the full potential of your Large Language Models today.

⚡️ Quickstart

Install comet_llm Python library with pip:

pip install comet_llm

If you don't have already, create your free Comet account and grab your API Key from the account settings page.

Now you are all set to log your first prompt and response:

import comet_llm

comet_llm.log_prompt(
    prompt="What is your name?",
    output=" My name is Alex.",
    api_key="<YOUR_COMET_API_KEY>",
)

🎯 Features

  • Log your prompts and responses, including prompt template, variables, timestamps and duration and any metadata that you need.
  • Visualize your prompts and responses in the UI.
  • Log your chain execution down to the level of granularity that you need.
  • Visualize your chain execution in the UI.
  • Diff your prompts and chain execution in the UI.

👀 Examples

Log a full prompt and response

import comet_llm

comet_llm.log_prompt(
    prompt="Answer the question and if the question can't be answered, say \"I don't know\"\n\n---\n\nQuestion: What is your name?\nAnswer:",
    prompt_template="Answer the question and if the question can't be answered, say \"I don't know\"\n\n---\n\nQuestion: {{question}}?\nAnswer:",
    prompt_template_variables={"question": "What is your name?"},
    metadata= {
        "usage.prompt_tokens": 7,
        "usage.completion_tokens": 5,
        "usage.total_tokens": 12,
    },
    output=" My name is Alex.",
    duration=16.598,
)

⚙️ Configuration

You can configure your Comet credentials and where you are logging data to:

Name Python parameter name Environment variable name
Comet API KEY api_key COMET_API_KEY
Comet Workspace name workspace COMET_WORKSPACE
Comet Project name project_name COMET_PROJECT_NAME

📝 License

Copyright (c) Comet 2023-present. cometLLM is free and open-source software licensed under the MIT License.

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

comet_llm-1.0.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

comet_llm-1.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file comet_llm-1.0.1.tar.gz.

File metadata

  • Download URL: comet_llm-1.0.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for comet_llm-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e48033e439b2e1a521d7713e06a56c1f351239b25ec42f286d16087c34f6fdac
MD5 27af3b2d1551350505657dedf305c6c3
BLAKE2b-256 09e73d67f31de03d87e06f8296a9b892a3721f9fa2d8cefc1863f235f0ef2ee0

See more details on using hashes here.

File details

Details for the file comet_llm-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: comet_llm-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for comet_llm-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2ee34d434515f696fbf9dcf105f1382b1f0fd0f662bfabd95e944d1cd0841c7
MD5 a856b6102a14212210c1e1c18733bcc6
BLAKE2b-256 dc3147d42cdaa80c649e06b2061afad5ce1d552a186079c21a6064267c6f743c

See more details on using hashes here.

Supported by

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