forked from newrelic/node-newrelic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add LLama2 support to LLM events and mock server (newrelic#238)
- Loading branch information
1 parent
42d04ff
commit 31dad9c
Showing
10 changed files
with
201 additions
and
6 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
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
70 changes: 70 additions & 0 deletions
70
tests/versioned/aws-server-stubs/ai-server/responses/llama2.js
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,70 @@ | ||
/* | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const responses = new Map() | ||
|
||
responses.set('text llama2 ultimate question', { | ||
headers: { | ||
'content-type': 'application/json', | ||
'x-amzn-requestid': 'eda0760a-c3f0-4fc1-9a1e-75559d642866', | ||
'x-amzn-bedrock-invocation-latency': 9677, | ||
'x-amzn-bedrock-output-token-count': 4, | ||
'x-amzn-bedrock-input-token-count': 8 | ||
}, | ||
statusCode: 200, | ||
body: { | ||
generation: '42', | ||
prompt_token_count: 14, | ||
generation_token_count: 205, | ||
stop_reason: 'endoftext' | ||
} | ||
}) | ||
|
||
responses.set('text llama2 ultimate question streamed', { | ||
headers: { | ||
'content-type': 'application/vnd.amazon.eventstream', | ||
'x-amzn-requestid': 'eda0760a-c3f0-4fc1-9a1e-75559d642866', | ||
'x-amzn-bedrock-content-type': 'application/json' | ||
}, | ||
statusCode: 200, | ||
chunks: [ | ||
{ | ||
headers: { | ||
':event-type': { type: 'string', value: 'chunk' }, | ||
':content-type': { type: 'string', value: 'application/json' }, | ||
':message-type': { type: 'string', value: 'event' } | ||
}, | ||
body: { | ||
generation: '42', | ||
prompt_token_count: null, | ||
generation_token_count: 211, | ||
stop_reason: null | ||
} | ||
}, | ||
{ | ||
headers: { | ||
':event-type': { type: 'string', value: 'chunk' }, | ||
':content-type': { type: 'string', value: 'application/json' }, | ||
':message-type': { type: 'string', value: 'event' } | ||
}, | ||
body: { | ||
'generation': '', | ||
'prompt_token_count': null, | ||
'generation_token_count': 212, | ||
'stop_reason': 'endoftext', | ||
'amazon-bedrock-invocationMetrics': { | ||
inputTokenCount: 14, | ||
outputTokenCount: 212, | ||
invocationLatency: 9825, | ||
firstByteLatency: 283 | ||
} | ||
} | ||
} | ||
] | ||
}) | ||
|
||
module.exports = responses |
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