nr-openai-observability


Namenr-openai-observability JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://newrelic.com/instant-observability/openai
SummaryA lightweight tool to monitor your OpenAI workload.
upload_time2023-09-10 07:15:00
maintainer
docs_urlNone
authorAIR
requires_python>=3.8.1,<4.0.0
license
keywords newrelic observability openai gpt chatgpt gpt-4 monitor generative ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#category-community-project)

# OpenAI Observability

A lightweight tool to monitor your OpenAI workload.

## Installation
**With `pip`**

```bash
pip install nr-openai-observability
```

## Getting Started

#### STEP 1: Set Your Environment Variables 
* [Get your License key](https://one.newrelic.com/launcher/api-keys-ui.api-keys-launcher) (also referenced as `ingest - license`) and set it as environment variable: `NEW_RELIC_LICENSE_KEY`.
[Click here](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#license-key) for more details and instructions.

**`Bash`**

```bash
export NEW_RELIC_LICENSE_KEY=<license key>
```

**`Python`**

```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](#eu-account-users) for more instructions.

#### STEP 2: Add the following two lines to your code

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

#### Code example:

```python

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](https://one.newrelic.com/launcher/catalog-pack-details.launcher/?pane=eyJuZXJkbGV0SWQiOiJjYXRhbG9nLXBhY2stZGV0YWlscy5jYXRhbG9nLXBhY2stY29udGVudHMiLCJxdWlja3N0YXJ0SWQiOiI1ZGIyNWRiZC1hNmU5LTQ2ZmMtYTcyOC00Njk3ZjY3N2ZiYzYifQ==) 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`**

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

**`Python`**

```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](../../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](https://hackerone.com/newrelic).

If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).

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](http://apache.org/licenses/LICENSE-2.0.txt) 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://newrelic.com/instant-observability/openai",
    "name": "nr-openai-observability",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "newrelic,observability,openai,gpt,chatGPT,GPT-4,monitor,generative,ai",
    "author": "AIR",
    "author_email": "air-opensource@newrelic.com",
    "download_url": "https://files.pythonhosted.org/packages/e3/ca/3cbdb21801c16e81b0d94081e3857d4dfcb2e9562b2c23aaf7b22cb3deb7/nr_openai_observability-0.3.1.tar.gz",
    "platform": null,
    "description": "\n[![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#category-community-project)\n\n# OpenAI Observability\n\nA lightweight tool to monitor your OpenAI workload.\n\n## Installation\n**With `pip`**\n\n```bash\npip install nr-openai-observability\n```\n\n## Getting Started\n\n#### STEP 1: Set Your Environment Variables \n* [Get your License key](https://one.newrelic.com/launcher/api-keys-ui.api-keys-launcher) (also referenced as `ingest - license`) and set it as environment variable: `NEW_RELIC_LICENSE_KEY`.\n[Click here](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#license-key) for more details and instructions.\n\n**`Bash`**\n\n```bash\nexport NEW_RELIC_LICENSE_KEY=<license key>\n```\n\n**`Python`**\n\n```python\nimport os\nos.environ[\"NEW_RELIC_LICENSE_KEY\"] = \"<license key>\"\n```\n`NEW_RELIC_LICENSE_KEY` can also be sent as a parameter at the `monitor.initialization()`\n call.\n\n* Are you reporting data to the New Relic EU region? click [here](#eu-account-users) for more instructions.\n\n#### STEP 2: Add the following two lines to your code\n\n```python\nfrom nr_openai_observability import monitor\nmonitor.initialization(\n    application_name=\"OpenAI observability example\"\n)\n```\n\n#### Code example:\n\n```python\n\nimport os\n\nimport openai\nfrom nr_openai_observability import monitor\n\nmonitor.initialization(\n    application_name=\"OpenAI observability example\"\n)\n\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nresponse = openai.ChatCompletion.create(\n    model=\"gpt-3.5-turbo\",\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"Write a rhythm about observability\",\n        },\n    ],\n)\nprint(response[\"choices\"][0][\"message\"][\"content\"])\n```\n\n#### STEP 3: Follow the instruction [here](https://one.newrelic.com/launcher/catalog-pack-details.launcher/?pane=eyJuZXJkbGV0SWQiOiJjYXRhbG9nLXBhY2stZGV0YWlscy5jYXRhbG9nLXBhY2stY29udGVudHMiLCJxdWlja3N0YXJ0SWQiOiI1ZGIyNWRiZC1hNmU5LTQ2ZmMtYTcyOC00Njk3ZjY3N2ZiYzYifQ==) to add the dashboard to your New Relic account.\n\n### EU Account Users:\n\nIf you are using an EU region account, you should also set your `EVENT_CLIENT_HOST`:\n\n**`Bash`**\n\n```bash\nexport EVENT_CLIENT_HOST=\"insights-collector.eu01.nr-data.net\"\n```\n\n**`Python`**\n\n```python\nimport os\nos.environ[\"EVENT_CLIENT_HOST\"] = \"insights-collector.eu01.nr-data.net\"\n```\n    \n`EVENT_CLIENT_HOST` can also be sent as a parameter at the `monitor.initialization()`\n call.\n\n## Support\n\nNew 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:\n\n## Contribute\n\nWe 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.\n\nIf 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.\n\n**A note about vulnerabilities**\n\nAs noted in our [security policy](../../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.\n\nIf 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](https://hackerone.com/newrelic).\n\nIf you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).\n\nTo all contributors, we thank you!  Without your contribution, this project would not be what it is today.\n\n## License\nnr-openai-observability is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.\nThe 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.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A lightweight tool to monitor your OpenAI workload.",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://newrelic.com/instant-observability/openai",
        "Repository": "https://github.com/newrelic/nr-openai-observability"
    },
    "split_keywords": [
        "newrelic",
        "observability",
        "openai",
        "gpt",
        "chatgpt",
        "gpt-4",
        "monitor",
        "generative",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e41a6bef2668f6fdd2b8a6305eea0f3537cc4700242c49a94df43140a02d8956",
                "md5": "97f022967fce8b75c4149e911f6f20ea",
                "sha256": "f1fb7f29c531036da2714f94baf46f5286a74c4ace86426d43e4bd9838414c24"
            },
            "downloads": -1,
            "filename": "nr_openai_observability-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97f022967fce8b75c4149e911f6f20ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 15072,
            "upload_time": "2023-09-10T07:14:58",
            "upload_time_iso_8601": "2023-09-10T07:14:58.630167Z",
            "url": "https://files.pythonhosted.org/packages/e4/1a/6bef2668f6fdd2b8a6305eea0f3537cc4700242c49a94df43140a02d8956/nr_openai_observability-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3ca3cbdb21801c16e81b0d94081e3857d4dfcb2e9562b2c23aaf7b22cb3deb7",
                "md5": "99a6e31e51b36c5d77107e74f572fcb4",
                "sha256": "b43da08f2e1ac9fa5541a49b6850168bcecfc035d3860ac718b0a30f288b89eb"
            },
            "downloads": -1,
            "filename": "nr_openai_observability-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "99a6e31e51b36c5d77107e74f572fcb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 14777,
            "upload_time": "2023-09-10T07:15:00",
            "upload_time_iso_8601": "2023-09-10T07:15:00.179303Z",
            "url": "https://files.pythonhosted.org/packages/e3/ca/3cbdb21801c16e81b0d94081e3857d4dfcb2e9562b2c23aaf7b22cb3deb7/nr_openai_observability-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-10 07:15:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "newrelic",
    "github_project": "nr-openai-observability",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nr-openai-observability"
}
        
AIR
Elapsed time: 0.11070s