From ebf96dc90b06208a81dcfb27517010eec8d147c4 Mon Sep 17 00:00:00 2001 From: monst Date: Thu, 12 Oct 2023 12:44:11 +0200 Subject: [PATCH] Update docs --- app/services/guidance_wrapper.py | 10 ++++++---- tests/routes/messages_test.py | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/services/guidance_wrapper.py b/app/services/guidance_wrapper.py index baf3a29d..834a8fd3 100644 --- a/app/services/guidance_wrapper.py +++ b/app/services/guidance_wrapper.py @@ -31,10 +31,12 @@ def query(self) -> dict: Reraises exception from guidance package """ - # Perform a regex search to find the names of the variables being generated - # by the handlebars template - # This regex matches strings like: {{gen 'response' temperature=0.0 max_tokens=500}} - # and extracts the variable name 'response' + # Perform a regex search to find the names of the variables + # being generated in the program. This regex matches strings like: + # {{gen 'response' temperature=0.0 max_tokens=500}} + # {{#geneach 'values' num_iterations=3}} + # {{set 'answer' (truncate response 3)}} + # and extracts the variable names 'response', 'values', and 'answer' pattern = r'{{#?(?:gen|geneach|set) +[\'"]([^\'"]+)[\'"]' var_names = re.findall(pattern, self.handlebars) diff --git a/tests/routes/messages_test.py b/tests/routes/messages_test.py index 725514cf..a9b77ce5 100644 --- a/tests/routes/messages_test.py +++ b/tests/routes/messages_test.py @@ -1,6 +1,5 @@ import pytest from freezegun import freeze_time -from app.models.dtos import Content, ContentType from app.services.guidance_wrapper import GuidanceWrapper import app.config as config