From 569fca65b1b60d94c97062cb1df1f0f9bc0aa84c Mon Sep 17 00:00:00 2001 From: vinid Date: Sun, 14 Jul 2024 18:10:38 -0400 Subject: [PATCH] just redecleare the key --- textgrad/engine/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/textgrad/engine/base.py b/textgrad/engine/base.py index bcd7e92..a25962c 100644 --- a/textgrad/engine/base.py +++ b/textgrad/engine/base.py @@ -85,9 +85,8 @@ def single_prompt_generate(self, prompt: str, system_prompt: str=None, **kwargs) def multimodal_generate(self, content: List[Union[str, bytes]], system_prompt: str = None, **kwargs): sys_prompt_arg = system_prompt if system_prompt else self.system_prompt + key = "".join([str(k) for k in content]) if self.do_cache: - key = "".join([str(k) for k in content]) - cache_key = sys_prompt_arg + key cache_or_none = self._check_cache(cache_key) if cache_or_none is not None: @@ -96,6 +95,7 @@ def multimodal_generate(self, content: List[Union[str, bytes]], system_prompt: s response = self._generate_from_multiple_input(content, system_prompt=sys_prompt_arg, **kwargs) if self.do_cache: + cache_key = sys_prompt_arg + key self._save_cache(cache_key, response) return response