feat: Updated to python 3.14 and made sure packages are up to date.

This commit is contained in:
2025-10-08 13:16:49 +01:00
parent b94b90423d
commit 14e51a187b
5 changed files with 210 additions and 217 deletions
+14 -13
View File
@@ -4,9 +4,10 @@ import requests
from rich import print
from rich.prompt import Prompt
#TODO: context squish when it gets big
# TODO: context squish when it gets big
class llm():
class llm:
def __init__(self, logger) -> None:
self.logger = logger
self.first_prompt = 1
@@ -16,7 +17,7 @@ class llm():
"metadata": {
"created_at": None,
"token_budget": 8000,
}
},
}
def summarise_context(self):
@@ -24,13 +25,13 @@ class llm():
pass
def add_to_history(self, history_object):
self.context['history'].append(history_object)
self.logger.debug(self.context['history'])
self.context["history"].append(history_object)
self.logger.debug(self.context["history"])
def ask_model(self, prompt: str, url=config.LM_STUDIO_URL) -> str:
# prompt = config.PRE_PROMPT + prompt
payload = {
"model": 'qwen/qwen3-coder-30b', #TODO: make this read from config
"model": config.MODEL_NAME,
"messages": [],
"temperature": 0.7,
"max_tokens": 2048,
@@ -39,8 +40,8 @@ class llm():
payload["messages"] = [
{"role": "system", "content": config.SYSTEM_MESSAGE}
] + self.context['history']
self.logger.debug(f'json payload: {payload}')
] + self.context["history"]
self.logger.debug(f"json payload: {payload}")
resp = requests.post(url, json=payload)
resp.raise_for_status()
self.logger.debug(resp.json())
@@ -49,12 +50,12 @@ class llm():
def tool_response(self, prompt: str, url=config.LM_STUDIO_URL) -> str:
payload = {
"model": 'qwen/qwen3-coder-30b', #TODO: make this read from config
"model": config.MODEL_NAME,
"messages": [],
"temperature": 0.7,
"max_tokens": 2048,
}
payload["messages"] = [{"role": "tool", "content": prompt}]
payload["messages"] = [{"role": "tool", "content": prompt}]
resp = requests.post(url, json=payload)
resp.raise_for_status()
self.logger.debug(resp.json())
@@ -63,11 +64,11 @@ class llm():
def get_llm_prompt(self):
while True:
llm_prompt = Prompt.ask("[bold cyan]Ask your local llm[/]")
self.logger.debug(f'prompt is: {llm_prompt}')
if llm_prompt == '':
self.logger.debug(f"prompt is: {llm_prompt}")
if llm_prompt == "":
self.logger.error("Cannot be empty!")
return llm_prompt
def handle_llm_reply(self, llm_reply:str):
def handle_llm_reply(self, llm_reply: str):
architect = ToolExecutor(self.logger)
return architect.process_llm_response(llm_output=llm_reply)