npcpy 1.2.18__tar.gz → 1.2.19__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 (67) hide show
  1. {npcpy-1.2.18/npcpy.egg-info → npcpy-1.2.19}/PKG-INFO +1 -1
  2. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/memory_trainer.py +3 -3
  3. npcpy-1.2.19/npcpy/memory/memory_processor.py +65 -0
  4. {npcpy-1.2.18 → npcpy-1.2.19/npcpy.egg-info}/PKG-INFO +1 -1
  5. {npcpy-1.2.18 → npcpy-1.2.19}/setup.py +1 -1
  6. npcpy-1.2.18/npcpy/memory/memory_processor.py +0 -155
  7. {npcpy-1.2.18 → npcpy-1.2.19}/LICENSE +0 -0
  8. {npcpy-1.2.18 → npcpy-1.2.19}/MANIFEST.in +0 -0
  9. {npcpy-1.2.18 → npcpy-1.2.19}/README.md +0 -0
  10. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/__init__.py +0 -0
  11. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/__init__.py +0 -0
  12. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/audio.py +0 -0
  13. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/data_models.py +0 -0
  14. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/image.py +0 -0
  15. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/load.py +0 -0
  16. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/text.py +0 -0
  17. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/video.py +0 -0
  18. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/data/web.py +0 -0
  19. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/__init__.py +0 -0
  20. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/diff.py +0 -0
  21. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/ge.py +0 -0
  22. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/rl.py +0 -0
  23. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/ft/sft.py +0 -0
  24. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/__init__.py +0 -0
  25. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/audio_gen.py +0 -0
  26. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/embeddings.py +0 -0
  27. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/image_gen.py +0 -0
  28. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/response.py +0 -0
  29. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/gen/video_gen.py +0 -0
  30. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/llm_funcs.py +0 -0
  31. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/main.py +0 -0
  32. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/memory/__init__.py +0 -0
  33. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/memory/command_history.py +0 -0
  34. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/memory/kg_vis.py +0 -0
  35. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/memory/knowledge_graph.py +0 -0
  36. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/memory/search.py +0 -0
  37. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/mix/__init__.py +0 -0
  38. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/mix/debate.py +0 -0
  39. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/npc_compiler.py +0 -0
  40. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/npc_sysenv.py +0 -0
  41. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/npcs.py +0 -0
  42. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/serve.py +0 -0
  43. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/sql/__init__.py +0 -0
  44. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/sql/model_runner.py +0 -0
  45. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/sql/npcsql.py +0 -0
  46. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/tools.py +0 -0
  47. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/work/__init__.py +0 -0
  48. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/work/desktop.py +0 -0
  49. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/work/plan.py +0 -0
  50. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy/work/trigger.py +0 -0
  51. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy.egg-info/SOURCES.txt +0 -0
  52. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy.egg-info/dependency_links.txt +0 -0
  53. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy.egg-info/requires.txt +0 -0
  54. {npcpy-1.2.18 → npcpy-1.2.19}/npcpy.egg-info/top_level.txt +0 -0
  55. {npcpy-1.2.18 → npcpy-1.2.19}/setup.cfg +0 -0
  56. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_audio.py +0 -0
  57. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_command_history.py +0 -0
  58. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_image.py +0 -0
  59. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_llm_funcs.py +0 -0
  60. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_load.py +0 -0
  61. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_npc_compiler.py +0 -0
  62. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_npcsql.py +0 -0
  63. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_response.py +0 -0
  64. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_serve.py +0 -0
  65. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_text.py +0 -0
  66. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_tools.py +0 -0
  67. {npcpy-1.2.18 → npcpy-1.2.19}/tests/test_web.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.2.18
3
+ Version: 1.2.19
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
@@ -1,8 +1,8 @@
1
- import torch
2
- import torch.nn as nn
3
1
  try:
4
- from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer, TrainingArguments
5
2
  from torch.utils.data import Dataset
3
+ import torch
4
+ import torch.nn as nn
5
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer, TrainingArguments
6
6
  except:
7
7
  pass
8
8
  import json
@@ -0,0 +1,65 @@
1
+ from dataclasses import dataclass
2
+ from typing import List, Dict, Any, Optional
3
+ from datetime import datetime
4
+ import threading
5
+ import queue
6
+ import time
7
+
8
+ @dataclass
9
+ class MemoryItem:
10
+ message_id: str
11
+ conversation_id: str
12
+ npc: str
13
+ team: str
14
+ directory_path: str
15
+ content: str
16
+ context: str
17
+ model: str
18
+ provider: str
19
+
20
+
21
+ def memory_approval_ui(memories: List[Dict]) -> List[Dict]:
22
+ """Simple CLI interface for memory approval"""
23
+ if not memories:
24
+ return []
25
+
26
+ print(f"\n📝 {len(memories)} memories ready for approval:")
27
+
28
+ approvals = []
29
+ for i, memory in enumerate(memories, 1):
30
+ print(f"\n--- Memory {i}/{len(memories)} ---")
31
+ print(f"NPC: {memory['npc']}")
32
+ print(f"Content: {memory['content'][:200]}{'...' if len(memory['content']) > 200 else ''}")
33
+
34
+ while True:
35
+ choice = input("(a)pprove, (r)eject, (e)dit, (s)kip, (q)uit, (A)pprove all: ").strip().lower()
36
+
37
+ if choice == 'a':
38
+ approvals.append({"memory_id": memory['memory_id'], "decision": "human-approved"})
39
+ break
40
+ elif choice == 'r':
41
+ approvals.append({"memory_id": memory['memory_id'], "decision": "human-rejected"})
42
+ break
43
+ elif choice == 'e':
44
+ edited = input("Edit memory: ").strip()
45
+ if edited:
46
+ approvals.append({
47
+ "memory_id": memory['memory_id'],
48
+ "decision": "human-edited",
49
+ "final_memory": edited
50
+ })
51
+ break
52
+ elif choice == 's':
53
+ break
54
+ elif choice == 'q':
55
+ return approvals
56
+ elif choice == 'A':
57
+
58
+ for remaining_memory in memories[i-1:]:
59
+ approvals.append({
60
+ "memory_id": remaining_memory['memory_id'],
61
+ "decision": "human-approved"
62
+ })
63
+ return approvals
64
+
65
+ return approvals
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.2.18
3
+ Version: 1.2.19
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
@@ -82,7 +82,7 @@ extra_files = package_files("npcpy/npc_team/")
82
82
 
83
83
  setup(
84
84
  name="npcpy",
85
- version="1.2.18",
85
+ version="1.2.19",
86
86
  packages=find_packages(exclude=["tests*"]),
87
87
  install_requires=base_requirements,
88
88
  extras_require={
@@ -1,155 +0,0 @@
1
- from dataclasses import dataclass
2
- from typing import List, Dict, Any, Optional
3
- from datetime import datetime
4
- import threading
5
- import queue
6
- import time
7
-
8
- @dataclass
9
- class MemoryItem:
10
- message_id: str
11
- conversation_id: str
12
- npc: str
13
- team: str
14
- directory_path: str
15
- content: str
16
- context: str
17
- model: str
18
- provider: str
19
-
20
- class MemoryApprovalQueue:
21
- def __init__(self, command_history):
22
- self.command_history = command_history
23
- self.pending_queue = queue.Queue()
24
- self.approval_results = queue.Queue()
25
- self.processing_thread = None
26
- self.running = False
27
-
28
- def add_memory(self, memory_item: MemoryItem):
29
- """Add memory to processing queue (non-blocking)"""
30
- self.pending_queue.put(memory_item)
31
-
32
- def start_background_processing(self):
33
- """Start background thread for memory processing"""
34
- if self.processing_thread and self.processing_thread.is_alive():
35
- return
36
-
37
- self.running = True
38
- self.processing_thread = threading.Thread(target=self._process_queue)
39
- self.processing_thread.daemon = True
40
- self.processing_thread.start()
41
-
42
- def _process_queue(self):
43
- """Background processing of memory queue"""
44
- while self.running:
45
- try:
46
-
47
- batch = []
48
- try:
49
-
50
- memory = self.pending_queue.get(timeout=1.0)
51
- batch.append(memory)
52
-
53
-
54
- while len(batch) < 10:
55
- try:
56
- memory = self.pending_queue.get_nowait()
57
- batch.append(memory)
58
- except queue.Empty:
59
- break
60
-
61
- self._process_memory_batch(batch)
62
-
63
- except queue.Empty:
64
- continue
65
-
66
- except Exception as e:
67
- print(f"Error in memory processing: {e}")
68
- time.sleep(1)
69
-
70
- def _process_memory_batch(self, memories: List[MemoryItem]):
71
- """Process a batch of memories"""
72
- for memory in memories:
73
-
74
- memory_id = self.command_history.add_memory_to_database(
75
- message_id=memory.message_id,
76
- conversation_id=memory.conversation_id,
77
- npc=memory.npc,
78
- team=memory.team,
79
- directory_path=memory.directory_path,
80
- initial_memory=memory.content,
81
- status="pending_approval",
82
- model=memory.model,
83
- provider=memory.provider
84
- )
85
-
86
-
87
- self.approval_results.put({
88
- "memory_id": memory_id,
89
- "content": memory.content,
90
- "context": memory.context,
91
- "npc": memory.npc
92
- })
93
-
94
- def get_approval_batch(self, max_items: int = 5) -> List[Dict]:
95
- """Get batch of memories ready for approval"""
96
- batch = []
97
- try:
98
- while len(batch) < max_items:
99
- item = self.approval_results.get_nowait()
100
- batch.append(item)
101
- except queue.Empty:
102
- pass
103
- return batch
104
-
105
- def stop_processing(self):
106
- """Stop background processing"""
107
- self.running = False
108
- if self.processing_thread:
109
- self.processing_thread.join(timeout=2.0)
110
-
111
- def memory_approval_ui(memories: List[Dict]) -> List[Dict]:
112
- """Simple CLI interface for memory approval"""
113
- if not memories:
114
- return []
115
-
116
- print(f"\n📝 {len(memories)} memories ready for approval:")
117
-
118
- approvals = []
119
- for i, memory in enumerate(memories, 1):
120
- print(f"\n--- Memory {i}/{len(memories)} ---")
121
- print(f"NPC: {memory['npc']}")
122
- print(f"Content: {memory['content'][:200]}{'...' if len(memory['content']) > 200 else ''}")
123
-
124
- while True:
125
- choice = input("(a)pprove, (r)eject, (e)dit, (s)kip, (q)uit, (A)pprove all: ").strip().lower()
126
-
127
- if choice == 'a':
128
- approvals.append({"memory_id": memory['memory_id'], "decision": "human-approved"})
129
- break
130
- elif choice == 'r':
131
- approvals.append({"memory_id": memory['memory_id'], "decision": "human-rejected"})
132
- break
133
- elif choice == 'e':
134
- edited = input("Edit memory: ").strip()
135
- if edited:
136
- approvals.append({
137
- "memory_id": memory['memory_id'],
138
- "decision": "human-edited",
139
- "final_memory": edited
140
- })
141
- break
142
- elif choice == 's':
143
- break
144
- elif choice == 'q':
145
- return approvals
146
- elif choice == 'A':
147
-
148
- for remaining_memory in memories[i-1:]:
149
- approvals.append({
150
- "memory_id": remaining_memory['memory_id'],
151
- "decision": "human-approved"
152
- })
153
- return approvals
154
-
155
- return approvals
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
File without changes
File without changes
File without changes