unique_toolkit 1.42.4__py3-none-any.whl → 1.42.6__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.
@@ -33,15 +33,6 @@ class DocxGeneratorService:
33
33
  # Initialize markdown-it parser
34
34
  md = MarkdownIt()
35
35
 
36
- # Preprocess markdown.
37
- # - Replace all headings with the correct heading level
38
- # - Remove "Relevant sources" heading
39
- # - Replace "# Proposed answer" with "#### Proposed answer"
40
- markdown = re.sub(r"(?m)^\s*## ", "#### ", markdown)
41
- markdown = re.sub(r"(?m)^\s*### ", "##### ", markdown)
42
- markdown = markdown.replace("# Relevant sources", "")
43
- markdown = markdown.replace("# Proposed answer", "#### Proposed answer")
44
-
45
36
  tokens = md.parse(markdown)
46
37
 
47
38
  elements = []
@@ -3,10 +3,7 @@ import re
3
3
  import tiktoken
4
4
  import unique_sdk
5
5
 
6
- from unique_toolkit.content.schemas import (
7
- Content,
8
- ContentChunk,
9
- )
6
+ from unique_toolkit.content.schemas import Content, ContentChunk, ContentMetadata
10
7
 
11
8
 
12
9
  def _map_content_id_to_chunks(content_chunks: list[ContentChunk]):
@@ -190,7 +187,10 @@ def count_tokens(text: str, encoding_model="cl100k_base") -> int:
190
187
  return len(encoding.encode(text))
191
188
 
192
189
 
193
- def map_content_chunk(content_id: str, content_key: str, content_chunk: dict):
190
+ def map_content_chunk(
191
+ content_id: str, content_key: str, content_chunk: dict, metadata: dict | None
192
+ ):
193
+ content_metadata = ContentMetadata(**metadata) if metadata else None
194
194
  return ContentChunk(
195
195
  id=content_id,
196
196
  key=content_key,
@@ -199,23 +199,26 @@ def map_content_chunk(content_id: str, content_key: str, content_chunk: dict):
199
199
  start_page=content_chunk["startPage"],
200
200
  end_page=content_chunk["endPage"],
201
201
  order=content_chunk["order"],
202
+ metadata=content_metadata,
202
203
  )
203
204
 
204
205
 
205
206
  def map_content(content: dict):
207
+ metadata = content.get("metadata")
206
208
  return Content(
207
209
  id=content["id"],
208
210
  key=content["key"],
209
211
  title=content["title"],
210
212
  url=content["url"],
211
213
  chunks=[
212
- map_content_chunk(content["id"], content["key"], chunk)
214
+ map_content_chunk(content["id"], content["key"], chunk, metadata)
213
215
  for chunk in content["chunks"]
214
216
  ],
215
217
  created_at=content["createdAt"],
216
218
  updated_at=content["updatedAt"],
217
219
  ingestion_state=content.get("ingestionState"),
218
220
  expired_at=content.get("expiredAt"),
221
+ metadata=content.get("metadata"),
219
222
  )
220
223
 
221
224
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.42.4
3
+ Version: 1.42.6
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -124,6 +124,13 @@ All notable changes to this project will be documented in this file.
124
124
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
125
125
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
126
126
 
127
+ ## [1.42.6] - 2026-01-07
128
+ - Remove double redundant condition
129
+
130
+ ## [1.42.5] - 2026-01-07
131
+ - Add Mapping of metadata to the `search_content` calls
132
+ - Remove additional indentation by the markdown to docx converter
133
+
127
134
  ## [1.42.4] - 2026-01-07
128
135
  - Added `additionalSheetInformation` to magic table event.
129
136
 
@@ -12,7 +12,7 @@ unique_toolkit/_common/default_language_model.py,sha256=XCZu6n270QkxEeTpj5NZJda6
12
12
  unique_toolkit/_common/docx_generator/__init__.py,sha256=dqzO4NvzdXClq42vVRqqOvzKwmzqAB8CaufAo_QEv1s,226
