Skip to content

Commit

Permalink
Fix splash and rag mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Nov 21, 2024
1 parent e435c8b commit d0ea134
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 52 deletions.
6 changes: 2 additions & 4 deletions src/main/askai/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _get_argument(self, arg_name: str, default: typing.Any = None) -> typing.Opt
if isinstance(arg, str):
return arg
elif isinstance(arg, list):
return get_or_default(arg, 0, "")
return " ".join(arg)
elif isinstance(arg, bool):
return arg
elif isinstance(arg, int):
Expand All @@ -239,9 +239,7 @@ def _get_interactive(self, query_string: str) -> bool:
:param query_string: The query string to check for interactivity.
:return: The value of the interactive parameter or False based on query_string presence.
"""
interactive: bool = to_bool(self._get_argument("interactive", False))
interactive = interactive if not query_string else False
return interactive
return to_bool(self._get_argument("interactive", not query_string))


# Application entry point
Expand Down
3 changes: 2 additions & 1 deletion src/main/askai/core/askai_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import os
import signal
from pathlib import Path
from textwrap import indent
from threading import Thread
from typing import Optional

Expand Down Expand Up @@ -164,7 +165,7 @@ def _splash(self, interval: int = 250) -> None:
:param interval: The interval in milliseconds for polling the startup status (default is 250 ms).
"""
screen.clear()
console_out.print(self.SPLASH)
console_out.print(indent(self.SPLASH, " " * 13))
while not self._ready:
pause.milliseconds(interval)
screen.clear()
Expand Down
6 changes: 2 additions & 4 deletions src/main/askai/core/processors/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self):

@property
def rag_template(self) -> BasePromptTemplate:
prompt_file: PathObject = PathObject.of(prompt.append_path(f"langchain/rag-prompt"))
prompt_file: PathObject = PathObject.of(prompt.append_path(f"taius/taius-non-interactive"))
final_prompt: str = prompt.read_prompt(prompt_file.filename, prompt_file.abs_dir)
# fmt: off
return ChatPromptTemplate.from_messages([
Expand Down Expand Up @@ -93,9 +93,7 @@ def process(self, question: str, **_) -> Optional[str]:
# FIXME Include kwargs to specify rag dir and glob
self.generate()

with Live(
Spinner("dots", f"[green]{msg.wait()}[/green]", style="green"), console=tf.console
):
with Live(Spinner("dots", f"[green]{msg.wait()}[/green]", style="green"), console=tf.console):
if not (output := self._rag_chain.invoke(question)):
output = msg.invalid_response(output)

Expand Down
19 changes: 0 additions & 19 deletions src/main/askai/resources/prompts/langchain/rag-prompt.txt

This file was deleted.

26 changes: 23 additions & 3 deletions src/main/askai/resources/prompts/taius/taius-non-interactive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,33 @@ You are 'Taius', the AskAI helpful and kind assistant. 'Taius' stands for *'T.A.
If the context is provided, utilize it to address the question; otherwise, proceed naturally.


Guidelines for the response (in-order):
**Guidelines (in-order):**

- Ensure important details are included, specially when mentioning files, folders, line numbers, etc.
- Use the following pieces of retrieved context to answer the question.

- If the context in not useful, respond using your latest information.

- Keep the answer concise.

Give some examples.

- Don't express your opinion.

- Play to your strengths as an LLM and pursue simple strategies with no legal complications.

- Provide the complete answer/guidelines, not just one step.

- Provide any useful links to web sites, github projects, youtube videos, etc...

- Do not use markdown to format the response message. Use plain text.

- If you don't know the answer, simply return 'I don't know'. Don't try to make up an answer.
- Ensure important details are included, specially when mentioning files, folders, line numbers, etc.

- Don't seek user assistance.

- If applicable, mention where in the docs to find out more information.

- If you don't know the answer, just say that you don't know.


Chat History and Context:
Expand Down
42 changes: 21 additions & 21 deletions src/main/askai/resources/splash.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[green4] (&&&&&&%
#%%%%&&&&&&@@@@@&%
/#%%%&&&&@@@@@@@@@@@@@@
/###%%%%%&%%%%&&&&&@@@@@%&
*(,#(((////(/////(((%%@@@@&#
*(,*//*((#(//*/*((#%&&&&@@&%
*/*,##%/. ../(*(/...*%@@@#%&
**/* . ,. @##
,., ,,#/, *%(
.,*, **( %#* .&%,
,/(*,,,...,* *..,****##(
,. . ,* *,, ,((
**(*,*/%*(*%(* ( *
(/(((# #((#%,
..*//*,//*.,[/green4][spring_green4][bold]
__ _ _
/ / ___ __ _ __| (_)_ __ __ _
/ / / _ \ / _` |/ _` | | '_ \ / _` |
/ /__| (_) | (_| | (_| | | | | | (_| |_ _ _
\____/\___/ \__,_|\__,_|_|_| |_|\__, (_|_|_)
|___/[/spring_green4][/bold]
[center][green4](&&&&&&%
#%%%%&&&&&&@@@@@&%
/#%%%&&&&@@@@@@@@@@@@@@
/###%%%%%&%%%%&&&&&@@@@@%&
*(,#(((////(/////(((%%@@@@&#
*(,*//*((#(//*/*((#%&&&&@@&%
*/*,##%/. ../(*(/...*%@@@#%&
**/* . ,. @##
,., ,,#/, *%(
.,*, **( %#* .&%,
,/(*,,,...,* *..,****##(
,. . ,* *,, ,((
**(*,*/%*(*%(* ( *
(/(((# #((#%,
..*//*,//*.,[/green4][spring_green4][bold]
__ _ _
/ / ___ __ _ __| (_)_ __ __ _
/ / / _ \ / _` |/ _` | | '_ \ / _` |
/ /__| (_) | (_| | (_| | | | | | (_| |_ _ _
\____/\___/ \__,_|\__,_|_|_| |_|\__, (_|_|_)
|___/[/spring_green4][/bold][center]

0 comments on commit d0ea134

Please sign in to comment.