-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18924 from umaannamalai/python-agent-10.1.0-release
Python agent 10.1.0 release
- Loading branch information
Showing
3 changed files
with
134 additions
and
1 deletion.
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
91 changes: 91 additions & 0 deletions
91
...ents/python-agent/python-agent-api/withllmcustomattributes-python-agent-api.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,91 @@ | ||
--- | ||
title: WithLlmCustomAttributes (Python agent API) | ||
type: apiDoc | ||
shortDescription: Add custom attributes to LLM events | ||
tags: | ||
- Agents | ||
- Python agent | ||
- Python agent API | ||
metaDescription: 'Python API: This API adds custom attributes to a Large Language Model (LLM) events generated in AI applications.' | ||
redirects: | ||
- /docs/agents/python-agent/python-agent-api/withllmcustomattributes-python-agent-api | ||
- /docs/agents/python-agent/python-agent-api/withllmcustomattributes | ||
freshnessValidatedDate: never | ||
--- | ||
|
||
## Syntax [#syntax] | ||
|
||
```py | ||
with newrelic.agent.WithLlmCustomAttributes(custom_attribute_map): | ||
``` | ||
|
||
Context manager API that adds user-specified attributes to Large Language Model (LLM) events generated by LLM calls in application code. | ||
|
||
## Requirements [#requirements] | ||
|
||
Python agent version 10.1.0 or higher. | ||
|
||
## Description [#description] | ||
|
||
This context manager API adds custom user-specified attributes to each LLM event generated within its context based on calls made to LLMs. | ||
The agent will automatically add an `llm.` prefix to each custom attribute key name specified in the passed in dictionary argument. | ||
This API must be called within the context of an active transaction. | ||
|
||
These custom attributes can be viewed on LLM events and queried for in the New Relic UI. For more information on AI Monitoring, see our [AI docs](https://docs.newrelic.com/docs/ai-monitoring/intro-to-ai-monitoring/). | ||
|
||
|
||
## Parameters [#parameters] | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th width="25%"> | ||
Parameter | ||
</th> | ||
|
||
<th> | ||
Description | ||
</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<tr> | ||
<td> | ||
`custom_attribute_map` | ||
|
||
_dictionary_ | ||
</td> | ||
|
||
<td> | ||
Required. A non-empty dictionary where each key-value pair indicates the custom attribute name and its respective value. | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Return values [#return-values] | ||
|
||
None. | ||
|
||
## Examples [#examples] | ||
|
||
### Add custom attributes to an OpenAI chat completion call | ||
|
||
|
||
````py | ||
import newrelic.agent | ||
|
||
from openai import OpenAI | ||
|
||
client = OpenAI() | ||
|
||
with newrelic.agent.WithLlmCustomAttributes({"custom": "attr", "custom1": "attr1"}): | ||
response = client.chat.completions.create( | ||
messages=[{ | ||
"role": "user", | ||
"content": "Say this is a test", | ||
}], | ||
model="gpt-4o-mini", | ||
) | ||
```` |
42 changes: 42 additions & 0 deletions
42
.../release-notes/agent-release-notes/python-release-notes/python-agent-100100.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,42 @@ | ||
--- | ||
subject: 'Python agent' | ||
releaseDate: '2024-10-10' | ||
version: 10.1.0 | ||
downloadLink: 'https://pypi.python.org/pypi/newrelic' | ||
features: ['Add support for Python 3.13', 'Add new LLM custom attribute context manager API', 'Add support for reporting of Amazon ECS Fargate Docker IDs', 'Add instrumentation for `SQLiteVec` vectorstore in Langchain'] | ||
bugs: [] | ||
security: [] | ||
--- | ||
|
||
## Notes | ||
|
||
This release of the Python agent adds support for Python 3.13, adds a new Large Language Model (LLM) API, supports Docker ID parsing in Amazon ECS Fargate environments, and instruments a new Langchain vectorstore. | ||
|
||
|
||
Install the agent using `easy_install/pip/distribute` via the [Python Package Index](https://pypi.python.org/pypi/newrelic) or download it directly from the [New Relic download site](https://download.newrelic.com/python_agent/release). | ||
|
||
|
||
## New features | ||
|
||
* Add support for Python 3.13 | ||
|
||
* The agent now supports applications running in Python 3.13. | ||
|
||
* Add new LLM custom attribute context manager API | ||
|
||
* The agent now includes a new context manager API that adds custom attributes to LLM events generated from calls to LLMs in application code. For more information on usage, please see our [API documentation](/docs/apm/agents/python-agent/python-agent-api/withllmcustomattributes-python-agent-api). | ||
|
||
* Add support for reporting of [Amazon ECS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html) Docker IDs | ||
|
||
* The agent now reports Docker IDs for containers running in ECS Fargate environments. | ||
|
||
* Add instrumentation for `SQLiteVec` vectorstore in Langchain | ||
|
||
* The agent now instruments `similarity_search` for the `SQLiteVec` vectorstore. | ||
|
||
|
||
## Support statement | ||
|
||
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read [more](/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/) about keeping agents up to date. | ||
|
||
See the New Relic Python agent [EOL policy](/docs/apm/agents/python-agent/getting-started/python-agent-eol-policy/) for information about agent releases and support dates. |