@@ -167,112 +167,6 @@ it('tracks success', () => {
167167 ) ;
168168} ) ;
169169
170- it ( 'tracks Bedrock conversation with successful response' , ( ) => {
171- const tracker = new LDAIConfigTrackerImpl (
172- mockLdClient ,
173- testRunId ,
174- configKey ,
175- variationKey ,
176- version ,
177- modelName ,
178- providerName ,
179- testContext ,
180- ) ;
181-
182- const TOTAL_TOKENS = 100 ;
183- const PROMPT_TOKENS = 49 ;
184- const COMPLETION_TOKENS = 51 ;
185-
186- const response = {
187- $metadata : { httpStatusCode : 200 } ,
188- metrics : { latencyMs : 500 } ,
189- usage : {
190- inputTokens : PROMPT_TOKENS ,
191- outputTokens : COMPLETION_TOKENS ,
192- totalTokens : TOTAL_TOKENS ,
193- } ,
194- } ;
195-
196- tracker . trackBedrockConverseMetrics ( response ) ;
197-
198- expect ( mockTrack ) . toHaveBeenCalledWith (
199- '$ld:ai:generation:success' ,
200- testContext ,
201- getExpectedTrackData ( ) ,
202- 1 ,
203- ) ;
204-
205- expect ( mockTrack ) . not . toHaveBeenCalledWith (
206- '$ld:ai:generation:error' ,
207- expect . anything ( ) ,
208- expect . anything ( ) ,
209- expect . anything ( ) ,
210- ) ;
211-
212- expect ( mockTrack ) . toHaveBeenCalledWith (
213- '$ld:ai:duration:total' ,
214- testContext ,
215- getExpectedTrackData ( ) ,
216- 500 ,
217- ) ;
218-
219- expect ( mockTrack ) . toHaveBeenCalledWith (
220- '$ld:ai:tokens:total' ,
221- testContext ,
222- getExpectedTrackData ( ) ,
223- TOTAL_TOKENS ,
224- ) ;
225-
226- expect ( mockTrack ) . toHaveBeenCalledWith (
227- '$ld:ai:tokens:input' ,
228- testContext ,
229- getExpectedTrackData ( ) ,
230- PROMPT_TOKENS ,
231- ) ;
232-
233- expect ( mockTrack ) . toHaveBeenCalledWith (
234- '$ld:ai:tokens:output' ,
235- testContext ,
236- getExpectedTrackData ( ) ,
237- COMPLETION_TOKENS ,
238- ) ;
239- } ) ;
240-
241- it ( 'tracks Bedrock conversation with error response' , ( ) => {
242- const tracker = new LDAIConfigTrackerImpl (
243- mockLdClient ,
244- testRunId ,
245- configKey ,
246- variationKey ,
247- version ,
248- modelName ,
249- providerName ,
250- testContext ,
251- ) ;
252-
253- const response = {
254- $metadata : { httpStatusCode : 400 } ,
255- } ;
256-
257- tracker . trackBedrockConverseMetrics ( response ) ;
258-
259- expect ( mockTrack ) . toHaveBeenCalledTimes ( 1 ) ;
260-
261- expect ( mockTrack ) . toHaveBeenCalledWith (
262- '$ld:ai:generation:error' ,
263- testContext ,
264- getExpectedTrackData ( ) ,
265- 1 ,
266- ) ;
267-
268- expect ( mockTrack ) . not . toHaveBeenCalledWith (
269- expect . stringMatching ( / ^ \$ l d : a i : t o k e n s : / ) ,
270- expect . anything ( ) ,
271- expect . anything ( ) ,
272- expect . anything ( ) ,
273- ) ;
274- } ) ;
275-
276170it ( 'tracks tokens' , ( ) => {
277171 const tracker = new LDAIConfigTrackerImpl (
278172 mockLdClient ,
0 commit comments