aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nicholas Tindle <nicholas.tindle@agpt.co> 2024-04-19 22:27:43 -0500
committerGravatar Nicholas Tindle <nicholas.tindle@agpt.co> 2024-04-19 22:27:43 -0500
commitaed8f0ec56b287940c5f8e8fdb1299c0487f0033 (patch)
treeda891602198c986ed41c2b584a0a118827e88660
parentfix: linting error (diff)
downloadAuto-GPT-aed8f0ec56b287940c5f8e8fdb1299c0487f0033.tar.gz
Auto-GPT-aed8f0ec56b287940c5f8e8fdb1299c0487f0033.tar.bz2
Auto-GPT-aed8f0ec56b287940c5f8e8fdb1299c0487f0033.zip
fix: pull request changes
-rw-r--r--autogpts/forge/forge/sdk/prompting.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/autogpts/forge/forge/sdk/prompting.py b/autogpts/forge/forge/sdk/prompting.py
index 84ea53e21..2549f0f28 100644
--- a/autogpts/forge/forge/sdk/prompting.py
+++ b/autogpts/forge/forge/sdk/prompting.py
@@ -22,7 +22,7 @@ import glob
import os
from difflib import get_close_matches
from typing import List
-
+from pathlib import Path
from jinja2 import Environment, FileSystemLoader
from .forge_log import ForgeLogger
@@ -93,7 +93,7 @@ class PromptEngine:
LOG.error(f"Error finding closest match: {e}")
raise
- def load_prompt(self, template: str, **kwargs) -> str:
+ def load_prompt(self, template_name: str, **kwargs) -> str:
"""
Load and populate the specified template.
@@ -105,13 +105,13 @@ class PromptEngine:
str: The populated template.
"""
try:
- template = os.path.join(self.model, template)
+ template_name = os.path.join(self.model, template_name)
if self.debug_enabled:
- LOG.debug(f"Loading template: {template}")
- template = template.replace("\\", "/")
- template = self.env.get_template(f"{template}.j2")
+ LOG.debug(f"Loading template: {template_name}")
+ template_name = Path(template_name).as_posix()
+ template = self.env.get_template(f"{template_name}.j2")
if self.debug_enabled:
- LOG.debug(f"Rendering template: {template} with args: {kwargs}")
+ LOG.debug(f"Rendering template: {template_name} with args: {kwargs}")
return template.render(**kwargs)
except Exception as e:
LOG.error(f"Error loading or rendering template: {e}")