Socket
Socket
Sign inDemoInstall

@newrelic/aws-sdk

Package Overview
Dependencies
0
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.2.0 to 7.3.0

16

CHANGELOG.md

@@ -0,1 +1,17 @@

### v7.3.0 (2024-03-12)
#### Features
* Added ability to disable capturing of content in LLM events `ai_monitoring.record_content.enabled` ([#268](https://github.com/newrelic/node-newrelic-aws-sdk/pull/268)) ([a36050e](https://github.com/newrelic/node-newrelic-aws-sdk/commit/a36050ed4b7aab0e15da664f33363b4ae4d21eef))
* Added llm.tokenCountCallback support to Bedrock ([#270](https://github.com/newrelic/node-newrelic-aws-sdk/pull/270)) ([d2af144](https://github.com/newrelic/node-newrelic-aws-sdk/commit/d2af144cf5dcfc031a863fe89a30b3465320758a))
#### Bug fixes
* Added override setting to middleware configuration ([#273](https://github.com/newrelic/node-newrelic-aws-sdk/pull/273)) ([1a291f0](https://github.com/newrelic/node-newrelic-aws-sdk/commit/1a291f0fda0b7793fa24a667f32fe287f45b0921))
#### Miscellaneous chores
* Changed token_count to only use tokenCountCallback ([#272](https://github.com/newrelic/node-newrelic-aws-sdk/pull/272)) ([a9dbf26](https://github.com/newrelic/node-newrelic-aws-sdk/commit/a9dbf267c74f3a9ad089579fd5b89a8c366f8dec))
* Updated Bedrock entities with token_count ([#269](https://github.com/newrelic/node-newrelic-aws-sdk/pull/269)) ([f6a86cb](https://github.com/newrelic/node-newrelic-aws-sdk/commit/f6a86cb2143f018f3579262a5c014b587f884a2d))
### v7.2.0 (2024-02-29)

@@ -2,0 +18,0 @@

16

lib/llm/bedrock-response.js

@@ -129,6 +129,6 @@ /*

*
* @returns {number}
* @returns {number|undefined}
*/
get inputTokenCount() {
return parseInt(this.headers?.['x-amzn-bedrock-input-token-count'] || 0, 10)
return this.#tokenCount('x-amzn-bedrock-input-token-count')
}

@@ -139,6 +139,6 @@

*
* @returns {number}
* @returns {number|undefined}
*/
get outputTokenCount() {
return parseInt(this.headers?.['x-amzn-bedrock-output-token-count'] || 0, 10)
return this.#tokenCount('x-amzn-bedrock-output-token-count')
}

@@ -163,4 +163,12 @@

}
#tokenCount(headerName) {
const headerVal = this.headers?.[headerName]
if (headerVal != null) {
return parseInt(headerVal, 10)
}
return undefined
}
}
module.exports = BedrockResponse

@@ -42,3 +42,5 @@ /*

const { content, isResponse, index, completionId } = params
const { agent, content, isResponse, index, completionId } = params
const recordContent = agent.config?.ai_monitoring?.record_content?.enabled
const tokenCB = agent?.llm?.tokenCountCallback

@@ -48,3 +50,3 @@ this.is_response = isResponse

this.sequence = index
this.content = content
this.content = recordContent === true ? content : undefined
this.role = ''

@@ -55,5 +57,11 @@

this.role = 'assistant'
if (typeof tokenCB === 'function') {
this.token_count = tokenCB(this.bedrockCommand.modelId, content)
}
} else {
this.role = 'user'
this.content = this.bedrockCommand.prompt
this.content = recordContent === true ? this.bedrockCommand.prompt : undefined
if (typeof tokenCB === 'function') {
this.token_count = tokenCB(this.bedrockCommand.modelId, this.bedrockCommand.prompt)
}
}

@@ -60,0 +68,0 @@ }

@@ -22,4 +22,7 @@ /*

super(params)
const { agent } = params
this.input = this.bedrockCommand.prompt
this.input = agent.config?.ai_monitoring?.record_content?.enabled
? this.bedrockCommand.prompt
: undefined
this.error = params.isError

@@ -29,2 +32,3 @@ this.duration = params.segment.getDurationInMillis()

this['response.usage.prompt_tokens'] = this.bedrockResponse.inputTokenCount
this.token_count = this.bedrockResponse.inputTokenCount
}

@@ -31,0 +35,0 @@ }

@@ -160,2 +160,3 @@ /*

* @param {Error|null} params.err error from request if exists
*
* @returns {BedrockResponse} parsed response from bedrock

@@ -292,4 +293,5 @@ */

name: 'NewRelicBedrockMiddleware',
step: 'deserialize'
step: 'deserialize',
override: true
}
}

@@ -85,3 +85,4 @@ /*

step: 'finalizeRequest',
priority: 'low'
priority: 'low',
override: true
}

@@ -94,5 +95,6 @@ },

name: 'NewRelicDeserialize',
step: 'deserialize'
step: 'deserialize',
override: true
}
}
]

@@ -82,3 +82,4 @@ /*

step: 'initialize',
priority: 'high'
priority: 'high',
override: true
}

@@ -85,0 +86,0 @@ }

@@ -65,4 +65,5 @@ /*

step: 'initialize',
priority: 'high'
priority: 'high',
override: true
}
}

@@ -63,4 +63,5 @@ /*

step: 'initialize',
priority: 'high'
priority: 'high',
override: true
}
}
{
"name": "@newrelic/aws-sdk",
"version": "7.2.0",
"version": "7.3.0",
"description": "New Relic instrumentation of the aws-sdk package.",

@@ -31,3 +31,3 @@ "scripts": {

"@newrelic/newrelic-oss-cli": "^0.1.2",
"@newrelic/test-utilities": "^8.2.0",
"@newrelic/test-utilities": "^8.3.0",
"aws-sdk": "^2.1372.0",

@@ -34,0 +34,0 @@ "c8": "^7.12.0",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc