With the GPT series application integration, users have the ability to seamlessly monitor OpenAI completion queries and simultaneously log useful statistics in a New Relic customizable dashboard.
By adding just two lines of code, users can gain access to key performance metrics such as cost, response time, and sample inputs/outputs. The dashboard also allows users to track total requests, average token/requests, and model names.
With the fully customizable dashboard of New Relic, users can add additional metrics based on their specific business requirements and needs.
Overall, New Relic's GPT integration provides real-time metrics to help businesses optimize usage, reduce costs, and achieve better results.
Installation is straightforward and similar to any Python library.
pip install nr-openai-observability
This guide takes you step by step for everything needed to integrate OpenAI GPT applications and start monitoring your usage.
Step 1. Set your environment variable
<InlinePopover type="licenseKey" /> (also referenced as
ingest - license) and set it as environment variable:
NEW_RELIC_LICENSE_KEY. Click here for more details and instructions.
import osos.environ["NEW_RELIC_LICENSE_KEY"] = "<license key>"
NEW_RELIC_LICENSE_KEY can also be sent as a parameter at the
Step 2. Modify your code
Add the following two lines to your code:
from nr_openai_observability import monitormonitor.initialization()
Step 3. Add your dashboard
Follow the instruction to add the dashboard to your New Relic account:
import osimport openaifrom nr_openai_observability import monitormonitor.initialization()openai.api_key = os.getenv("OPENAI_API_KEY")openai.Completion.create(model="text-davinci-003",prompt="What is Observability?",max_tokens=20,temperature=0)
EU account users
Are you reporting data to the New Relic EU region? Click here for more instructions. If you're using an EU account, you should also set your
import osos.environ["EVENT_CLIENT_HOST"] = "insights-collector.eu01.nr-data.net"
EVENT_CLIENT_HOST can also be sent as a parameter at the
Here's a demonstration of setting up this integration: