npcpy 1.3.22__tar.gz → 1.3.23__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 (97) hide show
  1. npcpy-1.3.23/PKG-INFO +416 -0
  2. npcpy-1.3.23/README.md +316 -0
  3. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/image.py +15 -15
  4. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/web.py +2 -2
  5. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/image_gen.py +113 -62
  6. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/response.py +239 -0
  7. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/llm_funcs.py +73 -71
  8. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/command_history.py +117 -69
  9. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/kg_vis.py +74 -74
  10. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/npc_compiler.py +261 -26
  11. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/npc_sysenv.py +4 -1
  12. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/serve.py +393 -91
  13. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/work/desktop.py +31 -5
  14. npcpy-1.3.23/npcpy.egg-info/PKG-INFO +416 -0
  15. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy.egg-info/SOURCES.txt +1 -0
  16. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy.egg-info/requires.txt +2 -0
  17. {npcpy-1.3.22 → npcpy-1.3.23}/setup.py +4 -3
  18. npcpy-1.3.23/tests/test_airllm.py +38 -0
  19. npcpy-1.3.22/PKG-INFO +0 -1039
  20. npcpy-1.3.22/README.md +0 -941
  21. npcpy-1.3.22/npcpy.egg-info/PKG-INFO +0 -1039
  22. {npcpy-1.3.22 → npcpy-1.3.23}/LICENSE +0 -0
  23. {npcpy-1.3.22 → npcpy-1.3.23}/MANIFEST.in +0 -0
  24. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/__init__.py +0 -0
  25. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/build_funcs.py +0 -0
  26. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/__init__.py +0 -0
  27. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/audio.py +0 -0
  28. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/data_models.py +0 -0
  29. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/load.py +0 -0
  30. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/text.py +0 -0
  31. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/data/video.py +0 -0
  32. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/__init__.py +0 -0
  33. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/diff.py +0 -0
  34. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/ge.py +0 -0
  35. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/memory_trainer.py +0 -0
  36. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/model_ensembler.py +0 -0
  37. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/rl.py +0 -0
  38. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/sft.py +0 -0
  39. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ft/usft.py +0 -0
  40. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/__init__.py +0 -0
  41. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/audio_gen.py +0 -0
  42. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/embeddings.py +0 -0
  43. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/ocr.py +0 -0
  44. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/video_gen.py +0 -0
  45. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/gen/world_gen.py +0 -0
  46. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/main.py +0 -0
  47. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/__init__.py +0 -0
  48. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/knowledge_graph.py +0 -0
  49. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/memory_processor.py +0 -0
  50. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/memory/search.py +0 -0
  51. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/mix/__init__.py +0 -0
  52. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/mix/debate.py +0 -0
  53. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/ml_funcs.py +0 -0
  54. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/npc_array.py +0 -0
  55. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/npcs.py +0 -0
  56. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/__init__.py +0 -0
  57. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/ai_function_tools.py +0 -0
  58. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/database_ai_adapters.py +0 -0
  59. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/database_ai_functions.py +0 -0
  60. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/model_runner.py +0 -0
  61. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/npcsql.py +0 -0
  62. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/sql/sql_model_compiler.py +0 -0
  63. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/tools.py +0 -0
  64. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/work/__init__.py +0 -0
  65. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/work/browser.py +0 -0
  66. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/work/plan.py +0 -0
  67. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy/work/trigger.py +0 -0
  68. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy.egg-info/dependency_links.txt +0 -0
  69. {npcpy-1.3.22 → npcpy-1.3.23}/npcpy.egg-info/top_level.txt +0 -0
  70. {npcpy-1.3.22 → npcpy-1.3.23}/setup.cfg +0 -0
  71. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_audio.py +0 -0
  72. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_browser.py +0 -0
  73. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_build_funcs.py +0 -0
  74. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_command_history.py +0 -0
  75. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_data_models.py +0 -0
  76. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_diff.py +0 -0
  77. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_documentation_examples.py +0 -0
  78. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_genetic_evolver.py +0 -0
  79. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_image.py +0 -0
  80. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_llm_funcs.py +0 -0
  81. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_load.py +0 -0
  82. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_memory_processor.py +0 -0
  83. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_ml_funcs.py +0 -0
  84. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_model_runner.py +0 -0
  85. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_npc_array.py +0 -0
  86. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_npc_compiler.py +0 -0
  87. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_npc_sysenv.py +0 -0
  88. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_npcsql.py +0 -0
  89. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_response.py +0 -0
  90. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_serve.py +0 -0
  91. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_sql_adapters.py +0 -0
  92. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_sql_compiler.py +0 -0
  93. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_sql_functions.py +0 -0
  94. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_text.py +0 -0
  95. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_tools.py +0 -0
  96. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_video.py +0 -0
  97. {npcpy-1.3.22 → npcpy-1.3.23}/tests/test_web.py +0 -0
