unique_sdk 0.9.3__tar.gz → 0.9.5__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.
Files changed (37) hide show
  1. unique_sdk-0.9.5/CHANGELOG.md +27 -0
  2. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/PKG-INFO +14 -4
  3. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/pyproject.toml +1 -1
  4. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_http_client.py +31 -3
  5. unique_sdk-0.9.5/unique_sdk/_version.py +1 -0
  6. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_message.py +2 -0
  7. unique_sdk-0.9.3/CHANGELOG.md +0 -17
  8. unique_sdk-0.9.3/unique_sdk/_version.py +0 -1
  9. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/LICENSE +0 -0
  10. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/README.md +0 -0
  11. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/__init__.py +0 -0
  12. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_api_requestor.py +0 -0
  13. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_api_resource.py +0 -0
  14. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_api_version.py +0 -0
  15. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_error.py +0 -0
  16. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_list_object.py +0 -0
  17. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_object_classes.py +0 -0
  18. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_request_options.py +0 -0
  19. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_unique_object.py +0 -0
  20. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_unique_ql.py +0 -0
  21. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_unique_response.py +0 -0
  22. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_util.py +0 -0
  23. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/_webhook.py +0 -0
  24. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/__init__.py +0 -0
  25. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_acronyms.py +0 -0
  26. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_chat_completion.py +0 -0
  27. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_content.py +0 -0
  28. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_embedding.py +0 -0
  29. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_event.py +0 -0
  30. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_integrated.py +0 -0
  31. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_search.py +0 -0
  32. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_search_string.py +0 -0
  33. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/api_resources/_short_term_memory.py +0 -0
  34. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/utils/chat_history.py +0 -0
  35. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/utils/file_io.py +0 -0
  36. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/utils/sources.py +0 -0
  37. {unique_sdk-0.9.3 → unique_sdk-0.9.5}/unique_sdk/utils/token.py +0 -0
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.9.5] - 2024-08-07
9
+ - Add `completedAt` to `ModifyParams`
10
+
11
+ ## [0.9.4] - 2024-07-31
12
+ - Add `close` and `close_async` to `http_client`
13
+ - Make `httpx` the default client for async requests
14
+
15
+ ## [0.9.3] - 2024-07-31
16
+ - `Search.create`, `Message`, `ChatCompletion` parameters that were marked `NotRequired` are now also `Optional`
17
+
18
+ ## [0.9.2] - 2024-07-30
19
+ - Bug fix in `Search.create`: langugage -> language
20
+
21
+ ## [0.9.1] - 2024-07-30
22
+ - Added parameters to `Search.create` and `Search.create_async`
23
+ - `language` for full text search
24
+ - `reranker` to reranker search results
25
+
26
+ ## [0.9.0] - 2024-07-29
27
+ - Added the possibility to make async requests to the unique APIs using either aiohttp or httpx as client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.9.3
3
+ Version: 0.9.5
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Konstantin Krauss
@@ -894,14 +894,24 @@ All notable changes to this project will be documented in this file.
894
894
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
895
895
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
896
896
 
897
+ ## [0.9.5] - 2024-08-07
898
+ - Add `completedAt` to `ModifyParams`
899
+
900
+ ## [0.9.4] - 2024-07-31
901
+ - Add `close` and `close_async` to `http_client`
902
+ - Make `httpx` the default client for async requests
903
+
897
904
  ## [0.9.3] - 2024-07-31
898
- `Search.create`, `Message`, `ChatCompletion` parameters that were marked `NotRequired` are now also `Optional`
905
+ - `Search.create`, `Message`, `ChatCompletion` parameters that were marked `NotRequired` are now also `Optional`
899
906
 
900
907
  ## [0.9.2] - 2024-07-30
901
- Bug fix in `Search.create`: langugage -> language
908
+ - Bug fix in `Search.create`: langugage -> language
902
909
 
903
910
  ## [0.9.1] - 2024-07-30
904
- - Added parameters to `Search.create`
911
+ - Added parameters to `Search.create` and `Search.create_async`
905
912
  - `language` for full text search
906
913
  - `reranker` to reranker search results
907
914
 
915
+ ## [0.9.0] - 2024-07-29
916
+ - Added the possibility to make async requests to the unique APIs using either aiohttp or httpx as client
917
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_sdk"
3
- version = "0.9.3"
3
+ version = "0.9.5"
4
4
  description = ""
