npcpy 1.2.20__tar.gz → 1.2.21__tar.gz

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 (66) hide show
  1. {npcpy-1.2.20/npcpy.egg-info → npcpy-1.2.21}/PKG-INFO +5 -7
  2. {npcpy-1.2.20 → npcpy-1.2.21}/README.md +2 -6
  3. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/npc_compiler.py +88 -7
  4. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/serve.py +3 -3
  5. {npcpy-1.2.20 → npcpy-1.2.21/npcpy.egg-info}/PKG-INFO +5 -7
  6. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy.egg-info/requires.txt +2 -0
  7. {npcpy-1.2.20 → npcpy-1.2.21}/setup.py +2 -1
  8. {npcpy-1.2.20 → npcpy-1.2.21}/LICENSE +0 -0
  9. {npcpy-1.2.20 → npcpy-1.2.21}/MANIFEST.in +0 -0
  10. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/__init__.py +0 -0
  11. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/__init__.py +0 -0
  12. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/audio.py +0 -0
  13. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/data_models.py +0 -0
  14. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/image.py +0 -0
  15. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/load.py +0 -0
  16. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/text.py +0 -0
  17. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/video.py +0 -0
  18. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/data/web.py +0 -0
  19. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/__init__.py +0 -0
  20. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/diff.py +0 -0
  21. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/ge.py +0 -0
  22. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/memory_trainer.py +0 -0
  23. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/rl.py +0 -0
  24. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/ft/sft.py +0 -0
  25. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/__init__.py +0 -0
  26. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/audio_gen.py +0 -0
  27. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/embeddings.py +0 -0
  28. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/image_gen.py +0 -0
  29. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/response.py +0 -0
  30. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/gen/video_gen.py +0 -0
  31. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/llm_funcs.py +0 -0
  32. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/main.py +0 -0
  33. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/__init__.py +0 -0
  34. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/command_history.py +0 -0
  35. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/kg_vis.py +0 -0
  36. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/knowledge_graph.py +0 -0
  37. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/memory_processor.py +0 -0
  38. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/memory/search.py +0 -0
  39. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/mix/__init__.py +0 -0
  40. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/mix/debate.py +0 -0
  41. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/npc_sysenv.py +0 -0
  42. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/npcs.py +0 -0
  43. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/sql/__init__.py +0 -0
  44. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/sql/model_runner.py +0 -0
  45. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/sql/npcsql.py +0 -0
  46. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/tools.py +0 -0
  47. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/work/__init__.py +0 -0
  48. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/work/desktop.py +0 -0
  49. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/work/plan.py +0 -0
  50. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy/work/trigger.py +0 -0
  51. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy.egg-info/SOURCES.txt +0 -0
  52. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy.egg-info/dependency_links.txt +0 -0
  53. {npcpy-1.2.20 → npcpy-1.2.21}/npcpy.egg-info/top_level.txt +0 -0
  54. {npcpy-1.2.20 → npcpy-1.2.21}/setup.cfg +0 -0
  55. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_audio.py +0 -0
  56. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_command_history.py +0 -0
  57. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_image.py +0 -0
  58. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_llm_funcs.py +0 -0
  59. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_load.py +0 -0
  60. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_npc_compiler.py +0 -0
  61. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_npcsql.py +0 -0
  62. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_response.py +0 -0
  63. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_serve.py +0 -0
  64. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_text.py +0 -0
  65. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_tools.py +0 -0
  66. {npcpy-1.2.20 → npcpy-1.2.21}/tests/test_web.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.2.20
3
+ Version: 1.2.21
4
4
  Summary: npcpy is the premier open-source library for integrating LLMs and Agents into python systems.
5
5
  Home-page: https://github.com/NPC-Worldwide/npcpy
6
6
  Author: Christopher Agostino
@@ -55,6 +55,7 @@ Requires-Dist: kuzu; extra == "local"
55
55
  Requires-Dist: chromadb; extra == "local"
56
56
  Requires-Dist: diffusers; extra == "local"
57
57
  Requires-Dist: torch; extra == "local"
58
+ Requires-Dist: datasets; extra == "local"
58
59
  Provides-Extra: yap
