RestatePlugin: after_model_callback never invoked - before_model_callback returns LlmResponse causing ADK to skip post-model hooks
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu bằng cách lần theo RestatePlugin.before_model_callback và cách Google ADK xử lý các giá trị trả về của before_model_callback. So sánh luồng này với after_model_callback và workaround bằng subclass đã được báo cáo. Được xem là hoàn tất khi post-model hook có thể nhận phản hồi của model và metadata sử dụng khi có các plugin bổ sung được đăng ký, mà không phá vỡ ngữ nghĩa replay của Restate.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
When registering additional plugins, alongside Restate (in our case it was for ADK-level observability), after_model_callback is never invoked. This makes it impossible to access the model response and usage metadata in post-call hook, which is the natural place to capture $ai_generation events.
Environment
restate-sdk(version 0.16.0)google-adk(1.28.1)RestatePlugin
Root Cause
The ADK framework uses the return value of before_model_callback as a signal:
None-> proceed with the real model call, then invokeafter_model_callbackLlmResponse-> short-circuit: skip the model call and skipafter_model_callback
RestatePlugin.before_model_callback wraps the LLM call inside a Restate durable step, which means it executes the model call itself and returns a LlmResponse. This is correct for Restate's replay semantics, but it has a side effect: after_model_callback is never reached, regardless of what subclasses implement there.
Workaround
Our current workaround is to subclass (decorate) the RestatePlugin itself, so we can simulate the after_model_callback trigger inside the wrapped before_model_callback call, but we believe this is worth tracking and resolving.
- Ngôn ngữ chính
- Python
- Star
- 82
- Fork
- 24
- Merge trung bình
- 13 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của restatedev/sdk-python
-
pydantic ext: request_stream() never initializes the turnstile — KeyError('call_...') on first tool call of a streamed runCó thể đã có người làm @QuocThuanTruong đã nhận 70 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
restatedev/sdk-python#223 · 1 bình luận ·
-
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 68/100
restatedev/sdk-python#204 · 1 bình luận ·
-
RestateModelWrapper should not wrap `SdkInternalBaseException` as generic Exception; classify non-retryable provider errors as terminalCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
restatedev/sdk-python#225 ·
-
pydantic ext: auto_wrap_tools + async event_stream_handler crashes with 'Object of type coroutine is not JSON serializable' on first tool callCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
restatedev/sdk-python#222 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
restatedev/sdk-python#221 ·
Tất cả issue của restatedev/sdk-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Qiskit/qiskit-ibm-runtime#3431 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskĐang mởlesson-submission needs-ac pending-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Ikalus1988/MisakaNet#2870 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature:LinkChecker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
digitalfabrik/integreat-cms#4594 ·
Maintainer thường phản hồi trong vòng 5 ngày