13
13
  unique_toolkit/_common/docx_generator/config.py,sha256=uJOa0GXvi3InuLkRDbLSD0RxMRelU2bPI73g4XcHIVc,354
14
14
  unique_toolkit/_common/docx_generator/schemas.py,sha256=4U4SCCjBQ-R8XBkSSO3QigYqONp26r7Fcwy8P885do8,2420
15
- unique_toolkit/_common/docx_generator/service.py,sha256=wIgdxuKOOd3V-xarwQZOy_KV18_dNbtPMvbKkvPQ9tU,8247
15
+ unique_toolkit/_common/docx_generator/service.py,sha256=LM-kIfS2X3P507KLqsUJsb-rm6-i-G2yz2Nb5AEfY3w,7770
16
16
  unique_toolkit/_common/docx_generator/template/Doc Template.docx,sha256=USnCg8h6d-N0751riNjqYr6ALLffU-EoJ8WY57K55r0,34757
17
17
  unique_toolkit/_common/endpoint_builder.py,sha256=pEDwgeDzt67qbyaM98u8X7UAy29mQIw9Qufjz2bxgEA,11410
18
18
  unique_toolkit/_common/endpoint_requestor.py,sha256=TBLYUVpfdYIPpeKfEVYfH8BrNxnn4yAcSUjfdVDkT78,15443
@@ -167,7 +167,7 @@ unique_toolkit/content/functions.py,sha256=cYbILIufzX1btSPiEAglH4cd2eI5MfHoZmaUB
167
167
  unique_toolkit/content/schemas.py,sha256=uuS1UsuWK6eC7cP4dTC1q3DJ39xl6zenN2zL4ghFmzk,6424
168
168
  unique_toolkit/content/service.py,sha256=hwycIbxtLn1p0IgNQMVIxN2NUhy_4AVsTfatytGi-gY,24919
169
169
  unique_toolkit/content/smart_rules.py,sha256=z2gHToPrdyj3HqO8Uu-JE5G2ClvJPuhR2XERmmkgoug,9668
170
- unique_toolkit/content/utils.py,sha256=ITCJHDIXPyFkxR5M-6k-PhHOLbnkVq_RGrGA7i5s1WM,8001
170
+ unique_toolkit/content/utils.py,sha256=YACNDupAb0SjqYyM5Uxxflr0SjSgIS1lt67JAlBGWpE,8233
171
171
  unique_toolkit/data_extraction/README.md,sha256=5KxzqPHC29wxBiWJ-87wBQisSgRBkuSnPTb38pGH1wA,3138
172
172
  unique_toolkit/data_extraction/__init__.py,sha256=y6uSp8PAqgPZMoBgXWp1Ep0gsk9MD-NV8qn2QpOY-xY,330
173
173
  unique_toolkit/data_extraction/augmented/__init__.py,sha256=_8G35ZgOPvcOR3a_2xvJDowoQ3ivQ9ehhJvbk1xzFs0,131
@@ -215,7 +215,7 @@ unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBu
215
215
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
216
216
  unique_toolkit/smart_rules/compile.py,sha256=Ozhh70qCn2yOzRWr9d8WmJeTo7AQurwd3tStgBMPFLA,1246
217
217
  unique_toolkit/test_utilities/events.py,sha256=_mwV2bs5iLjxS1ynDCjaIq-gjjKhXYCK-iy3dRfvO3g,6410
218
- unique_toolkit-1.42.4.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
219
- unique_toolkit-1.42.4.dist-info/METADATA,sha256=qyTYdqy1yxrew8uPcaGic5tlIQjF-ebYTgM2CApDUvs,46900
220
- unique_toolkit-1.42.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
221
- unique_toolkit-1.42.4.dist-info/RECORD,,
218
+ unique_toolkit-1.42.6.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
219
+ unique_toolkit-1.42.6.dist-info/METADATA,sha256=L5ofz1-_UcYYhfwluusOfhB0zZpESH70ZPYarndVMJQ,47110
220
+ unique_toolkit-1.42.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
221
+ unique_toolkit-1.42.6.dist-info/RECORD,,