59
60
  Requires-Dist: pyaudio; extra == "yap"
60
61
  Requires-Dist: gtts; extra == "yap"
@@ -74,6 +75,7 @@ Requires-Dist: kuzu; extra == "all"
74
75
  Requires-Dist: chromadb; extra == "all"
75
76
  Requires-Dist: diffusers; extra == "all"
76
77
  Requires-Dist: torch; extra == "all"
78
+ Requires-Dist: datasets; extra == "all"
77
79
  Requires-Dist: pyaudio; extra == "all"
78
80
  Requires-Dist: gtts; extra == "all"
79
81
  Requires-Dist: playsound==1.2.2; extra == "all"
@@ -93,19 +95,15 @@ Dynamic: requires-python
93
95
  Dynamic: summary
94
96
 
95
97
  <p align="center">
96
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy.png" alt="npcpy logo of a solarpunk sign">
98
+ <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
99
+ <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
97
100
  </p>
98
101
 
99
-
100
102
  # npcpy
101
103
 
102
104
  Welcome to `npcpy`, the core library of the NPC Toolkit that supercharges natural language processing pipelines and agent tooling. `npcpy` is a flexible framework for building state-of-the-art applications and conducting novel research with LLMs.
103
105
 
104
106
 
105
- <p align="center">
106
- <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
107
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
108
- </p>
109
107
 
110
108
 
111
109
  Here is an example for getting responses for a particular agent:
@@ -1,17 +1,13 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy.png" alt="npcpy logo of a solarpunk sign">
2
+ <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
3
+ <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
3
4
  </p>
4
5
 
5
-
6
6
  # npcpy
7
7
 
8
8
  Welcome to `npcpy`, the core library of the NPC Toolkit that supercharges natural language processing pipelines and agent tooling. `npcpy` is a flexible framework for building state-of-the-art applications and conducting novel research with LLMs.
9
9
 
10
10
 
11
- <p align="center">
12
- <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
13
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
14
- </p>
15
11
 
16
12
 
17
13
  Here is an example for getting responses for a particular agent:
@@ -1908,7 +1908,8 @@ class Team:
1908
1908
  "dataframes": {},
1909
1909
  "memories": {},
1910
1910
  "execution_history": [],
1911
- "npc_messages": {}
1911
+ "npc_messages": {},
1912
+ "context":''
1912
1913
  }
1913
1914
 
1914
1915
  if team_path:
@@ -2017,11 +2018,12 @@ class Team:
2017
2018
  self.databases = ctx_data['databases']
2018
2019
  else:
2019
2020
  self.databases = []
2020
- if 'context' in ctx_data:
2021
- self.context = ctx_data['context']
2022
- else:
2023
- self.context = ''
2024
-
2021
+
2022
+ base_context = ctx_data.get('context', '')
2023
+ self.shared_context['context'] = base_context
2024
+ if 'file_patterns' in ctx_data:
2025
+ file_cache = self._parse_file_patterns(ctx_data['file_patterns'])
2026
+ self.shared_context['files'] = file_cache
2025
2027
  if 'preferences' in ctx_data:
2026
2028
  self.preferences = ctx_data['preferences']
2027
2029
  else:
@@ -2031,7 +2033,7 @@ class Team:
2031
2033
  else:
2032
2034
  self.forenpc = self.npcs[list(self.npcs.keys())[0]] if self.npcs else None
2033
2035
  for key, item in ctx_data.items():
2034
- if key not in ['name', 'mcp_servers', 'databases', 'context']:
2036
+ if key not in ['name', 'mcp_servers', 'databases', 'context', 'file_patterns']:
2035
2037
  self.shared_context[key] = item
2036
2038
  return ctx_data
2037
2039
  return {}
@@ -2288,6 +2290,85 @@ class Team:
2288
2290
  team.save(team_dir)
2289
2291
 
2290
2292
  return True
