(self, **kwargs)
| 4100 | ) |
| 4101 | |
| 4102 | def __call__(self, **kwargs): |
| 4103 | llama = kwargs["llama"] |
| 4104 | |
| 4105 | # Clear state for multiple runs |
| 4106 | llama.reset() |
| 4107 | llama._ctx.kv_cache_clear() |
| 4108 | llama.n_tokens = 0 |
| 4109 | |
| 4110 | if hasattr(llama, "input_ids"): |
| 4111 | llama.input_ids.fill(0) |
| 4112 | |
| 4113 | # Clear any handler state |
| 4114 | if hasattr(self, "_last_image_embed"): |
| 4115 | self._last_image_embed = None |
| 4116 | self._last_image_hash = None |
| 4117 | |
| 4118 | if self.verbose: |
| 4119 | messages = kwargs.get("messages", []) |
| 4120 | image_count = len(self.get_image_urls(messages)) |
| 4121 | print( |
| 4122 | f"Minimal - Cleared state, processing {image_count} images", |
| 4123 | file=sys.stderr, |
| 4124 | ) |
| 4125 | |
| 4126 | # Use parent implementation |
| 4127 | return super().__call__(**kwargs) |
| 4128 | |
| 4129 | |
| 4130 | @register_chat_completion_handler("chatml-function-calling") |
nothing calls this directly
no test coverage detected