getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
933 stars 494 forks source link

Support LLM monitoring in Ruby SDK. #2405

Open khaile opened 1 month ago

khaile commented 1 month ago

Describe the idea Support LLM monitoring in Ruby SDK.

Why do you think it's beneficial to most of the users

Implementing LLM monitoring in the Ruby SDK allows developers to gain deeper insights into the performance and behavior of large language models in their applications. Users can track the health of their models, detect anomalies, and ensure optimal functioning, which can lead to enhanced user experiences and increased trust in AI-driven features. By providing detailed monitoring, users can make informed decisions on how to iterate on their models, improving accuracy and responsiveness while minimizing downtime.

Possible implementation

To implement LLM monitoring in the Ruby SDK, we can follow a structured approach:

Integrate Monitoring Hooks: Introduce SDK hooks that enable developers to easily add monitoring functionalities at critical points in the model's lifecycle, including initialization, inference, and error handling.

Capture Metrics: Create predefined metrics for automatic capture, such as response times, error rates, input/output token counts, and model latency. Additionally, allow users to define custom metrics relevant to their use cases.

Anomaly Detection: Implement real-time algorithms to analyze captured metrics for anomalies, such as unexpected spikes in error rates or response times. Notify developers when anomalies are detected.

Dashboard and Visualization: Develop a user-friendly dashboard that visually displays collected metrics and anomalies, providing insights into model performance over time to help developers identify trends and improvement areas.

Documentation and Examples: Offer comprehensive documentation and practical examples for enabling and using LLM monitoring within the SDK, including step-by-step guides, code snippets, and best practices for seamless integration.

Community Feedback Loop: Create a feedback mechanism for users to share their experiences and suggest improvements, such as a dedicated forum or feedback section in the documentation, allowing the SDK to evolve based on real-world usage.

sl0thentr0py commented 1 month ago

Thanks for the request @khaile! We typically add new feature support based on existing popular gems in the ecosystem. Do you have any particular LLM gems/libraries you would like to see support for?

khaile commented 1 month ago

Do you have any particular LLM gems/libraries you would like to see support for?

Hi @sl0thentr0py , I would love to see if we can support for langchainrb!