npcpy 1.2.13__py3-none-any.whl → 1.2.15__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/gen/response.py CHANGED
@@ -14,6 +14,7 @@ except OSError:
14
14
 
15
15
  print("Ollama is not installed or not available. Please install it to use this feature.")
16
16
  try:
17
+ import litellm
17
18
  from litellm import completion
18
19
  except ImportError:
19
20
  pass
@@ -413,6 +414,7 @@ def get_litellm_response(
413
414
  stream: bool = False,
414
415
  attachments: List[str] = None,
415
416
  auto_process_tool_calls: bool = False,
417
+ include_usage: bool = False,
416
418
  **kwargs,
417
419
  ) -> Dict[str, Any]:
418
420
  result = {
@@ -547,6 +549,10 @@ def get_litellm_response(
547
549
 
548
550
  api_params = {"messages": result["messages"]}
549
551
 
552
+ if include_usage:
553
+ litellm.include_cost_in_streaming_usage = True
554
+ api_params['stream_options'] = {"include_usage": True}
555
+
550
556
  if api_url is not None and (provider == "openai-like" or provider == "openai"):
551
557
  api_params["api_base"] = api_url
552
558
  provider = "openai"
npcpy/llm_funcs.py CHANGED
@@ -154,6 +154,7 @@ def get_llm_response(
154
154
  context=None,
155
155
  stream: bool = False,
156
156
  attachments: List[str] = None,
157
+ include_usage: bool = False,
157
158
  **kwargs,
158
159
  ):
159
160
  """This function generates a response using the specified provider and model.
@@ -231,6 +232,7 @@ def get_llm_response(
231
232
  images=images,
232
233
  attachments=attachments,
233
234
  stream=stream,
235
+ include_usage=include_usage,
234
236
  **kwargs,
235
237
  )
236
238
  return response
npcpy/serve.py CHANGED
@@ -1778,6 +1778,7 @@ def stream():
1778
1778
 
1779
1779
  try:
1780
1780
  from npcsh.corca import execute_command_corca, create_corca_state_and_mcp_client, MCPClientNPC
1781
+ from npcsh._state import initial_state as state
1781
1782
  except ImportError:
1782
1783
 
1783
1784
  print("ERROR: npcsh.corca or MCPClientNPC not found. Corca mode is disabled.", file=sys.stderr)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npcpy
3
- Version: 1.2.13
3
+ Version: 1.2.15
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,10 +1,10 @@
1
1
  npcpy/__init__.py,sha256=9imxFtK74_6Rw9rz0kyMnZYl_voPb569tkTlYLt0Urg,131
2
- npcpy/llm_funcs.py,sha256=bcMOTfVcBqRgHvBV2JxUtChgT1wMWoHhXVFYOlxGDFY,85031
2
+ npcpy/llm_funcs.py,sha256=tvcZuQEcIUJClwEJQXBF6ArEVjSuXt1jAcZOcnYWsVQ,85101
3
3
  npcpy/main.py,sha256=RWoRIj6VQLxKdOKvdVyaq2kwG35oRpeXPvp1CAAoG-w,81
4
4
  npcpy/npc_compiler.py,sha256=Yiv4xWsuQvPX5oeFh0z9snguiyx4Ul16KfUyjPWt7uI,86462
5
5
  npcpy/npc_sysenv.py,sha256=lPYlKM_TeR4l4-Jcgiqq3CCge8b2oFHdfISD4L_G7eo,30308
6
6
  npcpy/npcs.py,sha256=eExuVsbTfrRobTRRptRpDm46jCLWUgbvy4_U7IUQo-c,744
7
- npcpy/serve.py,sha256=QYks3pwTeNH-JyGz6AEK5sGhza6cHzd_lgHkoJ4gdgY,98283
7
+ npcpy/serve.py,sha256=tyOQ_YWNOVJl5NkbEshcIbpBCR1wohHVg9JtPYEKuMI,98343
8
8
  npcpy/tools.py,sha256=A5_oVmZkzGnI3BI-NmneuxeXQq-r29PbpAZP4nV4jrc,5303
9
9
  npcpy/data/__init__.py,sha256=1tcoChR-Hjn905JDLqaW9ElRmcISCTJdE7BGXPlym2Q,642
10
10
  npcpy/data/audio.py,sha256=goon4HfsYgx0bI-n1lhkrzWPrJoejJlycXcB0P62pyk,11280
@@ -18,7 +18,7 @@ npcpy/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  npcpy/gen/audio_gen.py,sha256=w4toESu7nmli1T5FOwRRCGC_QK9W-SMWknYYkbRv9jE,635
19
19
  npcpy/gen/embeddings.py,sha256=QStTJ2ELiC379OEZsLEgGGIIFD267Y8zQchs7HRn2Zg,2089
20
20
  npcpy/gen/image_gen.py,sha256=ln71jmLoJHekbZYDJpTe5DtOamVte9gjr2BPQ1DzjMQ,14955
21
- npcpy/gen/response.py,sha256=xm4wksuPTyNszN8DhxpOWDD6waUqsOgTrXFDL3wMqSo,28765
21
+ npcpy/gen/response.py,sha256=Rrk3rrSSGode94JJkKyL4n9Dpw9CH7R5l9xyjQSDFxE,28954
22
22
  npcpy/gen/video_gen.py,sha256=JMp2s2qMp5uy0rOgv6BRZ7nkQI4vdT1hbJ2nSu4s-KA,3243
23
23
  npcpy/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  npcpy/memory/command_history.py,sha256=DzwUpXxtswdUXImszlV1TppMMd_aCP01oaeZEjGKk04,39812
@@ -34,8 +34,8 @@ npcpy/work/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  npcpy/work/desktop.py,sha256=F3I8mUtJp6LAkXodsh8hGZIncoads6c_2Utty-0EdDA,2986
35
35
  npcpy/work/plan.py,sha256=QyUwg8vElWiHuoS-xK4jXTxxHvkMD3VkaCEsCmrEPQk,8300
36
36
  npcpy/work/trigger.py,sha256=P1Y8u1wQRsS2WACims_2IdkBEar-iBQix-2TDWoW0OM,9948
37
- npcpy-1.2.13.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
38
- npcpy-1.2.13.dist-info/METADATA,sha256=WOXXfLOW09OWhfpwyQE4knWu1rM6JkXLfxd0Co3CkNk,26084
39
- npcpy-1.2.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- npcpy-1.2.13.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
41
- npcpy-1.2.13.dist-info/RECORD,,
37
+ npcpy-1.2.15.dist-info/licenses/LICENSE,sha256=j0YPvce7Ng9e32zYOu0EmXjXeJ0Nwawd0RA3uSGGH4E,1070
38
+ npcpy-1.2.15.dist-info/METADATA,sha256=4MQ3tSRBtBHQzszAGo5AXnP6YuuXlvxkrwwijA4Qc0A,26084
39
+ npcpy-1.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ npcpy-1.2.15.dist-info/top_level.txt,sha256=g1pbSvrOOncB74Bg5-J0Olg4V0A5VzDw-Xz5YObq8BU,6
41
+ npcpy-1.2.15.dist-info/RECORD,,
File without changes