diff --git a/deck/llm.py b/deck/llm.py index 5a641e6..11bb792 100644 --- a/deck/llm.py +++ b/deck/llm.py @@ -86,7 +86,7 @@ class LLMChat: self.messages = [{"role": "system", "content": self.config.get('system_prompt', '')}] return (True, "Context cleared") - def guarded_post(url, headers={}, payload={}): + def guarded_post(self, url, headers={}, payload={}): """ Performs a POST request trying to bypass possible 429 errors with heuristics. """ @@ -106,7 +106,7 @@ class LLMChat: except: pass time.sleep(sleeptime) - return guarded_post(url, headers, payload) + return self.guarded_post(url, headers, payload) else: data = response.json() response.close() @@ -131,7 +131,7 @@ class LLMChat: url = f"{self.provider.get('base_url').rstrip('/')}/chat/completions" try: - response = guarded_post(url, self.headers, payload) + response = self.guarded_post(url, self.headers, payload) data = response.json() response.close() # Important for CircuitPython memory bot_content = data['choices'][0]['message']['content']