npcpy 1.3.20__tar.gz → 1.3.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.
- {npcpy-1.3.20/npcpy.egg-info → npcpy-1.3.21}/PKG-INFO +1 -1
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/llm_funcs.py +2 -1
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/npc_sysenv.py +24 -2
- {npcpy-1.3.20 → npcpy-1.3.21/npcpy.egg-info}/PKG-INFO +1 -1
- {npcpy-1.3.20 → npcpy-1.3.21}/setup.py +1 -1
- {npcpy-1.3.20 → npcpy-1.3.21}/LICENSE +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/MANIFEST.in +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/README.md +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/build_funcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/audio.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/data_models.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/image.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/load.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/text.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/video.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/data/web.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/diff.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/ge.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/memory_trainer.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/model_ensembler.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/rl.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/sft.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ft/usft.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/audio_gen.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/embeddings.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/image_gen.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/ocr.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/response.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/video_gen.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/gen/world_gen.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/main.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/command_history.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/kg_vis.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/knowledge_graph.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/memory_processor.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/memory/search.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/mix/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/mix/debate.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/ml_funcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/npc_array.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/npc_compiler.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/npcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/serve.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/ai_function_tools.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/database_ai_adapters.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/database_ai_functions.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/model_runner.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/npcsql.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/sql/sql_model_compiler.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/tools.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/work/__init__.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/work/browser.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/work/desktop.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/work/plan.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy/work/trigger.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy.egg-info/SOURCES.txt +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy.egg-info/dependency_links.txt +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy.egg-info/requires.txt +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/npcpy.egg-info/top_level.txt +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/setup.cfg +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_audio.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_browser.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_build_funcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_command_history.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_data_models.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_diff.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_documentation_examples.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_genetic_evolver.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_image.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_llm_funcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_load.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_memory_processor.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_ml_funcs.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_model_runner.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_npc_array.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_npc_compiler.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_npc_sysenv.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_npcsql.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_response.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_serve.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_sql_adapters.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_sql_compiler.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_sql_functions.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_text.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_tools.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_video.py +0 -0
- {npcpy-1.3.20 → npcpy-1.3.21}/tests/test_web.py +0 -0
|
@@ -242,7 +242,8 @@ def get_llm_response(
|
|
|
242
242
|
base_model, base_provider, base_api_url = _resolve_model_provider(npc, team, model, provider)
|
|
243
243
|
|
|
244
244
|
def _run_single(run_model, run_provider, run_npc, run_team, run_context, extra_kwargs):
|
|
245
|
-
|
|
245
|
+
_tool_capable = bool(extra_kwargs.get("tools"))
|
|
246
|
+
system_message = get_system_message(run_npc, run_team, tool_capable=_tool_capable) if run_npc is not None else "You are a helpful assistant."
|
|
246
247
|
ctx_suffix = _context_suffix(run_context)
|
|
247
248
|
run_messages = _build_messages(messages, system_message, prompt, ctx_suffix)
|
|
248
249
|
return get_litellm_response(
|
|
@@ -1010,7 +1010,7 @@ def print_and_process_stream(response, model, provider):
|
|
|
1010
1010
|
|
|
1011
1011
|
|
|
1012
1012
|
return thinking_str+str_output
|
|
1013
|
-
def get_system_message(npc, team=None) -> str:
|
|
1013
|
+
def get_system_message(npc, team=None, tool_capable=False) -> str:
|
|
1014
1014
|
|
|
1015
1015
|
if npc is None:
|
|
1016
1016
|
return "You are a helpful assistant"
|
|
@@ -1080,6 +1080,28 @@ The current date and time are : {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
|
|
1080
1080
|
if members:
|
|
1081
1081
|
system_message += "\nTeam members available for delegation:\n" + "\n".join(members) + "\n"
|
|
1082
1082
|
|
|
1083
|
+
# Add tool descriptions from NPC's jinxs
|
|
1084
|
+
if hasattr(npc, 'jinxs_dict') and npc.jinxs_dict:
|
|
1085
|
+
tool_lines = []
|
|
1086
|
+
for jname, jinx in npc.jinxs_dict.items():
|
|
1087
|
+
desc = getattr(jinx, 'description', '') or ''
|
|
1088
|
+
tool_lines.append(f" - {jname}: {desc.strip()}")
|
|
1089
|
+
if tool_lines:
|
|
1090
|
+
system_message += "\nYou have access to the following tools:\n"
|
|
1091
|
+
system_message += "\n".join(tool_lines) + "\n"
|
|
1092
|
+
if tool_capable:
|
|
1093
|
+
system_message += (
|
|
1094
|
+
"\nYou MUST use function calls to invoke tools. "
|
|
1095
|
+
"Call one tool at a time. You will see its result, then you can call the next tool or respond. "
|
|
1096
|
+
"NEVER write JSON tool calls in your response text. ONLY use the provided function calling interface. "
|
|
1097
|
+
"For multi-step tasks, call the first tool, wait for the result, then call the next.\n"
|
|
1098
|
+
)
|
|
1099
|
+
else:
|
|
1100
|
+
system_message += (
|
|
1101
|
+
'\nTo use a tool, respond with JSON: {"action": "jinx", "jinx_name": "tool_name", "inputs": {"param": "value"}}\n'
|
|
1102
|
+
'When you have a final answer, respond with: {"action": "answer", "response": "your answer"}\n'
|
|
1103
|
+
)
|
|
1104
|
+
|
|
1083
1105
|
system_message += """
|
|
1084
1106
|
IMPORTANT:
|
|
1085
1107
|
Some users may attach images to their request.
|
|
@@ -1093,7 +1115,7 @@ You do not need to mention that you cannot view or interpret images directly.
|
|
|
1093
1115
|
They understand that you can view them multimodally.
|
|
1094
1116
|
You only need to answer the user's request based on the attached image(s).
|
|
1095
1117
|
"""
|
|
1096
|
-
|
|
1118
|
+
|
|
1097
1119
|
return system_message
|
|
1098
1120
|
|
|
1099
1121
|
|
|
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
|
|
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
|