unique_sdk 0.9.22__tar.gz → 0.9.26__tar.gz

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.

Potentially problematic release.


This version of unique_sdk might be problematic. Click here for more details.

Files changed (36) hide show
  1. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/CHANGELOG.md +12 -0
  2. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/PKG-INFO +39 -18
  3. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/README.md +26 -17
  4. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/pyproject.toml +4 -1
  5. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_content.py +21 -1
  6. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_search.py +1 -1
  7. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/utils/file_io.py +7 -1
  8. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/LICENSE +0 -0
  9. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/__init__.py +0 -0
  10. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_api_requestor.py +0 -0
  11. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_api_resource.py +0 -0
  12. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_api_version.py +0 -0
  13. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_error.py +0 -0
  14. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_http_client.py +0 -0
  15. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_list_object.py +0 -0
  16. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_object_classes.py +0 -0
  17. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_request_options.py +0 -0
  18. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_unique_object.py +0 -0
  19. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_unique_ql.py +0 -0
  20. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_unique_response.py +0 -0
  21. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_util.py +0 -0
  22. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_version.py +0 -0
  23. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/_webhook.py +0 -0
  24. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/__init__.py +0 -0
  25. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_acronyms.py +0 -0
  26. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_chat_completion.py +0 -0
  27. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_embedding.py +0 -0
  28. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_event.py +0 -0
  29. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_integrated.py +0 -0
  30. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_message.py +0 -0
  31. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_message_assessment.py +0 -0
  32. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_search_string.py +0 -0
  33. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/api_resources/_short_term_memory.py +0 -0
  34. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/utils/chat_history.py +0 -0
  35. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/utils/sources.py +0 -0
  36. {unique_sdk-0.9.22 → unique_sdk-0.9.26}/unique_sdk/utils/token.py +0 -0
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.26] - 2025-05-13
9
+ - Add the possibility to specify ingestionConfig when creating or updating a Content.
10
+
11
+ ## [0.9.25] - 2025-05-02
12
+ - Fixed typos in `README.md`, including incorrect `sdk.utils` imports and code example errors.
13
+
14
+ ## [0.9.24] - 2025-04-23
15
+ - Make `chatId` property in `Search.CreateParams` optional
16
+
17
+ ## [0.9.23] - 2025-03-25
18
+ - Define programming language classifier explicitly for python 3.11
19
+
8
20
  ## [0.9.22] - 2025-02-25
9
21
  - update the retry_on_error to only `APIError` and `APIConnectionError` update the `resp["error"]` to be `resp.get("error")` to avoid key error
10
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.9.22
3
+ Version: 0.9.26
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -297,6 +297,11 @@ createdContent = upload_file(
297
297
  "test.pdf",
298
298
  "application/pdf",
299
299
  "scope_stcj2osgbl722m22jayidx0n",
300
+ ingestionConfig={
301
+ "chunkMaxTokens": 1000,
302
+ "chunkStrategy": "default",
303
+ "uniqueIngestionMode": "standard",
304
+ },
300
305
  )
301
306
 
