npcsh 0.3.31__py3-none-any.whl → 0.3.32__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 (50) hide show
  1. npcsh/audio.py +540 -181
  2. npcsh/audio_gen.py +1 -0
  3. npcsh/cli.py +8 -10
  4. npcsh/conversation.py +14 -251
  5. npcsh/dataframes.py +13 -5
  6. npcsh/helpers.py +5 -0
  7. npcsh/image.py +2 -2
  8. npcsh/image_gen.py +38 -38
  9. npcsh/knowledge_graph.py +4 -4
  10. npcsh/llm_funcs.py +517 -349
  11. npcsh/npc_compiler.py +32 -23
  12. npcsh/npc_sysenv.py +5 -0
  13. npcsh/plonk.py +2 -2
  14. npcsh/response.py +131 -482
  15. npcsh/search.py +5 -1
  16. npcsh/serve.py +210 -203
  17. npcsh/shell.py +11 -25
  18. npcsh/shell_helpers.py +489 -99
  19. npcsh/stream.py +87 -554
  20. npcsh/video.py +5 -2
  21. npcsh/video_gen.py +69 -0
  22. npcsh-0.3.32.dist-info/METADATA +779 -0
  23. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/RECORD +49 -47
  24. npcsh-0.3.31.dist-info/METADATA +0 -1853
  25. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/bash_executer.tool +0 -0
  26. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/calculator.tool +0 -0
  27. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/celona.npc +0 -0
  28. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/code_executor.tool +0 -0
  29. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/corca.npc +0 -0
  30. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/eriane.npc +0 -0
  31. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/foreman.npc +0 -0
  32. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/generic_search.tool +0 -0
  33. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/image_generation.tool +0 -0
  34. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/lineru.npc +0 -0
  35. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/local_search.tool +0 -0
  36. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/maurawa.npc +0 -0
  37. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh.ctx +0 -0
  38. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh_executor.tool +0 -0
  39. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/raone.npc +0 -0
  40. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/screen_cap.tool +0 -0
  41. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sibiji.npc +0 -0
  42. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/slean.npc +0 -0
  43. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sql_executor.tool +0 -0
  44. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/test_pipeline.py +0 -0
  45. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/turnic.npc +0 -0
  46. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/welxor.npc +0 -0
  47. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/WHEEL +0 -0
  48. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/entry_points.txt +0 -0
  49. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/licenses/LICENSE +0 -0
  50. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/top_level.txt +0 -0
npcsh/npc_compiler.py CHANGED
@@ -19,7 +19,7 @@ from collections import defaultdict, deque
19
19
  import traceback
20
20
 
21
21
  # Importing functions
22
- from .llm_funcs import (
22
+ from npcsh.llm_funcs import (
23
23
  get_llm_response,
24
24
  get_stream,
25
25
  process_data_output,
@@ -29,9 +29,9 @@ from .llm_funcs import (
29
29
  handle_tool_call,
30
30
  execute_llm_command,
31
31
  )
32
- from .helpers import get_npc_path
33
- from .search import search_web, rag_search
34
- from .image import capture_screenshot, analyze_image_base
32
+ from npcsh.helpers import get_npc_path
33
+ from npcsh.search import search_web, rag_search
34
+ from npcsh.image import capture_screenshot, analyze_image_base
35
35
 
36
36
 
37
37
  def create_or_replace_table(db_path: str, table_name: str, data: pd.DataFrame):
@@ -579,10 +579,14 @@ class Tool:
579
579
  if i == len(self.steps) - 1 and stream: # this was causing the big issue X:
580
580
  print("tool successful, passing output to stream")
581
581
  return context
582
- # Return the final output
582
+ print("CONTEXT AFTER TOOL CALLS, ", context)
583
583
  if context.get("output") is not None:
584
+ print("output from tool: ", context.get("output"))
585
+ if not isinstance(context.get("output"), str):
586
+ return str(context.get("output"))
584
587
  return context.get("output")
585
588
  elif context.get("llm_response") is not None:
589
+ print("output from tool: ", context.get("llm_response"))
586
590
  return context.get("llm_response")
587
591
 
588
592
  def execute_step(
@@ -613,6 +617,8 @@ class Tool:
613
617
  except:
614
618
  print("error rendering engine")
615
619
  rendered_engine = engine
620
+ print(f"proceeding with engine: {rendered_engine}")
621
+ print("rendered code: ", rendered_code)
616
622
  if rendered_engine == "natural":
617
623
  if len(rendered_code.strip()) > 0:
618
624
  # print(f"Executing natural language step: {rendered_code}")
@@ -657,25 +663,27 @@ class Tool:
657
663
  }
658
664
  new_locals = {}
659
665
  exec_env = context.copy()
660
- try:
661
- exec(rendered_code, exec_globals, new_locals)
662
- exec_env.update(new_locals)
663
-
664
- context.update(exec_env)
665
-
666
- exec_env.update(new_locals)
667
- context.update(exec_env)
668
-
669
- # Add this line to explicitly copy the output
670
- if "output" in new_locals:
671
- context["output"] = new_locals["output"]
672
-
673
- # Then your existing code
674
- if "output" in exec_env:
675
- if exec_env["output"] is not None:
676
- context["results"] = exec_env["output"]
677
- print("result from code execution: ", exec_env["output"])
666
+ # try:
667
+ exec(rendered_code, exec_globals, new_locals)
668
+ exec_env.update(new_locals)
669
+
670
+ context.update(exec_env)
671
+
672
+ exec_env.update(new_locals)
673
+ context.update(exec_env)
674
+ # Add this line to explicitly copy the output
675
+ if "output" in new_locals:
676
+ context["output"] = new_locals["output"]
677
+
678
+ # Then your existing code
679
+ if "output" in exec_env:
680
+ if exec_env["output"] is not None:
681
+ context["results"] = exec_env["output"]
682
+ print("result from code execution: ", exec_env["output"])
683
+ # else:
684
+ # context["output"] = str(exec_env)
678
685
 
686
+ """
679
687
  except NameError as e:
680
688
  tb_lines = traceback.format_exc().splitlines()
681
689
  limited_tb = (
@@ -718,6 +726,7 @@ class Tool:
718
726
  return {
719
727
  "output": f"Error executing Python code : {e} with traceback: {limited_tb}"
720
728
  }
729
+ """
721
730
  return context
722
731
 
723
732
  def to_dict(self):
npcsh/npc_sysenv.py CHANGED
@@ -374,6 +374,11 @@ NPCSH_IMAGE_GEN_MODEL = os.environ.get(
374
374
  "NPCSH_IMAGE_GEN_MODEL", "runwayml/stable-diffusion-v1-5"
375
375
  )
376
376
  NPCSH_IMAGE_GEN_PROVIDER = os.environ.get("NPCSH_IMAGE_GEN_PROVIDER", "diffusers")
377
+ NPCSH_VIDEO_GEN_MODEL = os.environ.get(
378
+ "NPCSH_VIDEO_GEN_MODEL", "damo-vilab/text-to-video-ms-1.7b"
379
+ )
380
+ NPCSH_VIDEO_GEN_PROVIDER = os.environ.get("NPCSH_VIDEO_GEN_PROVIDER", "diffusers")
381
+
377
382
  NPCSH_EMBEDDING_MODEL = os.environ.get("NPCSH_EMBEDDING_MODEL", "nomic-embed-text")
378
383
  NPCSH_EMBEDDING_PROVIDER = os.environ.get("NPCSH_EMBEDDING_PROVIDER", "ollama")
379
384
  NPCSH_REASONING_MODEL = os.environ.get("NPCSH_REASONING_MODEL", "deepseek-r1")
npcsh/plonk.py CHANGED
@@ -6,8 +6,8 @@ try:
6
6
  except KeyError as e:
7
7
  print(f"Could not load pyautogui due to the following error: {e}")
8
8
 
9
- from .image import capture_screenshot
10
- from .llm_funcs import get_llm_response
9
+ from npcsh.image import capture_screenshot
10
+ from npcsh.llm_funcs import get_llm_response
11
11
 
12
12
  import subprocess
13
13
  import os