sunholo 0.104.0__tar.gz → 0.104.2__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 (164) hide show
  1. {sunholo-0.104.0 → sunholo-0.104.2}/PKG-INFO +2 -4
  2. {sunholo-0.104.0 → sunholo-0.104.2}/setup.py +1 -3
  3. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/flask/base.py +1 -12
  4. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/flask/vac_routes.py +35 -3
  5. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/PKG-INFO +2 -4
  6. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/requires.txt +0 -2
  7. {sunholo-0.104.0 → sunholo-0.104.2}/LICENSE.txt +0 -0
  8. {sunholo-0.104.0 → sunholo-0.104.2}/MANIFEST.in +0 -0
  9. {sunholo-0.104.0 → sunholo-0.104.2}/README.md +0 -0
  10. {sunholo-0.104.0 → sunholo-0.104.2}/setup.cfg +0 -0
  11. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/__init__.py +0 -0
  12. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/__init__.py +0 -0
  13. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/chat_history.py +0 -0
  14. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/dispatch_to_qa.py +0 -0
  15. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/fastapi/__init__.py +0 -0
  16. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/fastapi/base.py +0 -0
  17. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/fastapi/qna_routes.py +0 -0
  18. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/flask/__init__.py +0 -0
  19. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/flask/qna_routes.py +0 -0
  20. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/langserve.py +0 -0
  21. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/pubsub.py +0 -0
  22. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/route.py +0 -0
  23. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/special_commands.py +0 -0
  24. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/agents/swagger.py +0 -0
  25. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/archive/__init__.py +0 -0
  26. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/archive/archive.py +0 -0
  27. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/auth/__init__.py +0 -0
  28. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/auth/gcloud.py +0 -0
  29. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/auth/refresh.py +0 -0
  30. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/auth/run.py +0 -0
  31. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/azure/__init__.py +0 -0
  32. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/azure/auth.py +0 -0
  33. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/azure/blobs.py +0 -0
  34. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/azure/event_grid.py +0 -0
  35. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/bots/__init__.py +0 -0
  36. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/bots/discord.py +0 -0
  37. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/bots/github_webhook.py +0 -0
  38. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/bots/webapp.py +0 -0
  39. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/__init__.py +0 -0
  40. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/azure.py +0 -0
  41. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/doc_handling.py +0 -0
  42. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/encode_metadata.py +0 -0
  43. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/images.py +0 -0
  44. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/loaders.py +0 -0
  45. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/message_data.py +0 -0
  46. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/pdfs.py +0 -0
  47. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/process_chunker_data.py +0 -0
  48. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/publish.py +0 -0
  49. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/pubsub.py +0 -0
  50. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/chunker/splitter.py +0 -0
  51. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/__init__.py +0 -0
  52. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/chat_vac.py +0 -0
  53. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/cli.py +0 -0
  54. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/cli_init.py +0 -0
  55. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/configs.py +0 -0
  56. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/deploy.py +0 -0
  57. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/embedder.py +0 -0
  58. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/merge_texts.py +0 -0
  59. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/run_proxy.py +0 -0
  60. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/sun_rich.py +0 -0
  61. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/swagger.py +0 -0
  62. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/cli/vertex.py +0 -0
  63. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/components/__init__.py +0 -0
  64. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/components/llm.py +0 -0
  65. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/components/retriever.py +0 -0
  66. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/components/vectorstore.py +0 -0
  67. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/custom_logging.py +0 -0
  68. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/__init__.py +0 -0
  69. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/alloydb.py +0 -0
  70. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/alloydb_client.py +0 -0
  71. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/database.py +0 -0
  72. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/lancedb.py +0 -0
  73. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/create_function.sql +0 -0
  74. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/create_function_time.sql +0 -0
  75. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/create_table.sql +0 -0
  76. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  77. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/return_sources.sql +0 -0
  78. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/sql/sb/setup.sql +0 -0
  79. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/static_dbs.py +0 -0
  80. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/database/uuid.py +0 -0
  81. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/discovery_engine/__init__.py +0 -0
  82. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/discovery_engine/chunker_handler.py +0 -0
  83. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/discovery_engine/create_new.py +0 -0
  84. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  85. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  86. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/embedder/__init__.py +0 -0
  87. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/embedder/embed_chunk.py +0 -0
  88. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/excel/__init__.py +0 -0
  89. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/excel/plugin.py +0 -0
  90. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/__init__.py +0 -0
  91. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/add_file.py +0 -0
  92. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/download_folder.py +0 -0
  93. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/download_url.py +0 -0
  94. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/extract_and_sign.py +0 -0
  95. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/gcs/metadata.py +0 -0
  96. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/genai/__init__.py +0 -0
  97. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/genai/images.py +0 -0
  98. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/genai/init.py +0 -0
  99. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/genai/process_funcs_cls.py +0 -0
  100. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/genai/safety.py +0 -0
  101. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/invoke/__init__.py +0 -0
  102. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/invoke/async_class.py +0 -0
  103. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/invoke/direct_vac_func.py +0 -0
  104. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/invoke/invoke_vac_utils.py +0 -0
  105. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/langfuse/__init__.py +0 -0
  106. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/langfuse/callback.py +0 -0
  107. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/langfuse/evals.py +0 -0
  108. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/langfuse/prompts.py +0 -0
  109. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/llamaindex/__init__.py +0 -0
  110. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/llamaindex/get_files.py +0 -0
  111. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/llamaindex/import_files.py +0 -0
  112. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/llamaindex/llamaindex_class.py +0 -0
  113. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/llamaindex/user_history.py +0 -0
  114. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/lookup/__init__.py +0 -0
  115. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/lookup/model_lookup.yaml +0 -0
  116. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/patches/__init__.py +0 -0
  117. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/patches/langchain/__init__.py +0 -0
  118. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/patches/langchain/lancedb.py +0 -0
  119. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/patches/langchain/vertexai.py +0 -0
  120. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/pubsub/__init__.py +0 -0
  121. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/pubsub/process_pubsub.py +0 -0
  122. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/pubsub/pubsub_manager.py +0 -0
  123. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/qna/__init__.py +0 -0
  124. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/qna/parsers.py +0 -0
  125. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/qna/retry.py +0 -0
  126. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/streaming/__init__.py +0 -0
  127. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/streaming/content_buffer.py +0 -0
  128. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/streaming/langserve.py +0 -0
  129. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/streaming/stream_lookup.py +0 -0
  130. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/streaming/streaming.py +0 -0
  131. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/summarise/__init__.py +0 -0
  132. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/summarise/summarise.py +0 -0
  133. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/terraform/__init__.py +0 -0
  134. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/terraform/tfvars_editor.py +0 -0
  135. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/tools/__init__.py +0 -0
  136. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/tools/web_browser.py +0 -0
  137. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/__init__.py +0 -0
  138. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/api_key.py +0 -0
  139. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/big_context.py +0 -0
  140. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/config.py +0 -0
  141. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/config_class.py +0 -0
  142. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/config_schema.py +0 -0
  143. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/gcp.py +0 -0
  144. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/gcp_project.py +0 -0
  145. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/mime.py +0 -0
  146. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/parsers.py +0 -0
  147. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/timedelta.py +0 -0
  148. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/user_ids.py +0 -0
  149. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/utils/version.py +0 -0
  150. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/__init__.py +0 -0
  151. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/extensions_call.py +0 -0
  152. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/extensions_class.py +0 -0
  153. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/genai_functions.py +0 -0
  154. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/init.py +0 -0
  155. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/memory_tools.py +0 -0
  156. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/safety.py +0 -0
  157. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo/vertex/type_dict_to_json.py +0 -0
  158. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/SOURCES.txt +0 -0
  159. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/dependency_links.txt +0 -0
  160. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/entry_points.txt +0 -0
  161. {sunholo-0.104.0 → sunholo-0.104.2}/sunholo.egg-info/top_level.txt +0 -0
  162. {sunholo-0.104.0 → sunholo-0.104.2}/tests/test_async.py +0 -0
  163. {sunholo-0.104.0 → sunholo-0.104.2}/tests/test_chat_history.py +0 -0
  164. {sunholo-0.104.0 → sunholo-0.104.2}/tests/test_config.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.104.0