302
307
  def upload_file(
@@ -306,6 +311,7 @@ def upload_file(
306
311
  displayed_filename,
307
312
  mimeType,
308
313
  scope_or_unique_path,
314
+ ingestion_config=None,
309
315
  ):
310
316
  size = os.path.getsize(path_to_file)
311
317
  createdContent = unique_sdk.Content.upsert(
@@ -315,6 +321,7 @@ def upload_file(
315
321
  "key": displayed_filename,
316
322
  "title": displayed_filename,
317
323
  "mimeType": mimeType,
324
+ "ingestionConfig": ingestionConfig,
318
325
  },
319
326
  scopeId=scope_or_unique_path,
320
327
  )
@@ -340,6 +347,7 @@ def upload_file(
340
347
  "title": displayed_filename,
341
348
  "mimeType": mimeType,
342
349
  "byteSize": size,
350
+ "ingestionConfig": ingestionConfig,
343
351
  },
344
352
  scopeId=scope_or_unique_path,
345
353
  readUrl=createdContent.readUrl,
@@ -544,6 +552,7 @@ These are the options are available for `searchType`:
544
552
  `scopeIds` Specifies a collection of scope IDs to confine the search.
545
553
  `language` Optional. The language specification for full text search.
546
554
  `reranker` Optional. The reranker service to be used for re-ranking the search results.
555
+ `chatId` Optional, adds the documents uploaded in this chat to the scope of searched documents.
547
556
 
548
557
  ```python
549
558
  search = unique_sdk.Search.create(
@@ -715,7 +724,7 @@ A metadata filter such as the one designed above can be used in a `Search.create
715
724
 
716
725
  ### Chat History
717
726
 
718
- #### `unique_sdk.util.chat_history.load_history`
727
+ #### `unique_sdk.utils.chat_history.load_history`
719
728
 
720
729
  A helper function that makes sure the chat history is fully loaded and cut to the size of the token window that it fits into the next round of chat interactions.
721
730
 
@@ -733,7 +742,7 @@ history = unique_sdk.utils.chat_history.load_history(
733
742
  )
734
743
  ```
735
744
 
736
- #### `unique_sdk.util.chat_history.convert_chat_history_to_injectable_string`
745
+ #### `unique_sdk.utils.chat_history.convert_chat_history_to_injectable_string`
737
746
 
738
747
  convert history into a string that can be injected into a prompt. it als returns the token length of the converted history.
739
748
 
@@ -747,7 +756,7 @@ chat_history-string, chat_context_token_length = unique_sdk.utils.chat_history.c
747
756
 
748
757
  Interacting with the knowledge-base.
749
758
 
750
- #### `unique_sdk.util.file_io.download_content`
759
+ #### `unique_sdk.utils.file_io.download_content`
751
760
 
752
761
  download files and save them into a folder in `/tmp`
753
762
 
@@ -763,7 +772,7 @@ pdfFile = download_content(
763
772
  }
764
773
  ```
765
774
 
766
- #### `unique_sdk.util.file_io.upload_file`
775
+ #### `unique_sdk.utils.file_io.upload_file`
767
776
 
768
777
  Allows for uploading files that then get ingested in a scope or a chat.
769
778
 
@@ -773,15 +782,15 @@ createdContent = upload_file(
773
782
  userId=userId,
774
783
  path_to_file="/tmp/hello.pdf",
775
784
  displayed_filename="hello.pdf",
776
- mimeType="application/pdf",
777
- uploadScope="scope_stcj2osgbl722m22jayidx0n",
785
+ mime_type="application/pdf",
786
+ scope_or_unique_path="scope_stcj2osgbl722m22jayidx0n",
778
787
  chat_id=None,
779
788
  )
780
789
  ```
781
790
 
782
791
  ### Sources
783
792
 
784
- #### `unique_sdk.util.sources.merge_sources`
793
+ #### `unique_sdk.utils.sources.merge_sources`
785
794
 
786
795
  Merges multiple search results based on their 'id', removing redundant document and info markers.
787
796
 
@@ -810,15 +819,15 @@ search = unique_sdk.Search.create(
810
819
  chatOnly=False,
811
820
  )
812
821
 
813
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
822
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
814
823
  search["data"], config["maxTokens"] - historyLength
815
824
  )
816
825
 
817
- searchContext = unique_sdk.util.sources.merge_sources(search)
826
+ searchContext = unique_sdk.utils.sources.merge_sources(search)
818
827
 
819
828
  ```
820
829
 
821
- #### `unique_sdk.util.sources.sort_sources`
830
+ #### `unique_sdk.utils.sources.sort_sources`
822
831
 
823
832
  Sort sources by order of appearance in documents
824
833
 
@@ -835,14 +844,14 @@ search = unique_sdk.Search.create(
835
844
  chatOnly=False,
836
845
  )
837
846
 
838
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
847
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
839
848
  search["data"], config["maxTokens"] - historyLength
840
849
  )
841
850
 
842
- searchContext = unique_sdk.util.sources.sort_sources(search)
851
+ searchContext = unique_sdk.utils.sources.sort_sources(search)
843
852
  ```
844
853
 
845
- #### `unique_sdk.util.sources.post_process_sources`
854
+ #### `unique_sdk.utils.sources.post_process_sources`
846
855
 
847
856
  Post-processes the provided text by converting source references into superscript numerals (required
848
857
  format by backend to display sources in the chat window)
@@ -869,7 +878,7 @@ text_with_sup = post_process_sources(text)
869
878
 
870
879
  ### Token
871
880
 
872
- #### unique_sdk.util.token.pick_search_results_for_token_window
881
+ #### unique_sdk.utils.token.pick_search_results_for_token_window
873
882
 
874
883
  Selects and returns a list of search results that fit within a specified token limit.
875
884
 
@@ -898,12 +907,12 @@ search = unique_sdk.Search.create(
898
907
  chatOnly=False,
899
908
  )
900
909
 
901
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
910
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
902
911
  search["data"], config["maxTokens"] - historyLength
903
912
  )
904
913
  ```
