Skip to content

Commit

Permalink
fix blanklineSplitter (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault authored Dec 9, 2024
1 parent 9fb7070 commit 423b905
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 4.3.8 (unreleased)


- Nothing changed yet.
- Support blanklineSplitter


## 4.3.7 (2024-12-02)
Expand Down
12 changes: 12 additions & 0 deletions nuclia/sdk/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def file(
rid: Optional[str] = None,
field: Optional[str] = None,
interpretTables: Optional[bool] = False,
blanklineSplitter: Optional[bool] = False,
mimetype: Optional[str] = None,
**kwargs,
) -> Optional[str]:
Expand All @@ -74,6 +75,8 @@ def file(
mimetype = "application/octet-stream"
if interpretTables:
mimetype += "+aitable"
if blanklineSplitter:
mimetype += "+blankline"
is_new_resource = False
if rid is not None:
rid, is_new_resource = self._get_or_create_resource(
Expand Down Expand Up @@ -244,6 +247,7 @@ def remote(
rid: Optional[str] = None,
field: Optional[str] = "file",
interpretTables: Optional[bool] = False,
blanklineSplitter: Optional[bool] = False,
**kwargs,
) -> str:
"""Upload a remote url to a Nuclia KnowledgeBox"""
Expand All @@ -263,6 +267,8 @@ def remote(
mimetype = r.headers.get("Content-Type", "application/octet-stream")
if interpretTables:
mimetype += "+aitable"
if blanklineSplitter:
mimetype += "+blankline"
rid, is_new_resource = self._get_or_create_resource(
rid=rid, icon=mimetype, **kwargs
)
Expand Down Expand Up @@ -368,6 +374,7 @@ async def file(
field: Optional[str] = None,
mimetype: Optional[str] = None,
interpretTables: Optional[bool] = False,
blanklineSplitter: Optional[bool] = False,
**kwargs,
) -> str:
"""Upload a file from filesystem to a Nuclia KnowledgeBox"""
Expand All @@ -379,6 +386,8 @@ async def file(
mimetype = "application/octet-stream"
if interpretTables:
mimetype += "+aitable"
if blanklineSplitter:
mimetype += "+blankline"
rid, is_new_resource = await self._get_or_create_resource(
rid=rid, icon=mimetype, **kwargs
)
Expand Down Expand Up @@ -542,6 +551,7 @@ async def remote(
rid: Optional[str] = None,
field: Optional[str] = "file",
interpretTables: Optional[bool] = False,
blanklineSplitter: Optional[bool] = False,
**kwargs,
) -> str:
"""Upload a remote url to a Nuclia KnowledgeBox"""
Expand All @@ -556,6 +566,8 @@ async def remote(
mimetype = r.headers.get("Content-Type", "application/octet-stream")
if interpretTables:
mimetype += "+aitable"
if blanklineSplitter:
mimetype += "+blankline"
rid, is_new_resource = await self._get_or_create_resource(
rid=rid, icon=mimetype, **kwargs
)
Expand Down

0 comments on commit 423b905

Please sign in to comment.