2293
+ def _parse_file_patterns(self, patterns_config):
2294
+ """Parse file patterns configuration and load matching files into KV cache"""
2295
+ if not patterns_config:
2296
+ return {}
2297
+
2298
+ file_cache = {}
2299
+
2300
+ for pattern_entry in patterns_config:
2301
+ if isinstance(pattern_entry, str):
2302
+ pattern_entry = {"pattern": pattern_entry}
2303
+
2304
+ pattern = pattern_entry.get("pattern", "")
2305
+ recursive = pattern_entry.get("recursive", False)
2306
+ base_path = pattern_entry.get("base_path", ".")
2307
+
2308
+ if not pattern:
2309
+ continue
2310
+
2311
+ base_path = os.path.expanduser(base_path)
2312
+ if not os.path.isabs(base_path):
2313
+ base_path = os.path.join(self.team_path or os.getcwd(), base_path)
2314
+
2315
+ matching_files = self._find_matching_files(pattern, base_path, recursive)
2316
+
2317
+ for file_path in matching_files:
2318
+ file_content = self._load_file_content(file_path)
2319
+ if file_content:
2320
+ relative_path = os.path.relpath(file_path, base_path)
2321
+ file_cache[relative_path] = file_content
2322
+
2323
+ return file_cache
2324
+
2325
+ def _find_matching_files(self, pattern, base_path, recursive=False):
2326
+ """Find files matching the given pattern"""
2327
+ matching_files = []
2328
+
2329
+ if not os.path.exists(base_path):
2330
+ return matching_files
2331
+
2332
+ if recursive:
2333
+ for root, dirs, files in os.walk(base_path):
2334
+ for filename in files:
2335
+ if fnmatch.fnmatch(filename, pattern):
2336
+ matching_files.append(os.path.join(root, filename))
2337
+ else:
2338
+ try:
2339
+ for item in os.listdir(base_path):
2340
+ item_path = os.path.join(base_path, item)
2341
+ if os.path.isfile(item_path) and fnmatch.fnmatch(item, pattern):
2342
+ matching_files.append(item_path)
2343
+ except PermissionError:
2344
+ print(f"Permission denied accessing {base_path}")
2345
+
2346
+ return matching_files
2347
+
2348
+ def _load_file_content(self, file_path):
2349
+ """Load content from a file with error handling"""
2350
+ try:
2351
+ with open(file_path, 'r', encoding='utf-8') as f:
2352
+ return f.read()
2353
+ except Exception as e:
2354
+ print(f"Error reading {file_path}: {e}")
2355
+ return None
2356
+
2357
+
2358
+ def _format_parsed_files_context(self, parsed_files):
2359
+ """Format parsed files into context string"""
2360
+ if not parsed_files:
2361
+ return ""
2362
+
2363
+ context_parts = ["Additional context from files:"]
2364
+
2365
+ for file_path, content in parsed_files.items():
2366
+ context_parts.append(f"\n--- {file_path} ---")
2367
+ context_parts.append(content)
2368
+ context_parts.append("")
2369
+
2370
+ return "\n".join(context_parts)
2371
+
2291
2372
  class Pipeline:
2292
2373
  def __init__(self, pipeline_data=None, pipeline_path=None, npc_team=None):
2293
2374
  """Initialize a pipeline from data or file path"""
@@ -443,7 +443,7 @@ def get_global_settings():
443
443
  "embedding_model": "nomic-embed-text",
444
444
  "embedding_provider": "ollama",
445
445
  "search_provider": "perplexity",
446
- "NPCSH_LICENSE_KEY": "",
446
+ "NPC_STUDIO_LICENSE_KEY": "",
447
447
  "default_folder": os.path.expanduser("~/.npcsh/"),
448
448
  }
449
449
  global_vars = {}
@@ -479,7 +479,7 @@ def get_global_settings():
479
479
  "NPCSH_EMBEDDING_MODEL": "embedding_model",
480
480
  "NPCSH_EMBEDDING_PROVIDER": "embedding_provider",
481
481
  "NPCSH_SEARCH_PROVIDER": "search_provider",
482
- "NPCSH_LICENSE_KEY": "NPCSH_LICENSE_KEY",
482
+ "NPC_STUDIO_LICENSE_KEY": "NPC_STUDIO_LICENSE_KEY",
483
483
  "NPCSH_STREAM_OUTPUT": "NPCSH_STREAM_OUTPUT",
484
484
  "NPC_STUDIO_DEFAULT_FOLDER": "default_folder",
485
485
  }
@@ -521,7 +521,7 @@ def save_global_settings():
521
521
  "embedding_model": "NPCSH_EMBEDDING_MODEL",
522
522
  "embedding_provider": "NPCSH_EMBEDDING_PROVIDER",
523
523
  "search_provider": "NPCSH_SEARCH_PROVIDER",
524
- "NPCSH_LICENSE_KEY": "NPCSH_LICENSE_KEY",
524
+ "NPC_STUDIO_LICENSE_KEY": "NPC_STUDIO_LICENSE_KEY",
525
525
  "NPCSH_STREAM_OUTPUT": "NPCSH_STREAM_OUTPUT",
526
526
  "default_folder": "NPC_STUDIO_DEFAULT_FOLDER",
527
527
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.2.20
3
+ Version: 1.2.21
4
4
  Summary: npcpy is the premier open-source library for integrating LLMs and Agents into python systems.
5
5
  Home-page: https://github.com/NPC-Worldwide/npcpy
6
6
  Author: Christopher Agostino
@@ -55,6 +55,7 @@ Requires-Dist: kuzu; extra == "local"
55
55
  Requires-Dist: chromadb; extra == "local"
56
56
  Requires-Dist: diffusers; extra == "local"
57
57
  Requires-Dist: torch; extra == "local"
58
+ Requires-Dist: datasets; extra == "local"
58
59
  Provides-Extra: yap
59
60
  Requires-Dist: pyaudio; extra == "yap"
60
61
  Requires-Dist: gtts; extra == "yap"
@@ -74,6 +75,7 @@ Requires-Dist: kuzu; extra == "all"
74
75
  Requires-Dist: chromadb; extra == "all"
75
76
  Requires-Dist: diffusers; extra == "all"
76
77
  Requires-Dist: torch; extra == "all"
78
+ Requires-Dist: datasets; extra == "all"
77
79
  Requires-Dist: pyaudio; extra == "all"
78
80
  Requires-Dist: gtts; extra == "all"
79
81
  Requires-Dist: playsound==1.2.2; extra == "all"
@@ -93,19 +95,15 @@ Dynamic: requires-python
93
95
  Dynamic: summary
94
96
 
95
97
  <p align="center">
96
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy.png" alt="npcpy logo of a solarpunk sign">
98
+ <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
99
+ <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
97
100
  </p>
98
101
 
99
-
100
102
  # npcpy
101
103
 
102
104
  Welcome to `npcpy`, the core library of the NPC Toolkit that supercharges natural language processing pipelines and agent tooling. `npcpy` is a flexible framework for building state-of-the-art applications and conducting novel research with LLMs.
103
105
 
104
106
 
105
- <p align="center">
106
- <a href= "https://github.com/cagostino/npcpy/blob/main/docs/npcpy.md">
107
- <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
108
- </p>
109
107
 
110
108
 
111
109
  Here is an example for getting responses for a particular agent:
@@ -43,6 +43,7 @@ kuzu
43
43
  chromadb
44
44
  diffusers
45
45
  torch
46
+ datasets
46
47
  pyaudio
47
48
  gtts
48
49
  playsound==1.2.2
@@ -64,6 +65,7 @@ kuzu
64
65
  chromadb
65
66
  diffusers
66
67
  torch
68
+ datasets
67
69
 
68
70
  [yap]
69
71
  pyaudio
@@ -66,6 +66,7 @@ local_requirements = [
66
66
  "chromadb",
67
67
  "diffusers",
68
68
  "torch",
69
+ "datasets",
69
70
  ]
70
71
 
71
72
 
@@ -82,7 +83,7 @@ extra_files = package_files("npcpy/npc_team/")
82
83
 
83
84
  setup(
84
85
  name="npcpy",
85
- version="1.2.20",
86
+ version="1.2.21",
86
87
  packages=find_packages(exclude=["tests*"]),
87
88
  install_requires=base_requirements,
88
89
  extras_require={
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes