Improved CLI
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 23s
Verify Python project can be installed, loaded and have version checked / Test (push) Failing after 21s

This commit is contained in:
Jon Michael Aanes 2025-05-10 00:39:49 +02:00
parent e1faef51bc
commit 0143e7d44e
2 changed files with 11 additions and 3 deletions

View File

@ -9,11 +9,16 @@ from langchain_core.messages import HumanMessage, SystemMessage
from langgraph.graph import StateGraph, START, END
from langgraph.graph.message import add_messages
import logging
import prompt_toolkit
import prompt_toolkit.history
import prompt_toolkit.auto_suggest
logger = logging.getLogger(__name__)
from . import tools
cli_history = prompt_toolkit.history.FileHistory('output/cli_history.txt')
#MODEL = "gemma3:27b"
MODEL = "qwen3:latest"
@ -33,8 +38,10 @@ def main():
llm = create_model()
prev_idx = 0
while True:
user_input = input("User: ")
user_input = prompt_toolkit.prompt("Human: ",
history=cli_history,
auto_suggest=prompt_toolkit.auto_suggest.AutoSuggestFromHistory(),
)
messages.append(HumanMessage(user_input))
result = llm.invoke({

View File

@ -27,7 +27,8 @@ def wrap(class_, method):
result = list(result)
return result
wrapper.__name__ = f'{class_.__name__}.{method.__name__}'
#wrapper.__name__ = f'{class_.__name__}.{method.__name__}'
wrapper.__name__ = f'{method.__name__}'
wrapper.__doc__ = method.__doc__
wrapper.__annotations__ = method.__annotations__
return tool(wrapper)