5
5
  authors = [
6
6
  "Konstantin Krauss <konstantin@unique.ch>",
@@ -29,10 +29,10 @@ def new_default_http_client(*args, **kwargs) -> "HTTPClient":
29
29
 
30
30
 
31
31
  def new_http_client_async_fallback(*args, **kwargs) -> "HTTPClient":
32
- if aiohttp:
33
- impl = AIOHTTPClient
34
- elif httpx:
32
+ if httpx:
35
33
  impl = HTTPXClient
34
+ elif aiohttp:
35
+ impl = AIOHTTPClient
36
36
  else:
37
37
  impl = NoImportFoundAsyncClient
38
38
  return impl(*args, **kwargs)
@@ -51,6 +51,9 @@ class HTTPClient(object):
51
51
  def request(self, method, url, headers, post_data=None):
52
52
  raise NotImplementedError("HTTPClient subclasses must implement `request`")
53
53
 
54
+ def close(self):
55
+ raise NotImplementedError("HTTPClient subclasses must implement `close`")
56
+
54
57
  async def request_async(self, method, url, headers, post_data=None):
55
58
  if self._async_fallback_client is not None:
56
59
  return await self._async_fallback_client.request_async(
@@ -60,6 +63,11 @@ class HTTPClient(object):
60
63
  "HTTPClient subclasses must implement `request_async`"
61
64
  )
62
65
 
66
+ async def close_async(self):
67
+ if self._async_fallback_client is not None:
68
+ return await self._async_fallback_client.close_async()
69
+ raise NotImplementedError("HTTPClient subclasses must implement `close_async`")
70
+
63
71
 
64
72
  class RequestsClient(HTTPClient):
65
73
  name = "requests"
@@ -131,6 +139,10 @@ class RequestsClient(HTTPClient):
131
139
 
132
140
  return content, status_code, result.headers
133
141
 
142
+ def close(self):
143
+ if getattr(self._thread_local, "session", None) is not None:
144
+ self._thread_local.session.close()
145
+
134
146
 
135
147
  class HTTPXClient(HTTPClient):
136
148
  name = "httpx"
@@ -208,6 +220,13 @@ class HTTPXClient(HTTPClient):
208
220
  response_headers = response.headers
209
221
  return content, status_code, response_headers
210
222
 
223
+ def close(self):
224
+ if self._client is not None:
225
+ self._client.close()
226
+
227
+ async def close_async(self):
228
+ await self._client_async.aclose()
229
+
211
230
 
212
231
  class AIOHTTPClient(HTTPClient):
213
232
  name = "aiohttp"
@@ -290,6 +309,12 @@ class AIOHTTPClient(HTTPClient):
290
309
  response_headers = response.headers
291
310
  return content, status_code, response_headers
292
311
 
312
+ def close(self):
313
+ pass
314
+
315
+ async def close_async(self):
316
+ await self._session.close()
317
+
293
318
 
294
319
  class NoImportFoundAsyncClient(HTTPClient):
295
320
  def __init__(self, **kwargs):
@@ -313,3 +338,6 @@ class NoImportFoundAsyncClient(HTTPClient):
313
338
  self, method: str, url: str, headers: Mapping[str, str], post_data=None
314
339
  ):
315
340
  self.raise_async_client_import_error()
341
+
342
+ async def close_async(self):
343
+ self.raise_async_client_import_error()
@@ -0,0 +1 @@
1
+ VERSION = "0.9.4"
@@ -1,3 +1,4 @@
1
+ from datetime import datetime
1
2
  from typing import (
2
3
  Any,
3
4
  ClassVar,
@@ -46,6 +47,7 @@ class Message(APIResource["Message"]):
46
47
  text: NotRequired[Optional["str"]]
47
48
  references: Optional[List["Message.Reference"]]
48
49
  debugInfo: Optional[Dict[str, Any]]
50
+ completedAt: Optional[datetime]
49
51
 
50
52
  class DeleteParams(RequestOptions):
51
53
  chatId: str
@@ -1,17 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.9.3] - 2024-07-31
9
- `Search.create`, `Message`, `ChatCompletion` parameters that were marked `NotRequired` are now also `Optional`
10
-
11
- ## [0.9.2] - 2024-07-30
12
- Bug fix in `Search.create`: langugage -> language
13
-
14
- ## [0.9.1] - 2024-07-30
15
- - Added parameters to `Search.create`
16
- - `language` for full text search
17
- - `reranker` to reranker search results
@@ -1 +0,0 @@
1
- VERSION = "0.9.3"
File without changes
File without changes