callbacks: introduce new callback handler pattern for wrapping Chain and LLM calls in spans, add OpenTelemetryCallbacksHandler
Addresses issue #652
PR Checklist
- ✅ Read the Contributing documentation.
- ✅ Read the Code of conduct documentation.
- ✅ Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as
memory: add interfaces for X, Yorutil: add whizzbang helpers). - ✅ Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- ✅ Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves.
- ✅ Describes the source of new concepts.
- ✅ References existing implementations as appropriate.
- ✅ Contains test coverage for new functions.
- ✅ Passes all
golangci-lintchecks.
Ready for review. @tmc, @recht
Hi @codefromthecrypt,
Thank you for taking the time to review!
I've added some docs that talk about the example at docs/docs/modules/callbacks/opentelemetry/index.mdx (https://github.com/tmc/langchaingo/blob/1b9a058eb393df90fe5f2d6a08312bd1833e61e4/docs/docs/modules/callbacks/opentelemetry/index.mdx) - please let me know if I should move or reference this via a fresh README in the corresponding example directory.
Thanks for the pointer to instructions!
please let me know if I should move or reference this via a fresh README in the corresponding example directory.
I started clicking down examples and at least the first several all have a README where the example is defined. Maybe look at some of the others are handling this, if they refer index.mdx to the example README or if the content is duplicated?
There is a summary thing I notice which is that we are adding attributes who are not required with zero values. This also applies to setting Status to
unset. I think we should avoid doing that as it clutters
- [ ] Tracking this as a todo