905
914
 
906
- #### unique_sdk.util.token.count_tokens
915
+ #### unique_sdk.utils.token.count_tokens
907
916
 
908
917
  Counts the number of tokens in the provided text.
909
918
 
@@ -920,7 +929,7 @@ Returns:
920
929
 
921
930
  ```python
922
931
  hello = "hello you!"
923
- searchContext = unique_sdk.util.token.count_tokens(hello)
932
+ searchContext = unique_sdk.utils.token.count_tokens(hello)
924
933
  ```
925
934
 
926
935
  ## Error Handling
@@ -940,6 +949,18 @@ All notable changes to this project will be documented in this file.
940
949
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
941
950
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
942
951
 
952
+ ## [0.9.26] - 2025-05-13
953
+ - Add the possibility to specify ingestionConfig when creating or updating a Content.
954
+
955
+ ## [0.9.25] - 2025-05-02
956
+ - Fixed typos in `README.md`, including incorrect `sdk.utils` imports and code example errors.
957
+
958
+ ## [0.9.24] - 2025-04-23
959
+ - Make `chatId` property in `Search.CreateParams` optional
960
+
961
+ ## [0.9.23] - 2025-03-25
962
+ - Define programming language classifier explicitly for python 3.11
963
+
943
964
  ## [0.9.22] - 2025-02-25
944
965
  - update the retry_on_error to only `APIError` and `APIConnectionError` update the `resp["error"]` to be `resp.get("error")` to avoid key error
945
966
 
@@ -282,6 +282,11 @@ createdContent = upload_file(
282
282
  "test.pdf",
283
283
  "application/pdf",
284
284
  "scope_stcj2osgbl722m22jayidx0n",
285
+ ingestionConfig={
286
+ "chunkMaxTokens": 1000,
287
+ "chunkStrategy": "default",
288
+ "uniqueIngestionMode": "standard",
289
+ },
285
290
  )
286
291
 
