Skip to content

Commit 2875abc

Browse files
committed
Update version to 0.1.8, add caching features, and enhance CLI with safety settings and cached content support. Update dependencies and .gitignore to include new files.
1 parent 109523d commit 2875abc

File tree

11 files changed

+319
-215
lines changed

11 files changed

+319
-215
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
scrap
33
output
44
.DS_Store
5+
docs
6+
TODO.md
57

68
# Byte-compiled / optimized / DLL files
79
__pycache__/

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "veotools"
7-
version = "0.1.7"
7+
version = "0.1.8"
88
description = "A Python toolkit for AI-powered video generation and seamless stitching using Google's Veo models."
99
readme = "readme.md"
1010
requires-python = ">=3.10"
@@ -26,7 +26,7 @@ classifiers = [
2626
"Topic :: Software Development :: Libraries",
2727
]
2828
dependencies = [
29-
"google-genai>=1.29.0,<2.0.0",
29+
"google-genai>=1.30.0,<2.0.0",
3030
"opencv-python>=4.8.0",
3131
"requests>=2.31.0",
3232
"python-dotenv>=1.0.0",

readme.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Concise Python SDK and MCP server for generating and extending videos with Googl
88
- MCP tools with progress streaming (start/get/cancel, continue_video) and recent videos resource
99
- Model discovery (local registry + remote list, cached)
1010
- Accurate metadata via ffprobe/OpenCV; outputs under project `output/` (override with `VEO_OUTPUT_DIR`)
11+
- Safety settings pass-through for generation (best-effort)
12+
- Context caching helpers and `cached_content` support
1113

1214
## Install
1315

@@ -70,11 +72,14 @@ Install exposes the `veo` command. Use `-h/--help` on any subcommand.
7072
veo preflight
7173
veo list-models --remote
7274

73-
# Generate from text
74-
veo generate --prompt "cat riding a hat" --model veo-3.0-fast-generate-preview
75+
# Generate from text (optional safety + cached content)
76+
veo generate --prompt "cat riding a hat" --model veo-3.0-fast-generate-preview \
77+
--safety-json "[{\"category\":\"HARM_CATEGORY_HARASSMENT\",\"threshold\":\"BLOCK_ONLY_HIGH\"}]" \
78+
--cached-content "caches/your-cache-name"
7579

7680
# Continue a video and stitch seamlessly
77-
veo continue --video dog.mp4 --prompt "the dog finds a treasure chest" --overlap 1.0
81+
veo continue --video dog.mp4 --prompt "the dog finds a treasure chest" --overlap 1.0 \
82+
--safety-json "[{\"category\":\"HARM_CATEGORY_HARASSMENT\",\"threshold\":\"BLOCK_ONLY_HIGH\"}]"
7883

7984
# Help
8085
veo --help
@@ -105,6 +110,13 @@ final_video = (bridge
105110
- `generate_from_image(image_path, prompt, model, **kwargs)` - Generate video from image
106111
- `generate_from_video(video_path, prompt, extract_at, model, **kwargs)` - Continue video
107112

113+
Optional config supported (best-effort pass-through):
114+
- `aspect_ratio` (model-dependent)
115+
- `negative_prompt`
116+
- `person_generation` (validated per Veo model and mode)
117+
- `safety_settings` (list of {category, threshold} or `types.SafetySetting`)
118+
- `cached_content` (cache name string)
119+
108120
### Processing
109121

110122
- `extract_frame(video_path, time_offset)` - Extract single frame
@@ -158,6 +170,50 @@ status = veo.generate_get(job_id)
158170
veo.generate_cancel(job_id)
159171
```
160172

173+
### Caching helpers
174+
175+
Programmatic usage via MCP-friendly APIs:
176+
177+
```python
178+
import veotools as veo
179+
180+
# Create a cache from files
181+
cache = veo.cache_create_from_files(
182+
model="gemini-1.5-flash-001",
183+
files=["media/a11.txt"],
184+
system_instruction="You are an expert analyzing transcripts."
185+
)
186+
187+
# Use cached content in generation
188+
start = veo.generate_start({
189+
"prompt": "Summarize the transcript",
190+
"model": "veo-3.0-fast-generate-preview",
191+
"options": {"cached_content": cache.get("name")}
192+
})
193+
```
194+
195+
Manage cached content:
196+
197+
```python
198+
import veotools as veo
199+
200+
# List caches (metadata only)
201+
listing = veo.cache_list()
202+
for c in listing.get("caches", []):
203+
print(c.get("name"), c.get("display_name"), c.get("expire_time"))
204+
205+
# Get single cache metadata
206+
meta = veo.cache_get(name="caches/abc123")
207+
208+
# Update TTL or expiry time
209+
veo.cache_update(name="caches/abc123", ttl_seconds=600) # set TTL to 10 minutes
210+
# or
211+
veo.cache_update(name="caches/abc123", expire_time_iso="2025-01-27T16:02:36.473528+00:00")
212+
213+
# Delete cache
214+
veo.cache_delete(name="caches/abc123")
215+
```
216+
161217
### Cursor MCP configuration
162218

163219
Add an entry in `~/.cursor/mcp.json` pointing to the installed `veo-mcp` (or your venv path):
@@ -279,6 +335,9 @@ Organized file management (local now, cloud-ready for future).
279335

280336
- Generation usually takes 1–3 minutes
281337
- Veo access may require allowlist
338+
- Person generation constraints per Veo docs:
339+
- Veo 3: text→video allows `allow_all`; image/video-seeded allows `allow_adult`
340+
- Veo 2: text→video allows `allow_all`, `allow_adult`, `dont_allow`; image/video-seeded allows `allow_adult`, `dont_allow`
282341

283342
## License
284343

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Runtime dependencies (keep minimal; versions align with pyproject.toml)
2-
google-genai==1.29.0
2+
google-genai==1.30.0
33
opencv-python==4.12.0.88
44
numpy==2.2.6
55
python-dotenv==1.1.1

veo_tools_mcp.py

Lines changed: 0 additions & 206 deletions
This file was deleted.

veotools/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@
3333
generate_start,
3434
generate_get,
3535
generate_cancel,
36+
cache_create_from_files,
37+
cache_get,
38+
cache_list,
39+
cache_update,
40+
cache_delete,
3641
)
3742

38-
__version__ = "0.1.7"
43+
__version__ = "0.1.8"
3944

4045
__all__ = [
4146
"VeoClient",
@@ -63,6 +68,11 @@
6368
"generate_get",
6469
"generate_cancel",
6570
"list_models",
71+
"cache_create_from_files",
72+
"cache_get",
73+
"cache_list",
74+
"cache_update",
75+
"cache_delete",
6676
]
6777

6878
def init(api_key: str = None, log_level: str = "WARNING"):

0 commit comments

Comments
 (0)