3
+ Version: 0.104.2
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Home-page: https://github.com/sunholo-data/sunholo-py
6
- Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.2.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -30,7 +30,6 @@ Requires-Dist: azure-identity; extra == "all"
30
30
  Requires-Dist: azure-storage-blob; extra == "all"
31
31
  Requires-Dist: fastapi; extra == "all"
32
32
  Requires-Dist: flask; extra == "all"
33
- Requires-Dist: flask-cors; extra == "all"
34
33
  Requires-Dist: google-auth; extra == "all"
35
34
  Requires-Dist: google-auth-httplib2; extra == "all"
36
35
  Requires-Dist: google-auth-oauthlib; extra == "all"
@@ -130,7 +129,6 @@ Requires-Dist: playwright; extra == "tools"
130
129
  Provides-Extra: http
131
130
  Requires-Dist: fastapi; extra == "http"
132
131
  Requires-Dist: flask; extra == "http"
133
- Requires-Dist: flask-cors; extra == "http"
134
132
  Requires-Dist: gunicorn; extra == "http"
135
133
  Requires-Dist: httpcore; extra == "http"
136
134
  Requires-Dist: httpx; extra == "http"
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- version = '0.104.0'
3
+ version = '0.104.2'
4
4
 
5
5
  setup(
6
6
  name='sunholo',
@@ -42,7 +42,6 @@ setup(
42
42
  "azure-storage-blob",
43
43
  "fastapi",
44
44
  "flask",
45
- "flask-cors",
46
45
  "google-auth",
47
46
  "google-auth-httplib2",
48
47
  "google-auth-oauthlib",
@@ -152,7 +151,6 @@ setup(
152
151
  'http': [
153
152
  "fastapi",
154
153
  "flask",
155
- "flask-cors",
156
154
  "gunicorn",
157
155
  "httpcore",
158
156
  "httpx",
@@ -13,20 +13,9 @@
13
13
  # limitations under the License.
14
14
  def create_app(name):
15
15
  from flask import Flask
16
- from flask_cors import CORS
17
-
16
+
18
17
  app = Flask(name)
19
18
 
20
- CORS(app,
21
- origins=["https://*.sunholo.com", "http://*.sunholo.com"], # Allow all subdomains of sunholo.com
22
- methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], # Allow all necessary HTTP methods
23
- allow_headers=["DNT", "User-Agent", "X-Requested-With", "If-Modified-Since",
24
- "Cache-Control", "Content-Type", "Range", "Authorization", "x-api-key"], # Add custom headers
25
- expose_headers=["Content-Length", "Content-Range"], # Optional: headers that are exposed to clients
26
- supports_credentials=True,
27
- max_age=1728000 # Set max age of preflight request caching (in seconds)
28
- )
29
-
30
19
  app.config['TRAP_HTTP_EXCEPTIONS'] = True
31
20
  app.config['PROPAGATE_EXCEPTIONS'] = True
32
21
 
@@ -63,7 +63,7 @@ if __name__ == "__main__":
63
63
  self.vac_interpreter = vac_interpreter or partial(self.vac_interpreter_default)
64
64
  self.additional_routes = additional_routes if additional_routes is not None else []
65
65
  self.register_routes()
66
-
66
+
67
67
 
68
68
  def vac_interpreter_default(self, question: str, vector_name: str, chat_history=[], **kwargs):
69
69
  # Create a callback that does nothing for streaming if you don't want intermediate outputs
@@ -103,6 +103,7 @@ if __name__ == "__main__":
103
103
 
104
104
  # Authentication middleware
105
105
  self.app.before_request(self.check_authentication)
106
+ self.app.after_request(self.register_after_request)
106
107
 
107
108
  # OpenAI health endpoint
108
109
  self.app.route('/openai/health', methods=['GET', 'POST'])(self.openai_health_endpoint)
@@ -110,9 +111,25 @@ if __name__ == "__main__":
110
111
  # OpenAI compatible endpoint
111
112
  self.app.route('/openai/v1/chat/completions', methods=['POST'])(self.handle_openai_compatible_endpoint)
112
113
  self.app.route('/openai/v1/chat/completions/<vector_name>', methods=['POST'])(self.handle_openai_compatible_endpoint)
113
- # Register additional routes
114
+
115
+ # Register OPTIONS handler for CORS
116
+ self.app.route('/<path:path>', methods=['OPTIONS'])(self.handle_options)
117
+
114
118
  self.register_additional_routes()
115
119
 
120
+ def handle_options(self):
121
+ response = Response(status=200)
122
+ response.headers.add('Access-Control-Allow-Origin', '*')
123
+
124
+ # Reflect the request's `Access-Control-Request-Headers`
125
+ request_headers = request.headers.get('Access-Control-Request-Headers', '')
126
+ response.headers.add('Access-Control-Allow-Headers', request_headers)
127
+
128
+ # Specify allowed methods
129
+ response.headers.add('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
130
+
131
+ return response
132
+
116
133
  def register_additional_routes(self):
117
134
  """
118
135
  Registers additional custom routes provided during initialization.
@@ -152,6 +169,21 @@ if __name__ == "__main__":
152
169
  for route in self.additional_routes:
153
170
  self.app.route(route["rule"], methods=route["methods"])(route["handler"])
154
171
 
172
+ def register_after_request(self, response):
173
+ """
174
+ Register after_request to add CORS headers.
175
+ """
176
+ log.debug(f'Request headers: {request.headers}')
177
+ # the header forwarded
178
+
179
+ response.headers.add('Access-Control-Allow-Origin', '*')
180
+ response.headers.add('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-api-key')
181
+ response.headers.add('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
182
+
183
+ log.debug(f'Response headers: {response.headers}')
184
+
185
+ return response
186
+
155
187
  def home(self):
156
188
  return jsonify("OK")
157
189
 
@@ -385,7 +417,7 @@ if __name__ == "__main__":
385
417
  bot_output = {'answer': f'QNA_ERROR: An error occurred while processing /vac/{vector_name}: {str(err)} traceback: {traceback.format_exc()}'}
386
418
  if span:
387
419
  gen.end(output=bot_output)
388
-
420
+
389
421
  if trace:
390
422
  span.end(output=jsonify(bot_output))
391
423
  trace.update(output=jsonify(bot_output))
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.104.0
3
+ Version: 0.104.2
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Home-page: https://github.com/sunholo-data/sunholo-py
6
- Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.2.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -30,7 +30,6 @@ Requires-Dist: azure-identity; extra == "all"
30
30
  Requires-Dist: azure-storage-blob; extra == "all"
31
31
  Requires-Dist: fastapi; extra == "all"
32
32
  Requires-Dist: flask; extra == "all"
33
- Requires-Dist: flask-cors; extra == "all"
34
33
  Requires-Dist: google-auth; extra == "all"
35
34
  Requires-Dist: google-auth-httplib2; extra == "all"
36
35
  Requires-Dist: google-auth-oauthlib; extra == "all"
@@ -130,7 +129,6 @@ Requires-Dist: playwright; extra == "tools"
130
129
  Provides-Extra: http
131
130
  Requires-Dist: fastapi; extra == "http"
132
131
  Requires-Dist: flask; extra == "http"
133
- Requires-Dist: flask-cors; extra == "http"
134
132
  Requires-Dist: gunicorn; extra == "http"
135
133
  Requires-Dist: httpcore; extra == "http"
136
134
  Requires-Dist: httpx; extra == "http"
@@ -11,7 +11,6 @@ azure-identity
11
11
  azure-storage-blob
12
12
  fastapi
13
13
  flask
14
- flask-cors
15
14
  google-auth
16
15
  google-auth-httplib2
17
16
  google-auth-oauthlib
@@ -108,7 +107,6 @@ pillow
108
107
  [http]
109
108
  fastapi
110
109
  flask
111
- flask-cors
112
110
  gunicorn
113
111
  httpcore
114
112
  httpx
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes