Skip to content

Commit 5dca198

Browse files
committed
Merge branch 'main' into 00bad53466
2 parents 819169a + 1b1d550 commit 5dca198

File tree

11 files changed

+2113
-98
lines changed

11 files changed

+2113
-98
lines changed

scripts/sanity_test.sh

Lines changed: 1169 additions & 1 deletion
Large diffs are not rendered by default.

sdks/python/CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.0] - 2025-02-09
11+
1012
### Added
11-
- `retrieve_chunks`: New `output_format` parameter (`"base64"` | `"url"`). When set to `"url"`, image chunks are returned as presigned URLs in `content` and `download_url` is populated. Default remains `"base64"` for backward compatibility.
12-
- `retrieve_chunks`: `padding` parameter surfaced consistently in SDK convenience methods (folder/user scopes) to fetch neighboring page chunks for ColPali.
13-
- `batch_get_chunks`: `output_format` parameter mirrors retrieval APIs so batch lookups can request presigned URLs for image chunks.
13+
- Nested folders: folder models now expose `full_path`, `parent_id`, `depth`, and `child_count`; documents/graphs expose `folder_path`; folder helpers send canonical paths and `create_folder` accepts nested `full_path`.
14+
- Folder scope depth controls: `folder_depth` is available on retrieve/query/list/search helpers (including grouped retrieval) and graph accessors to optionally include descendant folders.
15+
- Retrieval options: `retrieve_chunks` and `retrieve_chunks_grouped` expose `output_format` (`"base64"` | `"url"` | `"text"`) and `padding` everywhere; `batch_get_chunks` mirrors `output_format`.
1416

1517
### Changed
16-
- Image handling in SDK parsing: When `output_format="url"`, `FinalChunkResult.content` is a string URL for image chunks; when `"base64"`, the SDK attempts to decode to `PIL.Image` (unchanged behavior).
18+
- Image parsing: when `output_format="url"`, `FinalChunkResult.content` remains a URL string; when `"base64"`, the SDK attempts to decode to `PIL.Image` (unchanged behavior).
19+
- Folder scoping now prefers canonical paths across folder/user scoped clients and graph/document helpers.
1720

1821
### Notes
1922
- Server now hot-swaps base64/data-URI image chunks into binary storage when necessary and returns a presigned URL. In local dev, URLs may be `file://...` paths; in S3-backed deployments, HTTPS presigned URLs.

sdks/python/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ response = db.query(
7777
print(response.completion)
7878
```
7979

80+
### Nested Folders & Folder Depth
81+
82+
```python
83+
# Create a nested folder (parents are auto-created server-side)
84+
folder = db.create_folder(full_path="/projects/alpha/specs", description="Specs folder")
85+
86+
# Scope queries to a path and include descendants with folder_depth=-1
87+
chunks = folder.retrieve_chunks(query="design notes", folder_depth=-1)
88+
docs = db.list_documents(folder_name="/projects/alpha", folder_depth=-1)
89+
```
90+
91+
`Folder.full_path` is exposed on folder objects, and `Document.folder_path` / `Graph.folder_path` mirror server responses for tracing scope.
92+
8093
### Asynchronous Usage
8194

8295
```python

sdks/python/morphik/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"DocumentQueryResponse",
1414
]
1515

16-
__version__ = "1.0.5"
16+
__version__ = "1.1.1"

sdks/python/morphik/_internal.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def _prepare_query_request(
295295
include_paths: bool,
296296
prompt_overrides: Optional[Union[QueryPromptOverrides, Dict[str, Any]]],
297297
folder_name: Optional[Union[str, List[str]]],
298+
folder_depth: Optional[int],
298299
end_user_id: Optional[str],
299300
use_reranking: Optional[bool] = None, # Add missing parameter
300301
chat_id: Optional[str] = None,
@@ -323,6 +324,8 @@ def _prepare_query_request(
323324
}
324325
if folder_name:
325326
payload["folder_name"] = folder_name
327+
if folder_depth is not None:
328+
payload["folder_depth"] = folder_depth
326329
if end_user_id:
327330
payload["end_user_id"] = end_user_id
328331
if chat_id:
@@ -356,6 +359,7 @@ def _prepare_retrieve_chunks_request(
356359
min_score: float,
357360
use_colpali: bool,
358361
folder_name: Optional[Union[str, List[str]]],
362+
folder_depth: Optional[int],
359363
end_user_id: Optional[str],
360364
padding: int = 0,
361365
output_format: Optional[str] = None,
@@ -387,6 +391,8 @@ def _prepare_retrieve_chunks_request(
387391
request["query"] = query
388392
if folder_name:
389393
request["folder_name"] = folder_name
394+
if folder_depth is not None:
395+
request["folder_depth"] = folder_depth
390396
if end_user_id:
391397
request["end_user_id"] = end_user_id
392398
if padding > 0:
@@ -403,6 +409,7 @@ def _prepare_retrieve_docs_request(
403409
min_score: float,
404410
use_colpali: bool,
405411
folder_name: Optional[Union[str, List[str]]],
412+
folder_depth: Optional[int],
406413
end_user_id: Optional[str],
407414
use_reranking: Optional[bool] = None, # Add missing parameter
408415
) -> Dict[str, Any]:
@@ -417,6 +424,8 @@ def _prepare_retrieve_docs_request(
417424
}
418425
if folder_name:
419426
request["folder_name"] = folder_name
427+
if folder_depth is not None:
428+
request["folder_depth"] = folder_depth
420429
if end_user_id:
421430
request["end_user_id"] = end_user_id
422431
return request
@@ -427,6 +436,7 @@ def _prepare_list_documents_request(
427436
limit: int,
428437
filters: Optional[Dict[str, Any]],
429438
folder_name: Optional[Union[str, List[str]]],
439+
folder_depth: Optional[int],
430440
end_user_id: Optional[str],
431441
include_total_count: bool,
432442
include_status_counts: bool,
@@ -439,6 +449,8 @@ def _prepare_list_documents_request(
439449
params = {}
440450
if folder_name:
441451
params["folder_name"] = folder_name
452+
if folder_depth is not None:
453+
params["folder_depth"] = folder_depth
442454
if end_user_id:
443455
params["end_user_id"] = end_user_id
444456

sdks/python/morphik/_scoped_ops.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def _scoped_retrieve_chunks(
153153
min_score: float,
154154
use_colpali: bool,
155155
folder_name: Optional[Union[str, List[str]]],
156+
folder_depth: Optional[int],
156157
end_user_id: Optional[str],
157158
padding: int,
158159
output_format: Optional[str] = None,
@@ -165,6 +166,7 @@ def _scoped_retrieve_chunks(
165166
min_score,
166167
use_colpali,
167168
folder_name,
169+
folder_depth,
168170
end_user_id,
169171
padding,
170172
output_format,
@@ -187,6 +189,7 @@ def _scoped_retrieve_docs(
187189
min_score: float,
188190
use_colpali: bool,
189191
folder_name: Optional[Union[str, List[str]]],
192+
folder_depth: Optional[int],
190193
end_user_id: Optional[str],
191194
use_reranking: Optional[bool],
192195
) -> List[Any]:
@@ -197,6 +200,7 @@ def _scoped_retrieve_docs(
197200
min_score,
198201
use_colpali,
199202
folder_name,
203+
folder_depth,
200204
end_user_id,
201205
use_reranking,
202206
)
@@ -223,6 +227,7 @@ def _scoped_query(
223227
include_paths: bool,
224228
prompt_overrides: Optional[Dict[str, Any]],
225229
folder_name: Optional[Union[str, List[str]]],
230+
folder_depth: Optional[int],
226231
end_user_id: Optional[str],
227232
use_reranking: Optional[bool],
228233
chat_id: Optional[str],
@@ -243,6 +248,7 @@ def _scoped_query(
243248
include_paths,
244249
prompt_overrides,
245250
folder_name,
251+
folder_depth,
246252
end_user_id,
247253
use_reranking,
248254
chat_id,
@@ -275,6 +281,7 @@ def _scoped_list_documents(
275281
limit: int,
276282
filters: Optional[Dict[str, Any]],
277283
folder_name: Optional[Union[str, List[str]]],
284+
folder_depth: Optional[int],
278285
end_user_id: Optional[str],
279286
include_total_count: bool,
280287
include_status_counts: bool,
@@ -288,6 +295,7 @@ def _scoped_list_documents(
288295
limit,
289296
filters,
290297
folder_name,
298+
folder_depth,
291299
end_user_id,
292300
include_total_count,
293301
include_status_counts,

0 commit comments

Comments
 (0)