Skip to content

refactor: Google Gen AI LLM event refactor#3748

Merged
amychisholm03 merged 2 commits intonewrelic:mainfrom
amychisholm03:google-genai-llm-refactor
Feb 17, 2026
Merged

refactor: Google Gen AI LLM event refactor#3748
amychisholm03 merged 2 commits intonewrelic:mainfrom
amychisholm03:google-genai-llm-refactor

Conversation

@amychisholm03
Copy link
Contributor

@amychisholm03 amychisholm03 commented Feb 12, 2026

Description

Refactors Google Gen AI LLM events to use the new base LlmEmbedding, LlmChatCompletionMessage, and LlmChatCompletionSummary classes.

How to Test

npm run unit
npm run versioned google-genai

Related Issues

Part of #3687

@amychisholm03 amychisholm03 force-pushed the google-genai-llm-refactor branch from fb55422 to 1f389c5 Compare February 12, 2026 19:49
@amychisholm03 amychisholm03 changed the title refactor: Google Gen AI LLM refactor refactor: Google Gen AI LLM event refactor Feb 12, 2026
@amychisholm03 amychisholm03 marked this pull request as ready for review February 12, 2026 19:51
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.42%. Comparing base (b2612ec) to head (82788cf).
⚠️ Report is 7 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (b2612ec) and HEAD (82788cf). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (b2612ec) HEAD (82788cf)
integration-tests-cjs-24.x 1 0
integration-tests-cjs-22.x 1 0
integration-tests-esm-24.x 1 0
integration-tests-esm-22.x 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3748      +/-   ##
==========================================
- Coverage   90.11%   81.42%   -8.70%     
==========================================
  Files         450      440      -10     
  Lines       58464    57233    -1231     
  Branches        1        1              
==========================================
- Hits        52687    46603    -6084     
- Misses       5777    10630    +4853     
Flag Coverage Δ
integration-tests-cjs-22.x ?
integration-tests-cjs-24.x ?
integration-tests-esm-22.x ?
integration-tests-esm-24.x ?
versioned-tests-20.x 81.42% <100.00%> (-0.27%) ⬇️
versioned-tests-22.x 81.42% <100.00%> (-0.27%) ⬇️
versioned-tests-24.x 81.33% <100.00%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jsumners-nr jsumners-nr self-requested a review February 13, 2026 14:50
Comment on lines 17 to 20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to assert that response is defined when the function requires it as a parameter. I'd also avoid the cost of "is metadata defined" by:

const { usageMetadata } = response
if (Object.prototype.toString.call(usageMetadata) !== '[object Object]') {
  return { promptTokens: 0, completionTokens: 0, totalTokens: 0 }
}

request,
response,
withError: !!err
error: !!err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: err === true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err is an object, updated doc block to reflect

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature and docblock indicates that response will always be defined. Is that correct?

request,
response,
withError: !!err
error: !!err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: err === true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err is an object, updated doc block to reflect

@amychisholm03 amychisholm03 merged commit f1e3a0e into newrelic:main Feb 17, 2026
24 of 25 checks passed
@github-project-automation github-project-automation bot moved this from Needs PR Review to Done: Issues recently completed in Node.js Engineering Board Feb 17, 2026
@amychisholm03 amychisholm03 deleted the google-genai-llm-refactor branch February 17, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done: Issues recently completed

Development

Successfully merging this pull request may close these issues.

2 participants

Comments