npcpy-1.3.23/PKG-INFO ADDED
@@ -0,0 +1,416 @@
1
+ Metadata-Version: 2.4
2
+ Name: npcpy
3
+ Version: 1.3.23
4
+ Summary: npcpy is the premier open-source library for integrating LLMs and Agents into python systems.
5
+ Home-page: https://github.com/NPC-Worldwide/npcpy
6
+ Author: Christopher Agostino
7
+ Author-email: info@npcworldwi.de
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: jinja2
14
+ Requires-Dist: litellm
15
+ Requires-Dist: scipy
16
+ Requires-Dist: numpy
17
+ Requires-Dist: requests
18
+ Requires-Dist: docx
19
+ Requires-Dist: exa-py
20
+ Requires-Dist: elevenlabs
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: markdown
23
+ Requires-Dist: networkx
24
+ Requires-Dist: PyYAML
25
+ Requires-Dist: PyMuPDF
26
+ Requires-Dist: pyautogui
27
+ Requires-Dist: pydantic
28
+ Requires-Dist: pygments
29
+ Requires-Dist: sqlalchemy
30
+ Requires-Dist: termcolor
31
+ Requires-Dist: rich
32
+ Requires-Dist: colorama
33
+ Requires-Dist: docstring_parser
34
+ Requires-Dist: Pillow
35
+ Requires-Dist: python-dotenv
36
+ Requires-Dist: pandas
37
+ Requires-Dist: beautifulsoup4
38
+ Requires-Dist: duckduckgo-search
39
+ Requires-Dist: flask
40
+ Requires-Dist: flask_cors
41
+ Requires-Dist: redis
42
+ Requires-Dist: psycopg2-binary
43
+ Requires-Dist: flask_sse
44
+ Requires-Dist: mcp
45
+ Provides-Extra: lite
46
+ Requires-Dist: anthropic; extra == "lite"
47
+ Requires-Dist: openai; extra == "lite"
48
+ Requires-Dist: ollama; extra == "lite"
49
+ Requires-Dist: google-generativeai; extra == "lite"
50
+ Requires-Dist: google-genai; extra == "lite"
51
+ Provides-Extra: local
52
+ Requires-Dist: sentence_transformers; extra == "local"
53
+ Requires-Dist: opencv-python; extra == "local"
54
+ Requires-Dist: ollama; extra == "local"
55
+ Requires-Dist: kuzu; extra == "local"
56
+ Requires-Dist: chromadb; extra == "local"
57
+ Requires-Dist: diffusers; extra == "local"
58
+ Requires-Dist: torch; extra == "local"
59
+ Requires-Dist: datasets; extra == "local"
60
+ Requires-Dist: airllm; extra == "local"
61
+ Provides-Extra: yap
62
+ Requires-Dist: pyaudio; extra == "yap"
63
+ Requires-Dist: gtts; extra == "yap"
64
+ Requires-Dist: playsound==1.2.2; extra == "yap"
65
+ Requires-Dist: pygame; extra == "yap"
66
+ Requires-Dist: faster_whisper; extra == "yap"
67
+ Requires-Dist: pyttsx3; extra == "yap"
68
+ Provides-Extra: all
69
+ Requires-Dist: anthropic; extra == "all"
70
+ Requires-Dist: openai; extra == "all"
71
+ Requires-Dist: ollama; extra == "all"
72
+ Requires-Dist: google-generativeai; extra == "all"
73
+ Requires-Dist: google-genai; extra == "all"
74
+ Requires-Dist: sentence_transformers; extra == "all"
75
+ Requires-Dist: opencv-python; extra == "all"
76
+ Requires-Dist: ollama; extra == "all"
77
+ Requires-Dist: kuzu; extra == "all"
78
+ Requires-Dist: chromadb; extra == "all"
79
+ Requires-Dist: diffusers; extra == "all"
80
+ Requires-Dist: torch; extra == "all"
81
+ Requires-Dist: datasets; extra == "all"
82
+ Requires-Dist: airllm; extra == "all"
83
+ Requires-Dist: pyaudio; extra == "all"
84
+ Requires-Dist: gtts; extra == "all"
85
+ Requires-Dist: playsound==1.2.2; extra == "all"
86
+ Requires-Dist: pygame; extra == "all"
87
+ Requires-Dist: faster_whisper; extra == "all"
88
+ Requires-Dist: pyttsx3; extra == "all"
89
+ Dynamic: author
90
+ Dynamic: author-email
91
+ Dynamic: classifier
92
+ Dynamic: description
93
+ Dynamic: description-content-type
94
+ Dynamic: home-page
95
+ Dynamic: license-file
96
+ Dynamic: provides-extra
97
+ Dynamic: requires-dist
98
+ Dynamic: requires-python
99
+ Dynamic: summary
100
+
101
+ <p align="center">
102
+ <a href="https://npcpy.readthedocs.io/">
103
+ <img src="https://raw.githubusercontent.com/cagostino/npcpy/main/npcpy/npc-python.png" alt="npc-python logo" width=250></a>
104
+ </p>
105
+
106
+ # npcpy
107
+
108
+ `npcpy` is a flexible agent framework for building AI applications and conducting research with LLMs. It supports local and cloud providers, multi-agent teams, tool calling, image/audio/video generation, knowledge graphs, fine-tuning, and more.
109
+
110
+ ```bash
111
+ pip install npcpy
112
+ ```
113
+
114
+ ## Quick Examples
115
+
116
+ ### Agent with persona
117
+
118
+ ```python
119
+ from npcpy.npc_compiler import NPC
120
+
121
+ simon = NPC(
122
+ name='Simon Bolivar',
123
+ primary_directive='Liberate South America from the Spanish Royalists.',
124
+ model='gemma3:4b',
125
+ provider='ollama'
126
+ )
127
+ response = simon.get_llm_response("What is the most important territory to retain in the Andes?")
128
+ print(response['response'])
129
+ ```
130
+
131
+ ### Direct LLM call
132
+
133
+ ```python
134
+ from npcpy.llm_funcs import get_llm_response
135
+
136
+ response = get_llm_response("Who was the celtic messenger god?", model='qwen3:4b', provider='ollama')
137
+ print(response['response'])
138
+ ```
139
+
140
+ ### Agent with tools
141
+
142
+ ```python
143
+ import os
144
+ from npcpy.npc_compiler import NPC
145
+
146
+ def list_files(directory: str = ".") -> list:
147
+ """List all files in a directory."""
148
+ return os.listdir(directory)
149
+
150
+ def read_file(filepath: str) -> str:
151
+ """Read and return the contents of a file."""
152
+ with open(filepath, 'r') as f:
153
+ return f.read()
154
+
155
+ assistant = NPC(
156
+ name='File Assistant',
157
+ primary_directive='You help users explore files.',
158
+ model='llama3.2',
159
+ provider='ollama',
160
+ tools=[list_files, read_file],
161
+ )
162
+ response = assistant.get_llm_response("List the files in the current directory.")
163
+ print(response['response'])
164
+ ```
165
+
166
+ ### Multi-agent team orchestration
167
+
168
+ ```python
169
+ from npcpy.npc_compiler import NPC, Team
170
+
171
+ # Create specialist agents
172
+ coordinator = NPC(
173
+ name='coordinator',
174
+ primary_directive='''You coordinate a team of specialists.
175
+ Delegate tasks by mentioning @analyst for data questions or @writer for content.
176
+ Synthesize their responses into a final answer.''',
177
+ model='llama3.2',
178
+ provider='ollama'
179
+ )
180
+
181
+ analyst = NPC(
182
+ name='analyst',
183
+ primary_directive='You analyze data and provide insights with specific numbers.',
184
+ model='~/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf', # local GGUF file
185
+ provider='llamacpp'
186
+ )
187
+
188
+ writer = NPC(
189
+ name='writer',
190
+ primary_directive='You write clear, engaging summaries and reports.',
191
+ model='gemini-2.5-flash',
192
+ provider='gemini'
193
+ )
194
+
195
+ # Create team - coordinator (forenpc) automatically delegates via @mentions
196
+ team = Team(npcs=[coordinator, analyst, writer], forenpc='coordinator')
197
+
198
+ # Orchestrate a request - coordinator decides who to involve
199
+ result = team.orchestrate("What are the trends in renewable energy adoption?")
200
+ print(result['output'])
201
+ ```
202
+
203
+ ### Team from directory
204
+
205
+ ```python
206
+ from npcpy.npc_compiler import Team
207
+
208
+ # Load team from directory with .npc files and team.ctx
209
+ team = Team(team_path='./npc_team')
210
+
211
+ # Orchestrate through the forenpc (set in team.ctx)
212
+ result = team.orchestrate("Analyze the sales data and write a summary")
213
+ print(result['output'])
214
+ ```
215
+
216
+ ### Team directory structure
217
+
218
+ ```
219
+ npc_team/
220
+ ├── team.ctx # Team configuration
221
+ ├── coordinator.npc # Coordinator agent
222
+ ├── analyst.npc # Specialist agent
223
+ ├── writer.npc # Specialist agent
224
+ └── jinxs/ # Optional workflows
225
+ └── research.jinx
226
+ ```
227
+
228
+ **team.ctx** - Team configuration:
229
+ ```yaml
230
+ context: |
231
+ A research team that analyzes topics and produces reports.
232
+ The coordinator delegates to specialists as needed.
233
+ forenpc: coordinator
234
+ model: llama3.2
235
+ provider: ollama
236
+ mcp_servers:
237
+ - ~/.npcsh/mcp_server.py
238
+ ```
239
+
240
+ **coordinator.npc** - Agent definition:
241
+ ```yaml
242
+ name: coordinator
243
+ primary_directive: |
244
+ You coordinate research tasks. Delegate to @analyst for data
245
+ analysis and @writer for content creation. Synthesize results.
246
+ model: llama3.2
247
+ provider: ollama
248
+ ```
249
+
250
+ **analyst.npc** - Specialist agent:
251
+ ```yaml
252
+ name: analyst
253
+ primary_directive: |
254
+ You analyze data and provide insights with specific numbers and trends.
255
+ model: qwen3:8b
256
+ provider: ollama
257
+ ```
258
+
259
+ ### Initialize a team
260
+
261
+ Installing `npcpy` also installs two command-line tools:
262
+ - **`npc`** — CLI for project management and one-off commands
263
+ - **`npcsh`** — Interactive shell for chatting with agents and running jinxs
264
+
265
+ ```bash
266
+ # Using npc CLI
267
+ npc init ./my_project
268
+
269
+ # Using npcsh (interactive)
270
+ npcsh
271
+ 📁 ~/projects
272
+ 🤖 npcsh | llama3.2
273
+ > /init directory=./my_project
274
+ > what files are in the current directory?
275
+ ```
276
+
277
+ This creates:
278
+ ```
279
+ my_project/
280
+ ├── npc_team/
281
+ │ ├── forenpc.npc # Default coordinator
282
+ │ ├── jinxs/ # Workflows
283
+ │ │ └── skills/ # Knowledge skills
284
+ │ ├── tools/ # Custom tools
285
+ │ └── triggers/ # Event triggers
286
+ ├── images/
287
+ ├── models/
288
+ └── mcp_servers/
289
+ ```
290
+
291
+ Then add your agents:
292
+ ```bash
293
+ # Add team context
294
+ cat > my_project/npc_team/team.ctx << 'EOF'
295
+ context: Research and analysis team
296
+ forenpc: lead
297
+ model: llama3.2
298
+ provider: ollama
299
+ EOF
300
+
301
+ # Add agents
302
+ cat > my_project/npc_team/lead.npc << 'EOF'
303
+ name: lead
304
+ primary_directive: |
305
+ You lead the team. Delegate to @researcher for data
306
+ and @writer for content. Synthesize their output.
307
+ EOF
308
+
309
+ cat > my_project/npc_team/researcher.npc << 'EOF'
310
+ name: researcher
311
+ primary_directive: You research topics and provide detailed findings.
312
+ model: gemini-2.5-flash
313
+ provider: gemini
314
+ EOF
315
+
316
+ cat > my_project/npc_team/writer.npc << 'EOF'
317
+ name: writer
318
+ primary_directive: You write clear, engaging content.
319
+ model: qwen3:8b
320
+ provider: ollama
321
+ EOF
322
+ ```
323
+
324
+ ## Features
325
+
326
+ - **[Agents (NPCs)](https://npcpy.readthedocs.io/en/latest/guides/agents/)** — Agents with personas, directives, and tool calling
327
+ - **[Multi-Agent Teams](https://npcpy.readthedocs.io/en/latest/guides/teams/)** — Team orchestration with a coordinator (forenpc)
328
+ - **[Jinx Workflows](https://npcpy.readthedocs.io/en/latest/guides/jinx-workflows/)** — Jinja Execution templates for multi-step prompt pipelines
329
+ - **[Skills](https://npcpy.readthedocs.io/en/latest/guides/skills/)** — Knowledge-content jinxs that serve instructional sections to agents on demand
330
+ - **[NPCArray](https://npcpy.readthedocs.io/en/latest/guides/npc-array/)** — NumPy-like vectorized operations over model populations
331
+ - **[Image, Audio & Video](https://npcpy.readthedocs.io/en/latest/guides/image-audio-video/)** — Generation via Ollama, diffusers, OpenAI, Gemini
332
+ - **[Knowledge Graphs](https://npcpy.readthedocs.io/en/latest/guides/knowledge-graphs/)** — Build and evolve knowledge graphs from text
333
+ - **[Fine-Tuning & Evolution](https://npcpy.readthedocs.io/en/latest/guides/fine-tuning/)** — SFT, RL, diffusion, genetic algorithms
334
+ - **[Serving](https://npcpy.readthedocs.io/en/latest/guides/serving/)** — Flask server for deploying teams via REST API
335
+ - **[ML Functions](https://npcpy.readthedocs.io/en/latest/guides/ml-funcs/)** — Scikit-learn grid search, ensemble prediction, PyTorch training
336
+ - **[Streaming & JSON](https://npcpy.readthedocs.io/en/latest/guides/llm-responses/)** — Streaming responses, structured JSON output, message history
337
+
338
+ ## Providers
339
+
340
+ Works with all major LLM providers through LiteLLM: `ollama`, `openai`, `anthropic`, `gemini`, `deepseek`, `airllm`, `openai-like`, and more.
341
+
342
+ ## Installation
343
+
344
+ ```bash
345
+ pip install npcpy # base
346
+ pip install npcpy[lite] # + API provider libraries
347
+ pip install npcpy[local] # + ollama, diffusers, transformers, airllm
348
+ pip install npcpy[yap] # + TTS/STT
349
+ pip install npcpy[all] # everything
350
+ ```
351
+
352
+ <details><summary>System dependencies</summary>
353
+
354
+ **Linux:**
355
+ ```bash
356
+ sudo apt-get install espeak portaudio19-dev python3-pyaudio ffmpeg libcairo2-dev libgirepository1.0-dev
357
+ curl -fsSL https://ollama.com/install.sh | sh
358
+ ollama pull llama3.2
359
+ ```
360
+
361
+ **macOS:**
362
+ ```bash
363
+ brew install portaudio ffmpeg pygobject3 ollama
364
+ brew services start ollama
365
+ ollama pull llama3.2
366
+ ```
367
+
368
+ **Windows:** Install [Ollama](https://ollama.com) and [ffmpeg](https://ffmpeg.org), then `ollama pull llama3.2`.
369
+
370
+ </details>
371
+
372
+ API keys go in a `.env` file:
373
+ ```bash
374
+ export OPENAI_API_KEY="your_key"
375
+ export ANTHROPIC_API_KEY="your_key"
376
+ export GEMINI_API_KEY="your_key"
377
+ ```
378
+
379
+ ## Read the Docs
380
+
381
+ Full documentation, guides, and API reference at [npcpy.readthedocs.io](https://npcpy.readthedocs.io/en/latest/).
382
+
383
+ ## Inference Capabilities
384
+
385
+ - Local and cloud LLM providers through LiteLLM (Ollama, OpenAI, Anthropic, Gemini, Deepseek, and more)
386
+ - AirLLM for 70B+ parameter models on consumer hardware (MLX on macOS, CUDA with 4-bit compression on Linux)
387
+ - Image generation through Ollama (`x/z-image-turbo`, `x/flux2-klein`), Huggingface diffusers, OpenAI (DALL-E, GPT Image), and Gemini
388
+
389
+ ## Links
390
+
391
+ - **[Incognide](https://github.com/cagostino/incognide)** — GUI for the NPC Toolkit ([download](https://enpisi.com/incognide))
392
+ - **[NPC Shell](https://github.com/npc-worldwide/npcsh)** — Command-line shell for interacting with NPCs
393
+ - **[Newsletter](https://forms.gle/n1NzQmwjsV4xv1B2A)** — Stay in the loop
394
+
395
+ ## Research
396
+
397
+ - Quantum-like nature of natural language interpretation: [arxiv](https://arxiv.org/abs/2506.10077), accepted at [QNLP 2025](https://qnlp.ai)
398
+ - Simulating hormonal cycles for AI: [arxiv](https://arxiv.org/abs/2508.11829)
399
+
400
+ Has your research benefited from npcpy? Let us know!
401
+
402
+ ## Support
403
+
404
+ [Monthly donation](https://buymeacoffee.com/npcworldwide) | [Merch](https://enpisi.com/shop) | Consulting: info@npcworldwi.de
405
+
406
+ ## Contributing
407
+
408
+ Contributions welcome! Submit issues and pull requests on the [GitHub repository](https://github.com/NPC-Worldwide/npcpy).
409
+
410
+ ## License
411
+
412
+ MIT License.
413
+
414
+ ## Star History
415
+
416
+ [![Star History Chart](https://api.star-history.com/svg?repos=cagostino/npcpy&type=Date)](https://star-history.com/#cagostino/npcpy&Date)