wip go engine

Co-authored-by: Patrick Devine <pdevine@sonic.net>
This commit is contained in:
Jeffrey Morgan
2023-07-03 15:22:44 -04:00
parent 172274b809
commit 76cb60d496
39 changed files with 1377 additions and 1 deletions

12
python/ollama/prompt.py Normal file
View File

@@ -0,0 +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(
path.basename(name), environment.list_templates(), n=1, cutoff=0
)
template = environment.get_template(best_templates.pop())
return template.render(prompt=prompt)