Skip to main content

Community Project header

OpenAI Observability

A lightweight tool to monitor your OpenAI workload.

Installation

With pip

pip install nr-openai-observability

Getting Started

STEP 1: Set Your Environment Variables

  • Get your License key (also referenced as ingest - license) and set it as environment variable: NEW_RELIC_LICENSE_KEY. Click here for more details and instructions.

Bash

export NEW_RELIC_LICENSE_KEY=<license key>

Python

import os
os.environ["NEW_RELIC_LICENSE_KEY"] = "<license key>"

NEW_RELIC_LICENSE_KEY can also be sent as a parameter at the monitor.initialization() call.

  • Are you reporting data to the New Relic EU region? click here for more instructions.

STEP 2: Add the following two lines to your code

from nr_openai_observability import monitor
monitor.initialization(
    application_name="OpenAI observability example"
)

Code example:

import os

import openai
from nr_openai_observability import monitor

monitor.initialization(
    application_name="OpenAI observability example"
)

openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[
        {
            "role": "user",
            "content": "Write a rhythm about observability",
        },
    ],
)
print(response["choices"][0]["message"]["content"])

STEP 3: Follow the instruction here to add the dashboard to your New Relic account.

EU Account Users:

If you are using an EU region account, you should also set your EVENT_CLIENT_HOST:

Bash

export EVENT_CLIENT_HOST="insights-collector.eu01.nr-data.net"

Python

import os
os.environ["EVENT_CLIENT_HOST"] = "insights-collector.eu01.nr-data.net"

EVENT_CLIENT_HOST can also be sent as a parameter at the monitor.initialization() call.

Support

New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub. You can find this project's topic/threads here:

Contribute

We encourage your contributions to improve nr-openai-observability! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today.

License

nr-openai-observability is licensed under the Apache 2.0 License. The nr-openai-observability also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.

Metadata

Release files for nr-openai-observability 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nr-openai-observability 0.3.1
File Size Uploaded
nr_openai_observability-0.3.1.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nr-openai-observability 0.3.1
File Interpreter ABI Platform
nr_openai_observability-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / nr_openai_observability-0.3.1.tar.gz

Download URL nr_openai_observability-0.3.1.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b43da08f2e1ac9fa5541a49b6850168bcecfc035d3860ac718b0a30f288b89eb
BLAKE2b-256 checksum
How to use checksums
e3ca3cbdb21801c16e81b0d94081e3857d4dfcb2e9562b2c23aaf7b22cb3deb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.12 Linux/5.15.0-1041-azure

Release files / nr_openai_observability-0.3.1-py3-none-any.whl

Download URL nr_openai_observability-0.3.1-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1fb7f29c531036da2714f94baf46f5286a74c4ace86426d43e4bd9838414c24
BLAKE2b-256 checksum
How to use checksums
e41a6bef2668f6fdd2b8a6305eea0f3537cc4700242c49a94df43140a02d8956
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.12 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page