sunholo 0.62.14__tar.gz → 0.62.16__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 (118) hide show
  1. {sunholo-0.62.14 → sunholo-0.62.16}/PKG-INFO +2 -2
  2. {sunholo-0.62.14 → sunholo-0.62.16}/setup.py +1 -1
  3. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/flask/qna_routes.py +3 -4
  4. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/cli.py +2 -0
  5. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/run_proxy.py +7 -1
  6. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/components/retriever.py +2 -2
  7. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/database.py +2 -1
  8. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/qna/parsers.py +1 -1
  9. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/vertex/memory_tools.py +6 -1
  10. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/PKG-INFO +2 -2
  11. {sunholo-0.62.14 → sunholo-0.62.16}/LICENSE.txt +0 -0
  12. {sunholo-0.62.14 → sunholo-0.62.16}/MANIFEST.in +0 -0
  13. {sunholo-0.62.14 → sunholo-0.62.16}/README.md +0 -0
  14. {sunholo-0.62.14 → sunholo-0.62.16}/setup.cfg +0 -0
  15. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/__init__.py +0 -0
  16. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/__init__.py +0 -0
  17. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/chat_history.py +0 -0
  18. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/dispatch_to_qa.py +0 -0
  19. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/fastapi/__init__.py +0 -0
  20. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/fastapi/base.py +0 -0
  21. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/fastapi/qna_routes.py +0 -0
  22. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/flask/__init__.py +0 -0
  23. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/flask/base.py +0 -0
  24. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/langserve.py +0 -0
  25. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/pubsub.py +0 -0
  26. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/route.py +0 -0
  27. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/agents/special_commands.py +0 -0
  28. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/archive/__init__.py +0 -0
  29. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/archive/archive.py +0 -0
  30. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/auth/__init__.py +0 -0
  31. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/auth/run.py +0 -0
  32. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/bots/__init__.py +0 -0
  33. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/bots/discord.py +0 -0
  34. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/bots/github_webhook.py +0 -0
  35. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/bots/webapp.py +0 -0
  36. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/__init__.py +0 -0
  37. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/data_to_embed_pubsub.py +0 -0
  38. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/doc_handling.py +0 -0
  39. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/images.py +0 -0
  40. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/loaders.py +0 -0
  41. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/message_data.py +0 -0
  42. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/pdfs.py +0 -0
  43. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/publish.py +0 -0
  44. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/chunker/splitter.py +0 -0
  45. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/__init__.py +0 -0
  46. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/chat_vac.py +0 -0
  47. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/cli_init.py +0 -0
  48. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/configs.py +0 -0
  49. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/deploy.py +0 -0
  50. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/embedder.py +0 -0
  51. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/merge_texts.py +0 -0
  52. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/cli/sun_rich.py +0 -0
  53. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/components/__init__.py +0 -0
  54. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/components/llm.py +0 -0
  55. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/components/vectorstore.py +0 -0
  56. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/__init__.py +0 -0
  57. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/alloydb.py +0 -0
  58. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/lancedb.py +0 -0
  59. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/create_function.sql +0 -0
  60. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/create_function_time.sql +0 -0
  61. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/create_table.sql +0 -0
  62. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  63. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/return_sources.sql +0 -0
  64. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/sql/sb/setup.sql +0 -0
  65. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/static_dbs.py +0 -0
  66. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/database/uuid.py +0 -0
  67. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/embedder/__init__.py +0 -0
  68. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/embedder/embed_chunk.py +0 -0
  69. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/gcs/__init__.py +0 -0
  70. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/gcs/add_file.py +0 -0
  71. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/gcs/download_url.py +0 -0
  72. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/gcs/metadata.py +0 -0
  73. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/langfuse/__init__.py +0 -0
  74. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/langfuse/callback.py +0 -0
  75. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/langfuse/prompts.py +0 -0
  76. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/llamaindex/__init__.py +0 -0
  77. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/llamaindex/generate.py +0 -0
  78. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/llamaindex/get_files.py +0 -0
  79. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/llamaindex/import_files.py +0 -0
  80. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/logging.py +0 -0
  81. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/lookup/__init__.py +0 -0
  82. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/lookup/model_lookup.yaml +0 -0
  83. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/patches/__init__.py +0 -0
  84. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/patches/langchain/__init__.py +0 -0
  85. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/patches/langchain/lancedb.py +0 -0
  86. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/patches/langchain/vertexai.py +0 -0
  87. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/pubsub/__init__.py +0 -0
  88. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/pubsub/process_pubsub.py +0 -0
  89. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/pubsub/pubsub_manager.py +0 -0
  90. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/qna/__init__.py +0 -0
  91. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/qna/retry.py +0 -0
  92. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/streaming/__init__.py +0 -0
  93. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/streaming/content_buffer.py +0 -0
  94. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/streaming/langserve.py +0 -0
  95. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/streaming/stream_lookup.py +0 -0
  96. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/streaming/streaming.py +0 -0
  97. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/summarise/__init__.py +0 -0
  98. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/summarise/summarise.py +0 -0
  99. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/__init__.py +0 -0
  100. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/big_context.py +0 -0
  101. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/config.py +0 -0
  102. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/config_schema.py +0 -0
  103. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/gcp.py +0 -0
  104. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/gcp_project.py +0 -0
  105. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/parsers.py +0 -0
  106. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/timedelta.py +0 -0
  107. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/utils/user_ids.py +0 -0
  108. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/vertex/__init__.py +0 -0
  109. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/vertex/init.py +0 -0
  110. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo/vertex/safety.py +0 -0
  111. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/SOURCES.txt +0 -0
  112. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/dependency_links.txt +0 -0
  113. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/entry_points.txt +0 -0
  114. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/requires.txt +0 -0
  115. {sunholo-0.62.14 → sunholo-0.62.16}/sunholo.egg-info/top_level.txt +0 -0
  116. {sunholo-0.62.14 → sunholo-0.62.16}/tests/test_chat_history.py +0 -0
  117. {sunholo-0.62.14 → sunholo-0.62.16}/tests/test_config.py +0 -0
  118. {sunholo-0.62.14 → sunholo-0.62.16}/tests/test_dispatch_to_qa.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.62.14
