Package: nr-openai-observability
OpenAI ObservabilityA lightweight tool to monitor your OpenAI workload.InstallationWithpippipinstallnr-openai-observabilityGetting StartedSTEP 1: Set Your Environment VariablesGet your License key(also referenced asingest - license) and set it as environment variable:NEW_RELIC_LICENSE_KEY.Click herefor more details and instructions.BashexportNEW_RELIC_LICENSE_KEY=<licensekey>Pythonimportosos.environ["NEW_RELIC_LICENSE_KEY"]="<license key>"NEW_RELIC_LICENSE_KEYcan also be sent as a parameter at themonitor.initialization()call.Are you reporting data to the New Relic EU region? clickherefor more instructions.STEP 2: Add the following two lines to your codefromnr_openai_observabilityimportmonitormonitor.initialization(application_name="OpenAI observability example")Code example:importosimportopenaifromnr_openai_observabilityimportmonitormonitor.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 instructionhereto add the dashboard to your New Relic account.EU Account Users:If you are using an EU region account, you should also set yourEVENT_CLIENT_HOST:BashexportEVENT_CLIENT_HOST="insights-collector.eu01.nr-data.net"Pythonimportosos.environ["EVENT_CLIENT_HOST"]="insights-collector.eu01.nr-data.net"EVENT_CLIENT_HOSTcan also be sent as a parameter at themonitor.initialization()call.SupportNew 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:ContributeWe 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 atopensource@newrelic.com.A note about vulnerabilitiesAs noted in oursecurity 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 throughHackerOne.If you would like to contribute to this project, reviewthese guidelines.To all contributors, we thank you!  Without your contribution, this project would not be what it is today.Licensenr-openai-observability is licensed under theApache 2.0License.
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.