npcpy 1.2.14__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 +6 -0
- npcpy/llm_funcs.py +2 -0
- {npcpy-1.2.14.dist-info → npcpy-1.2.15.dist-info}/METADATA +1 -1
- {npcpy-1.2.14.dist-info → npcpy-1.2.15.dist-info}/RECORD +7 -7
- {npcpy-1.2.14.dist-info → npcpy-1.2.15.dist-info}/WHEEL +0 -0
- {npcpy-1.2.14.dist-info → npcpy-1.2.15.dist-info}/licenses/LICENSE +0 -0
- {npcpy-1.2.14.dist-info → npcpy-1.2.15.dist-info}/top_level.txt +0 -0
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
npcpy/__init__.py,sha256=9imxFtK74_6Rw9rz0kyMnZYl_voPb569tkTlYLt0Urg,131
|
|
2
|
-
npcpy/llm_funcs.py,sha256=
|
|
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
|
|
@@ -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=
|
|
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.
|
|
38
|
-
npcpy-1.2.
|
|
39
|
-
npcpy-1.2.
|
|
40
|
-
npcpy-1.2.
|
|
41
|
-
npcpy-1.2.
|
|
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
|
|
File without changes
|
|
File without changes
|