Merged
Conversation
Contributor
Reviewer's GuideUpdates documentation examples to use the new hook wrapper Sequence diagram for wrapper-based precompletion hook handlingsequenceDiagram
actor Developer
participant App as Application
participant ChatObject
participant HookSystem
participant PreCompletionEvent
participant Handler as handle_pre_completion
Developer->>App: Define handler
Note over Developer,App: @on_precompletion().handle()
App->>HookSystem: Register Handler for PreCompletionEvent
App->>ChatObject: Create and run chat_obj
ChatObject->>HookSystem: Trigger PreCompletionEvent
HookSystem->>PreCompletionEvent: Create event instance
HookSystem->>Handler: Call handle_pre_completion(event)
Handler-->>PreCompletionEvent: Mutate messages / context
PreCompletionEvent-->>ChatObject: Updated event data
ChatObject-->>App: Continue LLM request with modified messages
Class diagram for hook wrapper .handle() decorator usageclassDiagram
class OnPrecompletionWrapper {
+handle() HandlerDecorator
}
class OnCompletionWrapper {
+handle() HandlerDecorator
}
class OnPresetFallbackWrapper {
+handle() HandlerDecorator
}
class HandlerDecorator {
+__call__(func) async_handler
}
class PreCompletionEvent {
}
class CompletionEvent {
}
class FallbackContext {
}
class AsyncHandler {
+event_param
+__call__(event)
}
OnPrecompletionWrapper --> HandlerDecorator : returns
OnCompletionWrapper --> HandlerDecorator : returns
OnPresetFallbackWrapper --> HandlerDecorator : returns
HandlerDecorator --> AsyncHandler : wraps
AsyncHandler --> PreCompletionEvent : uses
AsyncHandler --> CompletionEvent : uses
AsyncHandler --> FallbackContext : uses
%% Example bindings illustrated
class on_precompletion {
+__call__() OnPrecompletionWrapper
}
class on_completion {
+__call__() OnCompletionWrapper
}
class on_preset_fallback {
+__call__() OnPresetFallbackWrapper
}
on_precompletion --> OnPrecompletionWrapper : returns
on_completion --> OnCompletionWrapper : returns
on_preset_fallback --> OnPresetFallbackWrapper : returns
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
getting-started/architecture.mdthe English link uses/guide/concepts/jinja2-templates.mdwhile the Chinese version uses/zh/guide/concepts/jinja2-templateswithout the.mdsuffix; consider aligning these to match your docs routing conventions so locale and extension handling are consistent. - Since all hook examples now use
@on_...().handle(), it may be helpful to add a brief note in the relevant hook or events guide explaining why.handle()is required and how it differs from using@on_...()directly to avoid confusion for readers familiar with the previous syntax.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `getting-started/architecture.md` the English link uses `/guide/concepts/jinja2-templates.md` while the Chinese version uses `/zh/guide/concepts/jinja2-templates` without the `.md` suffix; consider aligning these to match your docs routing conventions so locale and extension handling are consistent.
- Since all hook examples now use `@on_...().handle()`, it may be helpful to add a brief note in the relevant hook or events guide explaining why `.handle()` is required and how it differs from using `@on_...()` directly to avoid confusion for readers familiar with the previous syntax.
## Individual Comments
### Comment 1
<location path="docs/zh/guide/getting-started/architecture.md" line_range="186" />
<code_context>
5. **厂商无关性**: 适配器层确保相同的agent逻辑可以与不同的LLM提供商配合工作而无需代码更改。
-6. **模板支持**: [Jinja2模板](../../concepts/jinja2-templates.md)基于上下文、记忆和配置启用动态提示构建。
+6. **模板支持**: [Jinja2模板](/zh/guide/concepts/jinja2-templates)基于上下文、记忆和配置启用动态提示构建。
</code_context>
<issue_to_address>
**issue (bug_risk):** The Jinja2 templates link in the Chinese doc likely needs a `.md` suffix for consistency and to avoid a broken link.
The previous relative link used `jinja2-templates.md`, and the English doc now points to `/guide/concepts/jinja2-templates.md`. For consistency and to avoid a 404, update this to `/zh/guide/concepts/jinja2-templates.md`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Deploying amritacore with
|
| Latest commit: |
d08ce21
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5be0edfb.amritacore.pages.dev |
| Branch Preview URL: | https://docs-wrapper.amritacore.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Update documentation examples to reflect the correct hook wrapper usage and fix Jinja2 template links in both English and Chinese guides.
Documentation:
.handle()wrapper pattern across event, security, API reference, extensions, and function implementation guides in English and Chinese.