mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-12 16:57:04 +00:00
search command
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
from os import path
|
||||
from difflib import get_close_matches
|
||||
from jinja2 import Environment, PackageLoader
|
||||
|
||||
|
||||
def template(name, prompt):
|
||||
environment = Environment(loader=PackageLoader(__name__, 'templates'))
|
||||
best_templates = get_close_matches(name, environment.list_templates(), n=1, cutoff=0)
|
||||
best_templates = get_close_matches(
|
||||
path.basename(name), environment.list_templates(), n=1, cutoff=0
|
||||
)
|
||||
template = environment.get_template(best_templates.pop())
|
||||
return template.render(prompt=prompt)
|
||||
|
||||
Reference in New Issue
Block a user