Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aim): added jupyter notebook install branch, updated screenshot,…
… updated intro per PM review, fixed ruby config doc
- Loading branch information
Showing
10 changed files
with
97 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
src/install/ai-monitoring/agent-lang/python-jupyter-config.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
componentType: default | ||
headingText: Update your code for the Python agent | ||
freshnessValidatedDate: never | ||
--- | ||
|
||
1. You want to update your code so that the agent initializes when you spin up your script or notebook. Keep in mind that you need to define your app name for the agent to initialize: | ||
|
||
```py | ||
newrelic.agent.initialize("newrelic.ini") | ||
newrelic.agent.register_application(timeout=10) | ||
``` | ||
|
||
2. Add LLM calls with New Relic annotations to a method in your code: | ||
|
||
```py | ||
bedrock_runtime = boto3.client("bedrock-runtime", "us-east-1") | ||
|
||
runTitan(bedrock_runtime) | ||
runAnthropic(bedrock_runtime) | ||
runAi21(bedrock_runtime) | ||
runCohere(bedrock_runtime) | ||
runMeta(bedrock_runtime) | ||
runTitanEmbedding(bedrock_runtime) | ||
runCohereEmbedding(bedrock_runtime) | ||
``` | ||
|
||
3. Add this code snippet to ensure that when you shut down your script or notebook, the agent forwards data from the last 60 seconds to New Relic: | ||
|
||
```py | ||
newrelic.agent.shutdown_agent(60) | ||
``` |
29 changes: 29 additions & 0 deletions
29
src/install/ai-monitoring/agent-lang/python-jupyter-install.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
componentType: default | ||
optionType: agent-lang | ||
headingText: Register the Python agent in your code | ||
--- | ||
|
||
1. In your Jupyter notebook or Python script, install the Python agent: | ||
|
||
```python | ||
pip install git+https://github.com/newrelic/newrelic-python-agent | ||
``` | ||
|
||
This version of the Python agent already enables `nr-openai-observability` library. | ||
|
||
2. If you haven't updated your `newrelic.ini` file manually, then add these environment variables to your notebook: | ||
|
||
```python | ||
import os | ||
|
||
os.environ["NEW_RELIC_APP_NAME"] = "openai-example" | ||
os.environ["NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_ATTRIBUTE_VALUE"] = "100000" | ||
os.environ["NEW_RELIC_APPLICATION_LOGGING_ENABLED"] = "true" | ||
os.environ["NEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED"] = "true" | ||
os.environ["NEW_RELIC_DISTRIBUTED_TRACING_ENABLED"] = "true" | ||
``` | ||
|
||
You can refer to the [Python configuration doc](/docs/apm/agents/python-agent/configuration/python-agent-configuration/#ai-monitoring) to learn more about AI monitoring configurations. | ||
* Refer to the [event harvest section](/docs/apm/agents/python-agent/configuration/python-agent-configuration/#harvest-limits-span-event-data) for `event_harvest_config.harvest_limits.span_event_data` | ||
* Refer to the [custom events section](/docs/apm/agents/python-agent/configuration/python-agent-configuration/#harvest-limits-custom-event-data) for `event_harvest_config.harvest_limits.custom_event_data` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters