feat(browser): Expose AI instrumentation methods#17848
Conversation
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
size-limit report 📦
|
Lms24
left a comment
There was a problem hiding this comment.
Nice! I had a suggestion for the test setup but feel free to tackle it in a follow-up PR.
Also, let's make sure we document the integraitons, including the CDN addon bundles, in our integrations docs pages.
| const mockClient = new MockAnthropic({ | ||
| apiKey: 'mock-api-key', | ||
| }); |
There was a problem hiding this comment.
m: It isn't ideal for an integration test to mock the client we want to instrument. In our Node integration tests we usually test against the actual libraries (though not sure about AI packages to be fair).
I'm not sure if this works out of the box but we can try adding the packages as dependencies to the browser-integration-tests package.json and then just importing them in the subject files. We bundle each individual integration test suite via webpack so maybe webpack can actually resolve and bundle the dependencies out of the box. If this doesn't work, we should find a way to make this possible. I'm sure this is also a concern for logging libraries used in browser apps.
I'm fine though with merging the PR as-is and following up with replacing the mocks with the actual test apps. Whatever works for you better :)
There was a problem hiding this comment.
We mock the server apis for AI tests usually, yep can do in a follow up, will draft a ticket for this.
…-expose-ai-integrations-in-browser-sdk feat(browser): Expose AI instrumentation methods
We are exposing AI instrument methods for Anthropic, Google GenAI, and OpenAI, enabling users to use it directly from browser sdk.