287
292
  def upload_file(
@@ -291,6 +296,7 @@ def upload_file(
291
296
  displayed_filename,
292
297
  mimeType,
293
298
  scope_or_unique_path,
299
+ ingestion_config=None,
294
300
  ):
295
301
  size = os.path.getsize(path_to_file)
296
302
  createdContent = unique_sdk.Content.upsert(
@@ -300,6 +306,7 @@ def upload_file(
300
306
  "key": displayed_filename,
301
307
  "title": displayed_filename,
302
308
  "mimeType": mimeType,
309
+ "ingestionConfig": ingestionConfig,
303
310
  },
304
311
  scopeId=scope_or_unique_path,
305
312
  )
@@ -325,6 +332,7 @@ def upload_file(
325
332
  "title": displayed_filename,
326
333
  "mimeType": mimeType,
327
334
  "byteSize": size,
335
+ "ingestionConfig": ingestionConfig,
328
336
  },
329
337
  scopeId=scope_or_unique_path,
330
338
  readUrl=createdContent.readUrl,
@@ -529,6 +537,7 @@ These are the options are available for `searchType`:
529
537
  `scopeIds` Specifies a collection of scope IDs to confine the search.
530
538
  `language` Optional. The language specification for full text search.
531
539
  `reranker` Optional. The reranker service to be used for re-ranking the search results.
540
+ `chatId` Optional, adds the documents uploaded in this chat to the scope of searched documents.
532
541
 
533
542
  ```python
534
543
  search = unique_sdk.Search.create(
@@ -700,7 +709,7 @@ A metadata filter such as the one designed above can be used in a `Search.create
700
709
 
701
710
  ### Chat History
702
711
 
703
- #### `unique_sdk.util.chat_history.load_history`
712
+ #### `unique_sdk.utils.chat_history.load_history`
704
713
 
705
714
  A helper function that makes sure the chat history is fully loaded and cut to the size of the token window that it fits into the next round of chat interactions.
706
715
 
@@ -718,7 +727,7 @@ history = unique_sdk.utils.chat_history.load_history(
718
727
  )
719
728
  ```
720
729
 
721
- #### `unique_sdk.util.chat_history.convert_chat_history_to_injectable_string`
730
+ #### `unique_sdk.utils.chat_history.convert_chat_history_to_injectable_string`
722
731
 
723
732
  convert history into a string that can be injected into a prompt. it als returns the token length of the converted history.
724
733
 
@@ -732,7 +741,7 @@ chat_history-string, chat_context_token_length = unique_sdk.utils.chat_history.c
732
741
 
733
742
  Interacting with the knowledge-base.
734
743
 
735
- #### `unique_sdk.util.file_io.download_content`
744
+ #### `unique_sdk.utils.file_io.download_content`
736
745
 
737
746
  download files and save them into a folder in `/tmp`
738
747
 
@@ -748,7 +757,7 @@ pdfFile = download_content(
748
757
  }
749
758
  ```
750
759
 
751
- #### `unique_sdk.util.file_io.upload_file`
760
+ #### `unique_sdk.utils.file_io.upload_file`
752
761
 
753
762
  Allows for uploading files that then get ingested in a scope or a chat.
754
763
 
@@ -758,15 +767,15 @@ createdContent = upload_file(
758
767
  userId=userId,
759
768
  path_to_file="/tmp/hello.pdf",
760
769
  displayed_filename="hello.pdf",
761
- mimeType="application/pdf",
762
- uploadScope="scope_stcj2osgbl722m22jayidx0n",
770
+ mime_type="application/pdf",
771
+ scope_or_unique_path="scope_stcj2osgbl722m22jayidx0n",
763
772
  chat_id=None,
764
773
  )
765
774
  ```
766
775
 
767
776
  ### Sources
768
777
 
769
- #### `unique_sdk.util.sources.merge_sources`
778
+ #### `unique_sdk.utils.sources.merge_sources`
770
779
 
771
780
  Merges multiple search results based on their 'id', removing redundant document and info markers.
772
781
 
@@ -795,15 +804,15 @@ search = unique_sdk.Search.create(
795
804
  chatOnly=False,
796
805
  )
797
806
 
798
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
807
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
799
808
  search["data"], config["maxTokens"] - historyLength
800
809
  )
801
810
 
802
- searchContext = unique_sdk.util.sources.merge_sources(search)
811
+ searchContext = unique_sdk.utils.sources.merge_sources(search)
803
812
 
804
813
  ```
805
814
 
806
- #### `unique_sdk.util.sources.sort_sources`
815
+ #### `unique_sdk.utils.sources.sort_sources`
807
816
 
808
817
  Sort sources by order of appearance in documents
809
818
 
@@ -820,14 +829,14 @@ search = unique_sdk.Search.create(
820
829
  chatOnly=False,
821
830
  )
822
831
 
823
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
832
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
824
833
  search["data"], config["maxTokens"] - historyLength
825
834
  )
826
835
 
827
- searchContext = unique_sdk.util.sources.sort_sources(search)
836
+ searchContext = unique_sdk.utils.sources.sort_sources(search)
828
837
  ```
829
838
 
830
- #### `unique_sdk.util.sources.post_process_sources`
839
+ #### `unique_sdk.utils.sources.post_process_sources`
831
840
 
832
841
  Post-processes the provided text by converting source references into superscript numerals (required
833
842
  format by backend to display sources in the chat window)
@@ -854,7 +863,7 @@ text_with_sup = post_process_sources(text)
854
863
 
855
864
  ### Token
856
865
 
857
- #### unique_sdk.util.token.pick_search_results_for_token_window
866
+ #### unique_sdk.utils.token.pick_search_results_for_token_window
858
867
 
859
868
  Selects and returns a list of search results that fit within a specified token limit.
860
869
 
@@ -883,12 +892,12 @@ search = unique_sdk.Search.create(
883
892
  chatOnly=False,
884
893
  )
885
894
 
886
- searchContext = unique_sdk.util.token.pick_search_results_for_token_window(
895
+ searchContext = unique_sdk.utils.token.pick_search_results_for_token_window(
887
896
  search["data"], config["maxTokens"] - historyLength
888
897
  )
889
898
  ```
890
899
 
891
- #### unique_sdk.util.token.count_tokens
900
+ #### unique_sdk.utils.token.count_tokens
892
901
 
893
902
  Counts the number of tokens in the provided text.
894
903
 
@@ -905,7 +914,7 @@ Returns:
905
914
 
906
915
  ```python
907
916
  hello = "hello you!"
908
- searchContext = unique_sdk.util.token.count_tokens(hello)
917
+ searchContext = unique_sdk.utils.token.count_tokens(hello)
909
918
  ```
910
919
 
911
920
  ## Error Handling
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_sdk"
3
- version = "0.9.22"
3
+ version = "0.9.26"
4
4
  description = ""
5
5
  authors = [
6
6
  "Martin Fadler <martin.fadler@unique.ch>",
@@ -9,6 +9,9 @@ authors = [
9
9
  ]
10
10
  readme = ["README.md", "CHANGELOG.md"]
11
11
  license = "MIT"
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3.11"
14
+ ]
12
15
 
13
16
  [tool.poetry.dependencies]
14
17
  python = "^3.11"
@@ -65,8 +65,28 @@ class Content(APIResource["Content"]):
65
65
  where: "Content.ContentWhereInput"
66
66
  chatId: NotRequired[str]
67
67
 
68
- class IngestionConfig(TypedDict):
68
+ class CustomApiOptions(TypedDict):
69
+ apiIdentifier: str
70
+ apiPayload: Optional[str]
71
+ customisationType: str
72
+
73
+ class VttConfig(TypedDict, total=False):
74
+ languageModel: Optional[str]
75
+
76
+ class IngestionConfig(TypedDict, total=False):
77
+ chunkMaxTokens: Optional[int]
78
+ chunkMaxTokensOnePager: Optional[int]
79
+ chunkMinTokens: Optional[int]
80
+ chunkStrategy: Optional[str]
81
+ customApiOptions: Optional[List["Content.CustomApiOptions"]]
82
+ documentMinTokens: Optional[int]
83
+ excelReadMode: Optional[str]
84
+ jpgReadMode: Optional[str]
85
+ pdfReadMode: Optional[str]
86
+ pptReadMode: Optional[str]
69
87
  uniqueIngestionMode: str
88
+ vttConfig: Optional["Content.VttConfig"]
89
+ wordReadMode: Optional[str]
70
90
 
71
91
  class Input(TypedDict):
72
92
  key: str
@@ -8,7 +8,7 @@ class Search(APIResource["Search"]):
8
8
  OBJECT_NAME: ClassVar[Literal["search.search"]] = "search.search"
9
9
 
10
10
  class CreateParams(RequestOptions):
11
- chatId: str
11
+ chatId: NotRequired[Optional[str]]
12
12
  searchString: str
13
13
  searchType: Literal["VECTOR", "COMBINED"]
14
14
  language: NotRequired[Optional[str]]
@@ -1,10 +1,12 @@
1
1
  import os
2
2
  import tempfile
3
3
  from pathlib import Path
4
+ from typing import Optional
4
5
 
5
6
  import requests
6
7
 
7
8
  import unique_sdk
9
+ from unique_sdk.api_resources._content import Content
8
10
 
9
11
 
10
12
  # download readUrl a random directory in /tmp
@@ -38,19 +40,21 @@ def upload_file(
38
40
  mime_type,
39
41
  scope_or_unique_path=None,
40
42
  chat_id=None,
43
+ ingestion_config: Optional[Content.IngestionConfig] = None,
41
44
  ):
42
45
  # check that chatid or scope_or_unique_path is provided
43
46
  if not chat_id and not scope_or_unique_path:
44
47
  raise ValueError("chat_id or scope_or_unique_path must be provided")
45
48
 
46
49
  size = os.path.getsize(path_to_file)
47
- createdContent = unique_sdk.Content.upsert(
50
+ createdContent = Content.upsert(
48
51
  user_id=userId,
49
52
  company_id=companyId,
50
53
  input={
51
54
  "key": displayed_filename,
52
55
  "title": displayed_filename,
53
56
  "mimeType": mime_type,
57
+ "ingestionConfig": ingestion_config, # Pass ingestionConfig here
54
58
  },
55
59
  scopeId=scope_or_unique_path,
56
60
  chatId=chat_id,
@@ -78,6 +82,7 @@ def upload_file(
78
82
  "title": displayed_filename,
79
83
  "mimeType": mime_type,
80
84
  "byteSize": size,
85
+ "ingestionConfig": ingestion_config,
81
86
  },
82
87
  fileUrl=createdContent.readUrl,
83
88
  chatId=chat_id,
@@ -91,6 +96,7 @@ def upload_file(
91
96
  "title": displayed_filename,
92
97
  "mimeType": mime_type,
93
98
  "byteSize": size,
99
+ "ingestionConfig": ingestion_config,
94
100
  },
95
101
  fileUrl=createdContent.readUrl,
96
102
  scopeId=scope_or_unique_path,
File without changes