3
+ Version: 0.62.16
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.62.14.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.62.16.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  # Define your base version
4
- version = '0.62.14'
4
+ version = '0.62.16'
5
5
 
6
6
  setup(
7
7
  name='sunholo',
@@ -45,7 +45,6 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
45
45
  return jsonify({"status": "healthy"})
46
46
 
47
47
  @app.route('/vac/streaming/<vector_name>', methods=['POST'])
48
- @observe()
49
48
  def stream_qa(vector_name):
50
49
  observed_stream_interpreter = observe()(stream_interpreter)
51
50
  prep = prep_vac(request, vector_name)
@@ -111,8 +110,8 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
111
110
  return response
112
111
 
113
112
  @app.route('/vac/<vector_name>', methods=['POST'])
114
- @observe()
115
113
  def process_qna(vector_name):
114
+ observed_vac_interpreter = observe()(vac_interpreter)
116
115
  prep = prep_vac(request, vector_name)
117
116
  log.debug(f"Processing prep: {prep}")
118
117
  trace = prep["trace"]
@@ -132,13 +131,13 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
132
131
  input = all_input,
133
132
  model=vac_config.get("model") or vac_config.get("llm")
134
133
  )
135
- bot_output = vac_interpreter(
134
+ bot_output = observed_vac_interpreter(
136
135
  question=all_input["user_input"],
137
136
  vector_name=vector_name,
138
137
  chat_history=all_input["chat_history"],
139
138
  **all_input["kwargs"]
140
139
  )
141
- if generation:
140
+ if span:
142
141
  generation.end(output=bot_output)
143
142
  # {"answer": "The answer", "source_documents": [{"page_content": "The page content", "metadata": "The metadata"}]}
144
143
  bot_output = parse_output(bot_output)
@@ -83,6 +83,8 @@ def main(args=None):
83
83
  # embed command
84
84
  setup_embedder_subparser(subparsers)
85
85
 
86
+ #TODO: add database setup commands: alloydb and supabase
87
+
86
88
  args = parser.parse_args(args)
87
89
 
88
90
  if args.debug:
@@ -2,6 +2,7 @@ import subprocess
2
2
  import os
3
3
  import signal
4
4
  import json
5
+ import socket
5
6
 
6
7
  from .sun_rich import console
7
8
  from rich.table import Table
@@ -11,6 +12,11 @@ PROXY_TRACKER_FILE = '.vac_proxy_tracker.json'
11
12
  DEFAULT_PORT = 8080
12
13
 
13
14
 
15
+ def is_port_in_use(port):
16
+ """Check if a given port is in use on the localhost."""
17
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
18
+ return s.connect_ex(('localhost', port)) == 0
19
+
14
20
  def get_next_available_port(proxies, default_port):
15
21
  """
16
22
  Get the next available port starting from the default port.
@@ -24,7 +30,7 @@ def get_next_available_port(proxies, default_port):
24
30
  """
25
31
  used_ports = {info["port"] for info in proxies.values()}
26
32
  port = default_port
27
- while port in used_ports:
33
+ while port in used_ports or is_port_in_use(port):
28
34
  port += 1
29
35
  return port
30
36
 
@@ -29,7 +29,7 @@ from langchain.retrievers import ContextualCompressionRetriever
29
29
  def load_memories(vector_name):
30
30
  memories = load_config_key("memory", vector_name, kind="vacConfig")
31
31
  log.info(f"Found memory settings for {vector_name}: {memories}")
32
- if len(memories) == 0:
32
+ if not memories or len(memories) == 0:
33
33
  log.info(f"No memory settings found for {vector_name}")
34
34
  return None
35
35
 
@@ -67,7 +67,7 @@ def pick_retriever(vector_name, embeddings=None):
67
67
 
68
68
  #TODO: more memory stores here
69
69
 
70
- if len(retriever_list) == 0:
70
+ if not retriever_list or len(retriever_list) == 0:
71
71
  log.info(f"No retrievers were created for {memories}")
72
72
  return None
73
73
 
@@ -80,7 +80,8 @@ def setup_database(type, vector_name:str, verbose:bool=False):
80
80
  execute_sql_from_file("database/sql/sb/create_table.sql", params, verbose=verbose, connection_env=connection_env)
81
81
  execute_sql_from_file("database/sql/sb/create_function.sql", params, verbose=verbose, connection_env=connection_env)
82
82
 
83
- if verbose: print("Ran all setup SQL statements")
83
+ if verbose:
84
+ print("Ran all setup SQL statements")
84
85
 
85
86
  return True
86
87
 
@@ -36,7 +36,7 @@ def parse_output(bot_output):
36
36
 
37
37
  return bot_output
38
38
 
39
- elif isinstance(bot_output, dict) and 'metadata' in bot_output and isinstance(bot_output.get('metadata')) and 'source_documents' in bot_output.get('metadata'):
39
+ elif isinstance(bot_output, dict) and 'metadata' in bot_output and isinstance(bot_output.get('metadata'), dict) and 'source_documents' in bot_output.get('metadata'):
40
40
  metadata = bot_output.get('metadata')
41
41
  bot_output['source_documents'] = [document_to_dict(doc) for doc in metadata['source_documents']]
42
42
  if not bot_output.get("answer") or bot_output.get("answer") == "":
@@ -49,6 +49,10 @@ def get_vertex_memories(vector_name):
49
49
 
50
50
  memories = load_memories(vector_name)
51
51
  tools = []
52
+
53
+ if not memories:
54
+ return tools
55
+
52
56
  for memory in memories:
53
57
  for key, value in memory.items(): # Now iterate over the dictionary
54
58
  log.info(f"Found memory {key}")
@@ -138,4 +142,5 @@ def print_grounding_response(response):
138
142
  for uri, source in sources.items():
139
143
  markdown_text += f"{source['footnote']}. [{source['title']}]({uri})\n"
140
144
 
141
- log.info(markdown_text)
145
+ log.info(markdown_text)
146
+ return markdown_text
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.62.14
3
+ Version: 0.62.16
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.62.14.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.62.16.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes