npcsh 0.3.30__py3-none-any.whl → 0.3.32__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.
- npcsh/audio.py +540 -181
- npcsh/audio_gen.py +1 -0
- npcsh/cli.py +37 -19
- npcsh/conversation.py +14 -251
- npcsh/dataframes.py +13 -5
- npcsh/helpers.py +5 -0
- npcsh/image.py +2 -4
- npcsh/image_gen.py +38 -38
- npcsh/knowledge_graph.py +4 -4
- npcsh/llm_funcs.py +517 -349
- npcsh/npc_compiler.py +44 -23
- npcsh/npc_sysenv.py +5 -0
- npcsh/npc_team/npcsh.ctx +8 -2
- npcsh/npc_team/tools/generic_search.tool +9 -1
- npcsh/plonk.py +2 -2
- npcsh/response.py +131 -482
- npcsh/search.py +20 -9
- npcsh/serve.py +210 -203
- npcsh/shell.py +78 -80
- npcsh/shell_helpers.py +513 -102
- npcsh/stream.py +87 -554
- npcsh/video.py +5 -2
- npcsh/video_gen.py +69 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/generic_search.tool +9 -1
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh.ctx +8 -2
- npcsh-0.3.32.dist-info/METADATA +779 -0
- npcsh-0.3.32.dist-info/RECORD +78 -0
- npcsh-0.3.30.dist-info/METADATA +0 -1862
- npcsh-0.3.30.dist-info/RECORD +0 -76
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/bash_executer.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/calculator.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/celona.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/code_executor.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/corca.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/eriane.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/foreman.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/image_generation.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/lineru.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/local_search.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/maurawa.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh_executor.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/raone.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/screen_cap.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sibiji.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/slean.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sql_executor.tool +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/test_pipeline.py +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/turnic.npc +0 -0
- {npcsh-0.3.30.data → npcsh-0.3.32.data}/data/npcsh/npc_team/welxor.npc +0 -0
- {npcsh-0.3.30.dist-info → npcsh-0.3.32.dist-info}/WHEEL +0 -0
- {npcsh-0.3.30.dist-info → npcsh-0.3.32.dist-info}/entry_points.txt +0 -0
- {npcsh-0.3.30.dist-info → npcsh-0.3.32.dist-info}/licenses/LICENSE +0 -0
- {npcsh-0.3.30.dist-info → npcsh-0.3.32.dist-info}/top_level.txt +0 -0
npcsh/video.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
# video.py
|
|
1
|
+
# video.py
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
def process_video(file_path, table_name):
|
|
5
|
+
# implement with moon dream
|
|
6
|
+
|
|
4
7
|
embeddings = []
|
|
5
8
|
texts = []
|
|
6
9
|
try:
|
|
@@ -46,4 +49,4 @@ def process_video(file_path, table_name):
|
|
|
46
49
|
|
|
47
50
|
except Exception as e:
|
|
48
51
|
print(f"Error processing video: {e}")
|
|
49
|
-
return [], [] # Return empty lists in case of error
|
|
52
|
+
return [], [] # Return empty lists in case of error
|
npcsh/video_gen.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
def generate_video_diffusers(
|
|
2
|
+
prompt,
|
|
3
|
+
model,
|
|
4
|
+
npc=None,
|
|
5
|
+
device="cpu",
|
|
6
|
+
output_path="",
|
|
7
|
+
num_inference_steps=10,
|
|
8
|
+
num_frames=125,
|
|
9
|
+
height=256,
|
|
10
|
+
width=256,
|
|
11
|
+
):
|
|
12
|
+
|
|
13
|
+
import torch
|
|
14
|
+
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
|
15
|
+
import numpy as np
|
|
16
|
+
import cv2
|
|
17
|
+
|
|
18
|
+
# Load pipeline
|
|
19
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
20
|
+
"damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float32
|
|
21
|
+
).to(device)
|
|
22
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
23
|
+
|
|
24
|
+
output = pipe(
|
|
25
|
+
prompt,
|
|
26
|
+
num_inference_steps=num_inference_steps,
|
|
27
|
+
num_frames=num_frames,
|
|
28
|
+
height=height,
|
|
29
|
+
width=width,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def save_frames_to_video(frames, output_path, fps=8):
|
|
33
|
+
"""Handle the specific 5D array format (1, num_frames, H, W, 3) with proper type conversion"""
|
|
34
|
+
# Verify input format
|
|
35
|
+
if not (
|
|
36
|
+
isinstance(frames, np.ndarray)
|
|
37
|
+
and frames.ndim == 5
|
|
38
|
+
and frames.shape[-1] == 3
|
|
39
|
+
):
|
|
40
|
+
raise ValueError(
|
|
41
|
+
f"Unexpected frame format. Expected 5D RGB array, got {frames.shape}"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Remove batch dimension and convert to 0-255 uint8
|
|
45
|
+
frames = (frames[0] * 255).astype(np.uint8) # Shape: (num_frames, H, W, 3)
|
|
46
|
+
|
|
47
|
+
# Get video dimensions
|
|
48
|
+
height, width = frames.shape[1:3]
|
|
49
|
+
|
|
50
|
+
# Create video writer
|
|
51
|
+
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
|
|
52
|
+
video_writer = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
|
|
53
|
+
|
|
54
|
+
if not video_writer.isOpened():
|
|
55
|
+
raise IOError(f"Could not open video writer for {output_path}")
|
|
56
|
+
|
|
57
|
+
# Write frames (convert RGB to BGR for OpenCV)
|
|
58
|
+
for frame in frames:
|
|
59
|
+
video_writer.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
|
|
60
|
+
|
|
61
|
+
video_writer.release()
|
|
62
|
+
print(f"Successfully saved {frames.shape[0]} frames to {output_path}")
|
|
63
|
+
|
|
64
|
+
os.makedirs("~/.npcsh/videos/")
|
|
65
|
+
if output_path == "":
|
|
66
|
+
|
|
67
|
+
output_path = "~/.npcsh/videos/" + prompt[0:8] + ".mp4"
|
|
68
|
+
save_frames_to_video(output.frames, output_path)
|
|
69
|
+
return output_path
|
|
@@ -2,13 +2,21 @@ tool_name: "internet_search"
|
|
|
2
2
|
description: Searches the web for information based on a query in order to verify timiely details (e.g. current events) or to corroborate information in uncertain situations. Should be mainly only used when users specifically request a search, otherwise an LLMs basic knowledge should be sufficient.
|
|
3
3
|
inputs:
|
|
4
4
|
- query
|
|
5
|
+
- provider: ''
|
|
5
6
|
steps:
|
|
6
7
|
- engine: "python"
|
|
7
8
|
code: |
|
|
8
9
|
from npcsh.search import search_web
|
|
10
|
+
from npcsh.npc_sysenv import NPCSH_SEARCH_PROVIDER
|
|
9
11
|
query = "{{ query }}"
|
|
12
|
+
provider = '{{ provider }}'
|
|
13
|
+
if provider.strip() != '':
|
|
14
|
+
results = search_web(query, num_results=5, provider = provider)
|
|
15
|
+
else:
|
|
16
|
+
results = search_web(query, num_results=5, provider = NPCSH_SEARCH_PROVIDER)
|
|
17
|
+
|
|
10
18
|
print('QUERY in tool', query)
|
|
11
|
-
results = search_web(query, num_results=5)
|
|
19
|
+
results = search_web(query, num_results=5, provider = NPCSH_SEARCH_PROVIDER)
|
|
12
20
|
print('RESULTS in tool', results)
|
|
13
21
|
- engine: "natural"
|
|
14
22
|
code: |
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
context: |
|
|
2
2
|
The npcsh NPC team is devoted to providing a safe and helpful
|
|
3
3
|
environment for users where they can work and be as successful as possible.
|
|
4
4
|
npcsh is a command-line tool that makes it easy for users to harness
|
|
5
|
-
the power of LLMs from a command line shell.
|
|
5
|
+
the power of LLMs from a command line shell.
|
|
6
|
+
databases:
|
|
7
|
+
- ~/npcsh_history.db
|
|
8
|
+
mcp_servers:
|
|
9
|
+
- /path/to/mcp/server.py
|
|
10
|
+
- @npm for server
|
|
11
|
+
|