Improved CLI
This commit is contained in:
parent
e1faef51bc
commit
0143e7d44e
|
@ -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({
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user