-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
119 additions
and
33 deletions.
There are no files selected for viewing
Binary file modified
BIN
+13 Bytes
(100%)
services/llm-client/adapters/db/__pycache__/interactions.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+140 Bytes
(110%)
services/llm-client/diplomat/db/__pycache__/interactions.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+319 Bytes
(130%)
services/llm-client/flows/__pycache__/interactions.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+752 Bytes
(290%)
services/llm-client/logic/__pycache__/prompts.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
from models.prompts import Prompt | ||
from typing import List, Dict, Any | ||
import re | ||
|
||
def find_variables(prompt : Prompt): | ||
pattern = r'\{\{(\w+)\}\}' | ||
return re.findall(pattern, prompt.prompt) | ||
return re.findall(pattern, prompt.prompt) | ||
|
||
def find_missing_variables(prompt_variables: List[str], received_variables: Dict[str, Any]) -> List[str]: | ||
missing_vars = [] | ||
for var in prompt_variables: | ||
if var not in received_variables or received_variables[var] is None: | ||
missing_vars.append(var) | ||
return missing_vars | ||
|
||
def replace_variables(prompt: Prompt, variables: dict[str, Any]) -> str: | ||
pattern = re.compile(r"\{\{(.*?)\}\}") | ||
return pattern.sub(lambda match: str(variables.get(match.group(1), match.group(0))), prompt.prompt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+37 Bytes
(110%)
...ices/llm-client/migrations/scripts/__pycache__/001_create_executions_table.cpython-39.pyc
Binary file not shown.
Binary file modified
BIN
+30 Bytes
(110%)
...lient/migrations/scripts/__pycache__/003_insert_tick_shopping_items_prompt.cpython-39.pyc
Binary file not shown.
Binary file modified
BIN
-257 Bytes
(83%)
services/llm-client/models/__pycache__/interactions.cpython-39.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file modified
BIN
+4.08 KB
(260%)
services/llm-client/tests/logic/__pycache__/prompts_test.cpython-39-pytest-8.3.2.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters