sunholo 0.83.5__tar.gz → 0.84.1__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.
- {sunholo-0.83.5 → sunholo-0.84.1}/PKG-INFO +4 -4
- {sunholo-0.83.5 → sunholo-0.84.1}/setup.py +3 -3
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/__init__.py +1 -1
- sunholo-0.84.1/sunholo/agents/flask/__init__.py +3 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/flask/vac_routes.py +6 -6
- sunholo-0.84.1/sunholo/invoke/async_class.py +89 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/llamaindex/llamaindex_class.py +9 -1
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/llamaindex/user_history.py +16 -8
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/PKG-INFO +4 -4
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/SOURCES.txt +1 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/requires.txt +2 -2
- sunholo-0.83.5/sunholo/agents/flask/__init__.py +0 -2
- {sunholo-0.83.5 → sunholo-0.84.1}/LICENSE.txt +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/MANIFEST.in +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/README.md +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/setup.cfg +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/flask/qna_routes.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/route.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/agents/swagger.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/archive/archive.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/auth/refresh.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/auth/run.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/azure/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/azure/auth.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/azure/blobs.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/bots/discord.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/azure.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/encode_metadata.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/images.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/cli.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/configs.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/swagger.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/cli/vertex.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/components/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/components/llm.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/components/retriever.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/custom_logging.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/alloydb_client.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/database.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/database/uuid.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/gcs/download_folder.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/invoke/direct_vac_func.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/qna/retry.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/tools/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/api_key.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/config.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/config_class.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/utils/version.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/extensions_call.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/extensions_class.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/genai_functions.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/init.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/safety.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo/vertex/type_dict_to_json.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/tests/test_chat_history.py +0 -0
- {sunholo-0.83.5 → sunholo-0.84.1}/tests/test_config.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.84.1
|
|
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.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.84.1.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -21,7 +21,7 @@ License-File: LICENSE.txt
|
|
|
21
21
|
Requires-Dist: google-auth
|
|
22
22
|
Requires-Dist: ruamel.yaml
|
|
23
23
|
Requires-Dist: langchain>=0.2.12
|
|
24
|
-
Requires-Dist: langchain_experimental
|
|
24
|
+
Requires-Dist: langchain_experimental>=0.0.61
|
|
25
25
|
Requires-Dist: langchain-community>=0.2.11
|
|
26
26
|
Provides-Extra: all
|
|
27
27
|
Requires-Dist: asyncpg; extra == "all"
|
|
@@ -49,7 +49,7 @@ Requires-Dist: httpx; extra == "all"
|
|
|
49
49
|
Requires-Dist: jsonschema; extra == "all"
|
|
50
50
|
Requires-Dist: lancedb; extra == "all"
|
|
51
51
|
Requires-Dist: langchain>=0.2.12; extra == "all"
|
|
52
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: langchain-experimental>=0.0.61; extra == "all"
|
|
53
53
|
Requires-Dist: langchain-community>=0.2.11; extra == "all"
|
|
54
54
|
Requires-Dist: langchain-openai>=0.1.20; extra == "all"
|
|
55
55
|
Requires-Dist: langchain-google-genai>=1.0.5; extra == "all"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
3
|
# Define your base version
|
|
4
|
-
version = '0.
|
|
4
|
+
version = '0.84.1'
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name='sunholo',
|
|
@@ -32,7 +32,7 @@ setup(
|
|
|
32
32
|
#"tenacity==8.3.0", #TODO: remove soon
|
|
33
33
|
"ruamel.yaml",
|
|
34
34
|
"langchain>=0.2.12",
|
|
35
|
-
"langchain_experimental
|
|
35
|
+
"langchain_experimental>=0.0.61",
|
|
36
36
|
"langchain-community>=0.2.11",
|
|
37
37
|
],
|
|
38
38
|
extras_require={
|
|
@@ -63,7 +63,7 @@ setup(
|
|
|
63
63
|
"jsonschema",
|
|
64
64
|
"lancedb",
|
|
65
65
|
"langchain>=0.2.12",
|
|
66
|
-
"
|
|
66
|
+
"langchain-experimental>=0.0.61",
|
|
67
67
|
"langchain-community>=0.2.11",
|
|
68
68
|
"langchain-openai>=0.1.20",
|
|
69
69
|
"langchain-google-genai>=1.0.5",
|
|
@@ -2,6 +2,6 @@ from .chat_history import extract_chat_history
|
|
|
2
2
|
from .dispatch_to_qa import send_to_qa, send_to_qa_async
|
|
3
3
|
from .pubsub import process_pubsub
|
|
4
4
|
from .special_commands import handle_special_commands, app_to_store, handle_files
|
|
5
|
-
from .flask import register_qna_routes, create_app
|
|
5
|
+
from .flask import register_qna_routes, create_app, VACRoutes
|
|
6
6
|
from .fastapi import register_qna_fastapi_routes, create_fastapi_app
|
|
7
7
|
from .swagger import config_to_swagger
|
|
@@ -13,7 +13,7 @@ from ...utils.version import sunholo_version
|
|
|
13
13
|
import os
|
|
14
14
|
from ...gcs.add_file import add_file_to_gcs, handle_base64_image
|
|
15
15
|
from ..swagger import validate_api_key
|
|
16
|
-
from datetime import
|
|
16
|
+
from datetime import timedelta
|
|
17
17
|
|
|
18
18
|
try:
|
|
19
19
|
from flask import request, jsonify, Response
|
|
@@ -95,7 +95,7 @@ if __name__ == "__main__":
|
|
|
95
95
|
openai_response = {
|
|
96
96
|
"id": response_id,
|
|
97
97
|
"object": "chat.completion",
|
|
98
|
-
"created": str(int(datetime.now().timestamp())),
|
|
98
|
+
"created": str(int(datetime.datetime.now().timestamp())),
|
|
99
99
|
"model": vector_name,
|
|
100
100
|
"system_fingerprint": sunholo_version(),
|
|
101
101
|
"choices": [{
|
|
@@ -137,7 +137,7 @@ if __name__ == "__main__":
|
|
|
137
137
|
name="start_streaming_chat",
|
|
138
138
|
metadata=vac_config,
|
|
139
139
|
input = all_input,
|
|
140
|
-
completion_start_time=datetime.datetime.now(),
|
|
140
|
+
completion_start_time=str(int(datetime.datetime.now().timestamp())),
|
|
141
141
|
model=vac_config.get("model") or vac_config.get("llm")
|
|
142
142
|
)
|
|
143
143
|
|
|
@@ -247,7 +247,7 @@ if __name__ == "__main__":
|
|
|
247
247
|
return jsonify({'error': '_ENDPOINTS_HOST environment variable not found'}), 401
|
|
248
248
|
|
|
249
249
|
# Check cache first
|
|
250
|
-
current_time = datetime.now()
|
|
250
|
+
current_time = datetime.datetime.now()
|
|
251
251
|
if api_key in api_key_cache:
|
|
252
252
|
cached_result, cache_time = api_key_cache[api_key]
|
|
253
253
|
if current_time - cache_time < cache_duration:
|
|
@@ -340,7 +340,7 @@ if __name__ == "__main__":
|
|
|
340
340
|
openai_chunk = {
|
|
341
341
|
"id": response_id,
|
|
342
342
|
"object": "chat.completion.chunk",
|
|
343
|
-
"created": str(int(datetime.now().timestamp())),
|
|
343
|
+
"created": str(int(datetime.datetime.now().timestamp())),
|
|
344
344
|
"model": vector_name,
|
|
345
345
|
"system_fingerprint": sunholo_version(),
|
|
346
346
|
"choices": [{
|
|
@@ -357,7 +357,7 @@ if __name__ == "__main__":
|
|
|
357
357
|
final_chunk = {
|
|
358
358
|
"id": response_id,
|
|
359
359
|
"object": "chat.completion.chunk",
|
|
360
|
-
"created": str(int(datetime.now().timestamp())),
|
|
360
|
+
"created": str(int(datetime.datetime.now().timestamp())),
|
|
361
361
|
"model": vector_name,
|
|
362
362
|
"system_fingerprint": sunholo_version(),
|
|
363
363
|
"choices": [{
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Callable, List, Any, Coroutine, Tuple
|
|
4
|
+
|
|
5
|
+
# Setup basic logging configuration
|
|
6
|
+
logging.basicConfig(level=logging.INFO)
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
class AsyncTaskRunner:
|
|
10
|
+
"""
|
|
11
|
+
# Example async functions for testing
|
|
12
|
+
async def api_call_1(url, params):
|
|
13
|
+
await asyncio.sleep(1)
|
|
14
|
+
if "fail" in params:
|
|
15
|
+
raise ValueError(f"Error in api_call_1 with params: {params}")
|
|
16
|
+
return f"api_call_1 response from {url} with params {params}"
|
|
17
|
+
|
|
18
|
+
async def api_call_2(url, params):
|
|
19
|
+
await asyncio.sleep(2)
|
|
20
|
+
if "fail" in params:
|
|
21
|
+
raise ValueError(f"Error in api_call_2 with params: {params}")
|
|
22
|
+
return f"api_call_2 response from {url} with params {params}"
|
|
23
|
+
|
|
24
|
+
# Example usage in an existing async function
|
|
25
|
+
async def example_usage():
|
|
26
|
+
runner = AsyncTaskRunner()
|
|
27
|
+
|
|
28
|
+
runner.add_task(api_call_1, "http://example.com", {"key": "value"})
|
|
29
|
+
runner.add_task(api_call_2, "http://example.org", {"key": "fail"})
|
|
30
|
+
|
|
31
|
+
# Run all tasks within the existing event loop
|
|
32
|
+
results = await runner.run_async()
|
|
33
|
+
for result in results:
|
|
34
|
+
print(result)
|
|
35
|
+
|
|
36
|
+
# Example of calling run_sync() in a synchronous context
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
runner = AsyncTaskRunner()
|
|
39
|
+
|
|
40
|
+
runner.add_task(api_call_1, "http://example.com", {"key": "value"})
|
|
41
|
+
runner.add_task(api_call_2, "http://example.org", {"key": "fail"})
|
|
42
|
+
|
|
43
|
+
# Running in a synchronous context
|
|
44
|
+
results = runner.run_sync()
|
|
45
|
+
for result in results:
|
|
46
|
+
print(result)
|
|
47
|
+
"""
|
|
48
|
+
def __init__(self):
|
|
49
|
+
self.tasks = []
|
|
50
|
+
|
|
51
|
+
def add_task(self, func: Callable[..., Coroutine], *args: Any):
|
|
52
|
+
"""Adds a task (function and its arguments) to the list of tasks to be executed."""
|
|
53
|
+
logger.info(f"Adding task: {func.__name__} with args: {args}")
|
|
54
|
+
self.tasks.append(func(*args))
|
|
55
|
+
|
|
56
|
+
def add_group(self, functions: List[Callable[..., Coroutine]], *args: Any):
|
|
57
|
+
"""Adds a group of functions that should run in parallel with the same arguments."""
|
|
58
|
+
group_tasks = [func(*args) for func in functions]
|
|
59
|
+
logger.info(f"Adding group of tasks with args: {args}")
|
|
60
|
+
self.tasks.append(asyncio.gather(*group_tasks, return_exceptions=True))
|
|
61
|
+
|
|
62
|
+
async def run_async(self) -> List[Any]:
|
|
63
|
+
"""Runs all tasks using the current event loop and returns the results."""
|
|
64
|
+
logger.info("Running tasks asynchronously")
|
|
65
|
+
results = await asyncio.gather(*self.tasks, return_exceptions=True)
|
|
66
|
+
self._log_results(results)
|
|
67
|
+
return results
|
|
68
|
+
|
|
69
|
+
def run_sync(self) -> List[Any]:
|
|
70
|
+
"""Runs all tasks synchronously (blocking) using a new event loop and returns the results."""
|
|
71
|
+
try:
|
|
72
|
+
logger.info("Running tasks synchronously")
|
|
73
|
+
loop = asyncio.get_running_loop()
|
|
74
|
+
return loop.run_until_complete(self.run_async())
|
|
75
|
+
except RuntimeError:
|
|
76
|
+
loop = asyncio.new_event_loop()
|
|
77
|
+
asyncio.set_event_loop(loop)
|
|
78
|
+
results = loop.run_until_complete(self.run_async())
|
|
79
|
+
loop.close()
|
|
80
|
+
return results
|
|
81
|
+
|
|
82
|
+
def _log_results(self, results: List[Any]):
|
|
83
|
+
"""Logs the results of the task executions."""
|
|
84
|
+
for result in results:
|
|
85
|
+
if isinstance(result, Exception):
|
|
86
|
+
logger.error(f"Task resulted in an error: {result}")
|
|
87
|
+
else:
|
|
88
|
+
logger.info(f"Task completed successfully: {result}")
|
|
89
|
+
|
|
@@ -198,7 +198,12 @@ class LlamaIndexVertexCorpusManager:
|
|
|
198
198
|
"""
|
|
199
199
|
List all VertexAI Corpus for the project/location
|
|
200
200
|
"""
|
|
201
|
-
|
|
201
|
+
try:
|
|
202
|
+
return rag.list_corpora()
|
|
203
|
+
except Exception as err:
|
|
204
|
+
log.error(f"Could not list corpora: {str(err)}")
|
|
205
|
+
return []
|
|
206
|
+
|
|
202
207
|
|
|
203
208
|
def find_corpus_from_list(self, display_name: str):
|
|
204
209
|
"""
|
|
@@ -410,3 +415,6 @@ def setup_llamaindex_subparser(subparsers):
|
|
|
410
415
|
query_parser.add_argument('vac', nargs='?', default="global", help='The VAC config to set it up for')
|
|
411
416
|
|
|
412
417
|
llamaindex_parser.set_defaults(func=llamaindex_command)
|
|
418
|
+
|
|
419
|
+
# If no subcommand is provided, print the help message
|
|
420
|
+
llamaindex_parser.set_defaults(func=lambda args: llamaindex_parser.print_help() if args.action is None else llamaindex_command)
|
|
@@ -49,13 +49,21 @@ def add_user_history_rag(
|
|
|
49
49
|
|
|
50
50
|
def get_user_history_chunks(user_id:str, config:ConfigManager, query):
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
try:
|
|
53
|
+
manager = LlamaIndexVertexCorpusManager(config)
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
manager.create_corpus(user_id)
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
response = manager.query_corpus(query, user_id)
|
|
58
|
+
log.info(f"User history got: {response=}")
|
|
59
|
+
user_history_memory = []
|
|
60
|
+
for chunk in response.contexts.contexts:
|
|
61
|
+
user_history_memory.append(chunk.text)
|
|
62
|
+
|
|
63
|
+
log.info(f"User history chunks: {user_history_memory}")
|
|
64
|
+
|
|
65
|
+
return "\n".join(user_history_memory)
|
|
66
|
+
except Exception as err:
|
|
67
|
+
log.error(f"Could not find user history due to error: {str(err)}")
|
|
68
|
+
|
|
69
|
+
return f"No user history available due to error: {str(err)}"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.84.1
|
|
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.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.84.1.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -21,7 +21,7 @@ License-File: LICENSE.txt
|
|
|
21
21
|
Requires-Dist: google-auth
|
|
22
22
|
Requires-Dist: ruamel.yaml
|
|
23
23
|
Requires-Dist: langchain>=0.2.12
|
|
24
|
-
Requires-Dist: langchain_experimental
|
|
24
|
+
Requires-Dist: langchain_experimental>=0.0.61
|
|
25
25
|
Requires-Dist: langchain-community>=0.2.11
|
|
26
26
|
Provides-Extra: all
|
|
27
27
|
Requires-Dist: asyncpg; extra == "all"
|
|
@@ -49,7 +49,7 @@ Requires-Dist: httpx; extra == "all"
|
|
|
49
49
|
Requires-Dist: jsonschema; extra == "all"
|
|
50
50
|
Requires-Dist: lancedb; extra == "all"
|
|
51
51
|
Requires-Dist: langchain>=0.2.12; extra == "all"
|
|
52
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: langchain-experimental>=0.0.61; extra == "all"
|
|
53
53
|
Requires-Dist: langchain-community>=0.2.11; extra == "all"
|
|
54
54
|
Requires-Dist: langchain-openai>=0.1.20; extra == "all"
|
|
55
55
|
Requires-Dist: langchain-google-genai>=1.0.5; extra == "all"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
google-auth
|
|
2
2
|
ruamel.yaml
|
|
3
3
|
langchain>=0.2.12
|
|
4
|
-
langchain_experimental
|
|
4
|
+
langchain_experimental>=0.0.61
|
|
5
5
|
langchain-community>=0.2.11
|
|
6
6
|
|
|
7
7
|
[all]
|
|
@@ -30,7 +30,7 @@ httpx
|
|
|
30
30
|
jsonschema
|
|
31
31
|
lancedb
|
|
32
32
|
langchain>=0.2.12
|
|
33
|
-
|
|
33
|
+
langchain-experimental>=0.0.61
|
|
34
34
|
langchain-community>=0.2.11
|
|
35
35
|
langchain-openai>=0.1.20
|
|
36
36
|
langchain-google-genai>=1.0.5
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|