unique_toolkit 1.42.4__py3-none-any.whl → 1.42.5__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,12 @@ 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 = (
194
+ ContentMetadata(**metadata) if metadata else None if metadata else None
195
+ )
194
196
  return ContentChunk(
195
197
  id=content_id,
196
198
  key=content_key,
@@ -199,23 +201,26 @@ def map_content_chunk(content_id: str, content_key: str, content_chunk: dict):
199
201
  start_page=content_chunk["startPage"],
200
202
  end_page=content_chunk["endPage"],
201
203
  order=content_chunk["order"],
204
+ metadata=content_metadata,
202
205
  )
203
206
 
204
207
 
205
208
  def map_content(content: dict):
209
+ metadata = content.get("metadata")
206
210
  return Content(
207
211
  id=content["id"],
208
212
  key=content["key"],
209
213
  title=content["title"],
210
214
  url=content["url"],
211
215
  chunks=[
212
- map_content_chunk(content["id"], content["key"], chunk)
216
+ map_content_chunk(content["id"], content["key"], chunk, metadata)
213
217
  for chunk in content["chunks"]
214
218
  ],
215
219
  created_at=content["createdAt"],
216
220
  updated_at=content["updatedAt"],
217
221
  ingestion_state=content.get("ingestionState"),
218
222
  expired_at=content.get("expiredAt"),
223
+ metadata=content.get("metadata"),
219
224
  )
220
225
 
221
226
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.42.4
3
+ Version: 1.42.5
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -124,6 +124,10 @@ 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.5] - 2026-01-07
128
+ - Add Mapping of metadata to the `search_content` calls
129
+ - Remove additional indentation by the markdown to docx converter
130
+
127
131
  ## [1.42.4] - 2026-01-07
128
132
  - Added `additionalSheetInformation` to magic table event.
129
133
 
@@ -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=w2VKLoe88cRsJ9Os-6Grj7d_0X3Hdl5Ic4yyBd1QW3k,8271
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.5.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
219
+ unique_toolkit-1.42.5.dist-info/METADATA,sha256=t1naUZXw9AHM32vCOwkWodfBH-OoR3eLI8CjnW6DOCY,47048
220
+ unique_toolkit-1.42.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
221
+ unique_toolkit-1.42.5.dist-info/RECORD,,