mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
Templates: Revert to load metadata on runtime
Metadata is generated via a template's module. This requires a single iteration through the template. If a template tries to access a passed variable that doesn't exist, it will error. Therefore, generate the metadata at runtime to prevent these errors from happening. To optimize further, cache the metadata after the first generation to prevent the expensive call of making a template module. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -181,7 +181,9 @@ def _create_stream_chunk(
|
||||
def _append_template_metadata(data: ChatCompletionRequest):
|
||||
"""Adding metadata is a one-time process."""
|
||||
|
||||
template_metadata = model.container.prompt_template.metadata
|
||||
template_metadata = model.container.prompt_template.extract_metadata(
|
||||
data.template_vars
|
||||
)
|
||||
|
||||
# Stop strings
|
||||
if isinstance(data.stop, str):
|
||||
|
||||
Reference in New Issue
Block a user