ara-cli 0.1.13.3__py3-none-any.whl → 0.1.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. ara_cli/__init__.py +1 -1
  2. ara_cli/ara_command_action.py +162 -112
  3. ara_cli/ara_config.py +1 -1
  4. ara_cli/ara_subcommands/convert.py +66 -2
  5. ara_cli/ara_subcommands/prompt.py +266 -106
  6. ara_cli/artefact_autofix.py +2 -2
  7. ara_cli/artefact_converter.py +152 -53
  8. ara_cli/artefact_creator.py +41 -17
  9. ara_cli/artefact_lister.py +3 -3
  10. ara_cli/artefact_models/artefact_model.py +1 -1
  11. ara_cli/artefact_models/artefact_templates.py +0 -9
  12. ara_cli/artefact_models/feature_artefact_model.py +8 -8
  13. ara_cli/artefact_reader.py +62 -43
  14. ara_cli/artefact_scan.py +39 -17
  15. ara_cli/chat.py +23 -15
  16. ara_cli/children_contribution_updater.py +737 -0
  17. ara_cli/classifier.py +34 -0
  18. ara_cli/commands/load_command.py +4 -3
  19. ara_cli/commands/load_image_command.py +1 -1
  20. ara_cli/commands/read_command.py +23 -27
  21. ara_cli/completers.py +24 -0
  22. ara_cli/error_handler.py +26 -11
  23. ara_cli/file_loaders/document_reader.py +0 -178
  24. ara_cli/file_loaders/factories/__init__.py +0 -0
  25. ara_cli/file_loaders/factories/document_reader_factory.py +32 -0
  26. ara_cli/file_loaders/factories/file_loader_factory.py +27 -0
  27. ara_cli/file_loaders/file_loader.py +1 -30
  28. ara_cli/file_loaders/loaders/__init__.py +0 -0
  29. ara_cli/file_loaders/{document_file_loader.py → loaders/document_file_loader.py} +1 -1
  30. ara_cli/file_loaders/loaders/text_file_loader.py +47 -0
  31. ara_cli/file_loaders/readers/__init__.py +0 -0
  32. ara_cli/file_loaders/readers/docx_reader.py +49 -0
  33. ara_cli/file_loaders/readers/excel_reader.py +27 -0
  34. ara_cli/file_loaders/{markdown_reader.py → readers/markdown_reader.py} +1 -1
  35. ara_cli/file_loaders/readers/odt_reader.py +59 -0
  36. ara_cli/file_loaders/readers/pdf_reader.py +54 -0
  37. ara_cli/file_loaders/readers/pptx_reader.py +104 -0
  38. ara_cli/file_loaders/tools/__init__.py +0 -0
  39. ara_cli/output_suppressor.py +53 -0
  40. ara_cli/prompt_handler.py +123 -17
  41. ara_cli/tag_extractor.py +8 -7
  42. ara_cli/version.py +1 -1
  43. {ara_cli-0.1.13.3.dist-info → ara_cli-0.1.14.0.dist-info}/METADATA +18 -12
  44. {ara_cli-0.1.13.3.dist-info → ara_cli-0.1.14.0.dist-info}/RECORD +58 -45
  45. {ara_cli-0.1.13.3.dist-info → ara_cli-0.1.14.0.dist-info}/WHEEL +1 -1
  46. tests/test_artefact_converter.py +1 -46
  47. tests/test_artefact_lister.py +11 -8
  48. tests/test_chat.py +4 -4
  49. tests/test_chat_givens_images.py +1 -1
  50. tests/test_children_contribution_updater.py +98 -0
  51. tests/test_document_loader_office.py +267 -0
  52. tests/test_prompt_handler.py +416 -214
  53. tests/test_setup_default_chat_prompt_mode.py +198 -0
  54. tests/test_tag_extractor.py +95 -49
  55. ara_cli/file_loaders/document_readers.py +0 -233
  56. ara_cli/file_loaders/file_loaders.py +0 -123
  57. ara_cli/file_loaders/text_file_loader.py +0 -187
  58. /ara_cli/file_loaders/{binary_file_loader.py → loaders/binary_file_loader.py} +0 -0
  59. /ara_cli/file_loaders/{image_processor.py → tools/image_processor.py} +0 -0
  60. {ara_cli-0.1.13.3.dist-info → ara_cli-0.1.14.0.dist-info}/entry_points.txt +0 -0
  61. {ara_cli-0.1.13.3.dist-info → ara_cli-0.1.14.0.dist-info}/top_level.txt +0 -0
ara_cli/chat.py CHANGED
@@ -3,8 +3,6 @@ import sys
3
3
  import argparse
4
4
  import cmd2
5
5
 
6
- from ara_cli.prompt_handler import send_prompt
7
-
8
6
  from . import (
9
7
  CATEGORY_CHAT_CONTROL,
10
8
  CATEGORY_LLM_CONTROL,
@@ -17,19 +15,11 @@ from . import BINARY_TYPE_MAPPING, DOCUMENT_TYPE_EXTENSIONS
17
15
  from . import error_handler
18
16
  from ara_cli.error_handler import AraError, AraConfigurationError
19
17
 
20
- from ara_cli.file_loaders.document_file_loader import DocumentFileLoader
21
- from ara_cli.file_loaders.binary_file_loader import BinaryFileLoader
22
- from ara_cli.file_loaders.text_file_loader import TextFileLoader
23
18
  from ara_cli.chat_agent.agent_process_manager import AgentProcessManager
24
19
 
25
20
  from ara_cli.chat_script_runner.script_runner import ScriptRunner
26
21
  from ara_cli.chat_script_runner.script_completer import ScriptCompleter
27
22
  from ara_cli.chat_script_runner.script_lister import ScriptLister
28
- from ara_cli.chat_web_search.web_search import (
29
- perform_web_search_completion,
30
- is_web_search_supported,
31
- get_supported_models_message,
32
- )
33
23
 
34
24
 
35
25
  extract_parser = argparse.ArgumentParser()
@@ -291,21 +281,24 @@ class Chat(cmd2.Cmd):
291
281
  with open(self.chat_name, "a+", encoding="utf-8") as file:
292
282
  last_line = self.get_last_line(file)
293
283
 
294
- print(role_marker)
284
+ self.poutput(role_marker)
295
285
 
296
286
  if not last_line.startswith(role_marker):
297
287
  if last_line:
298
288
  file.write("\n")
299
289
  file.write(role_marker + "\n")
290
+ file.flush()
291
+
292
+ from ara_cli.prompt_handler import send_prompt
300
293
 
301
294
  for chunk in send_prompt(prompt_to_send):
302
295
  chunk_content = chunk.choices[0].delta.content
303
296
  if not chunk_content:
304
297
  continue
305
- print(chunk_content, end="", flush=True)
298
+ self.poutput(chunk_content, end="")
306
299
  file.write(chunk_content)
307
300
  file.flush()
308
- print()
301
+ self.poutput("")
309
302
 
310
303
  self.message_buffer.clear()
311
304
 
@@ -381,6 +374,8 @@ class Chat(cmd2.Cmd):
381
374
  block_delimiter: str = "",
382
375
  extract_images: bool = False,
383
376
  ):
377
+ from ara_cli.file_loaders.loaders.text_file_loader import TextFileLoader
378
+
384
379
  loader = TextFileLoader(self)
385
380
  return loader.load(
386
381
  file_path,
@@ -393,12 +388,14 @@ class Chat(cmd2.Cmd):
393
388
  def load_binary_file(
394
389
  self, file_path, mime_type: str, prefix: str = "", suffix: str = ""
395
390
  ):
391
+ from ara_cli.file_loaders.loaders.binary_file_loader import BinaryFileLoader
392
+
396
393
  loader = BinaryFileLoader(self)
397
394
  return loader.load(file_path, mime_type=mime_type, prefix=prefix, suffix=suffix)
398
395
 
399
396
  def read_markdown(self, file_path: str, extract_images: bool = False) -> str:
400
397
  """Read markdown file and optionally extract/describe images"""
401
- from ara_cli.file_loaders.text_file_loader import MarkdownReader
398
+ from ara_cli.file_loaders.readers.markdown_reader import MarkdownReader
402
399
 
403
400
  reader = MarkdownReader(file_path)
404
401
  return reader.read(extract_images=extract_images)
@@ -411,6 +408,8 @@ class Chat(cmd2.Cmd):
411
408
  block_delimiter: str = "```",
412
409
  extract_images: bool = False,
413
410
  ):
411
+ from ara_cli.file_loaders.loaders.document_file_loader import DocumentFileLoader
412
+
414
413
  loader = DocumentFileLoader(self)
415
414
  return loader.load(
416
415
  file_path,
@@ -549,7 +548,7 @@ class Chat(cmd2.Cmd):
549
548
  def complete_LOAD(self, text, line, begidx, endidx):
550
549
  import glob
551
550
 
552
- return [x for x in glob.glob(text + "*")]
551
+ return [x for x in glob.glob(glob.escape(text) + "*")]
553
552
 
554
553
  def _retrieve_ara_config(self):
555
554
  from ara_cli.prompt_handler import ConfigManager
@@ -568,6 +567,10 @@ class Chat(cmd2.Cmd):
568
567
  print("What file do you want to load? ", end="", flush=True)
569
568
  file_name = sys.stdin.readline().strip()
570
569
  file_pattern = os.path.join(os.path.dirname(self.chat_name), file_name)
570
+
571
+ if os.path.exists(file_pattern):
572
+ return [file_pattern]
573
+
571
574
  matching_files = glob.glob(file_pattern)
572
575
  if not matching_files:
573
576
  error_handler.report_error(
@@ -617,6 +620,11 @@ class Chat(cmd2.Cmd):
617
620
 
618
621
  # Check if web search is supported by the current model
619
622
  from ara_cli.prompt_handler import LLMSingleton
623
+ from ara_cli.chat_web_search.web_search import (
624
+ perform_web_search_completion,
625
+ is_web_search_supported,
626
+ get_supported_models_message,
627
+ )
620
628
 
621
629
  chat_instance = LLMSingleton.get_instance()
622
630
  config_parameters = chat_instance.get_config_by_purpose("default")