npcpy 1.3.20__py3-none-any.whl → 1.3.21__py3-none-any.whl

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/llm_funcs.py CHANGED
@@ -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
- system_message = get_system_message(run_npc, run_team) if run_npc is not None else "You are a helpful assistant."
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(
npcpy/npc_sysenv.py CHANGED
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.3.20
3
+ Version: 1.3.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
@@ -1,11 +1,11 @@
1
1
  npcpy/__init__.py,sha256=uJcJGjR1mWvE69GySNAufkgiRwJA28zdObDBWaxp0tY,505
2
2
  npcpy/build_funcs.py,sha256=vOz6pjV0zS-kYKo0ux-pn9AcppVaR8KIDi2ldOxb3RQ,7479
3
- npcpy/llm_funcs.py,sha256=ghi0y0qlngwc5BZLa-aiFpa0GT7qLe56UboI2dLu75U,75055
3
+ npcpy/llm_funcs.py,sha256=87aPFenz0a6FD2j5ig1rynmHGeBJC7xCs3HwEEgc_nc,75139
4
4
  npcpy/main.py,sha256=RWoRIj6VQLxKdOKvdVyaq2kwG35oRpeXPvp1CAAoG-w,81
5
5
  npcpy/ml_funcs.py,sha256=smgeOLnjxGWjmDngE-bcA2ozXX_IzY_7_pS9h2iocEg,24249
6
6
  npcpy/npc_array.py,sha256=5qjaA9KjmJ_Zk_VxLrCyVrj73aDXpm3iJf0ngq1yIJk,45721
7
7
  npcpy/npc_compiler.py,sha256=s_67cyvoao0UwUa4N-jrceWDadvBB9TWYpxcjNPfO18,121941
8
- npcpy/npc_sysenv.py,sha256=1E2zwMj7aPrtRJuJSowGkvNApi07Vue3FhXsipi1XDs,45251
8
+ npcpy/npc_sysenv.py,sha256=cjMkjSIucx4rZkMPZ9EMjMxwd455Sl0Sn0zzTkNL6rM,46545
9
9
  npcpy/npcs.py,sha256=eExuVsbTfrRobTRRptRpDm46jCLWUgbvy4_U7IUQo-c,744
10
10
  npcpy/serve.py,sha256=P71oa4eVvG0SePkOoeeQ44LkRAfnlgElxZi9GUVG7qg,280598
11
11
  npcpy/tools.py,sha256=A5_oVmZkzGnI3BI-NmneuxeXQq-r29PbpAZP4nV4jrc,5303
@@ -53,8 +53,8 @@ npcpy/work/browser.py,sha256=p2PeaoZdAXipFuAgKCCB3aXXLE_p3yIRqC87KlZKZWc,679
53
53
  npcpy/work/desktop.py,sha256=F3I8mUtJp6LAkXodsh8hGZIncoads6c_2Utty-0EdDA,2986
54
54
  npcpy/work/plan.py,sha256=QyUwg8vElWiHuoS-xK4jXTxxHvkMD3VkaCEsCmrEPQk,8300
55
55
  npcpy/work/trigger.py,sha256=P1Y8u1wQRsS2WACims_2IdkBEar-iBQix-2TDWoW0OM,9948
56
- npcpy-1.3.20.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
57
- npcpy-1.3.20.dist-info/METADATA,sha256=quc7U-oA3yF-Kp_lb9N-EReQCfcfO8YBBqp2pqrbnTU,37947
58
- npcpy-1.3.20.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
59
- npcpy-1.3.20.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
60
- npcpy-1.3.20.dist-info/RECORD,,
56
+ npcpy-1.3.21.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
57
+ npcpy-1.3.21.dist-info/METADATA,sha256=OJthZtnT23usrcUIlB9ZcG1DgrhVX0SYy1jBrl765so,37947
58
+ npcpy-1.3.21.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
59
+ npcpy-1.3.21.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
60
+ npcpy-1.3.21.dist-info/RECORD,,
File without changes