The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more.
# Add to your Claude Code skills
git clone https://github.com/NPC-Worldwide/npcpynpcpy 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.
pip install npcpy
from npcpy.npc_compiler import NPC
simon = NPC(
name='Simon Bolivar',
primary_directive='Liberate South America from the Spanish Royalists.',
model='gemma3:4b',
provider='ollama'
)
response = simon.get_llm_response("What is the most important territory to retain in the Andes?")
print(response['response'])
from npcpy.llm_funcs import get_llm_response
response = get_llm_response("Who was the celtic messenger god?", model='qwen3:4b', provider='ollama')
print(response['response'])
import os
from npcpy.npc_compiler import NPC
def list_files(directory: str = ".") -> list:
"""List all files in a directory."""
return os.listdir(directory)
def read_file(filepath: str) -> str:
"""Read and return the contents of a file."""
with open(filepath, 'r') as f:
return f.read()
assistant = NPC(
name='File Assistant',
primary_directive='You help users explore files.',
model='llama3.2',
provider='ollama',
tools=[list_files, read_file],
)
response = assistant.get_llm_response("List the files in the current directory.")
print(response['response'])
# Access individual tool results
for result in response.get('tool_results', []):
print(f"{result['tool_name']}: {result['result']}")
No comments yet. Be the first to share your thoughts!
from npcpy.llm_funcs import get_llm_response
response = get_llm_response(
"Tell me about the history of the Inca Empire.",
model='llama3.2',
provider='ollama',
stream=True
)
for chunk in response['response']:
msg = chunk.get('message', {})
print(msg.get('content', ''), end='', flush=True)
from npcpy.llm_funcs import get_llm_response
response = get_llm_response(
"List 3 planets with their distances from the sun in AU.",
model='llama3.2',
provider='ollama',
format='json'
)
print(response['response'])
from npcpy.npc_compiler import NPC, Team
# Create specialist agents
coordinator = NPC(
name='coordinator',
primary_directive='''You coordinate a team of specialists.
Delegate tasks by mentioning @analyst for data questions or @writer for content.
Synthesize their responses into a final answer.''',
model='llama3.2',
provider='ollama'
)
analyst = NPC(
name='analyst',
primary_directive='You analyze data and provide insights with specific numbers....