sunholo 0.90.5__tar.gz → 0.91.0__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.90.5 → sunholo-0.91.0}/PKG-INFO +4 -2
- {sunholo-0.90.5 → sunholo-0.91.0}/setup.py +4 -2
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/components/llm.py +10 -1
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/alloydb_client.py +54 -1
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/langfuse/evals.py +2 -1
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/llamaindex/llamaindex_class.py +2 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/PKG-INFO +4 -2
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/requires.txt +2 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/LICENSE.txt +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/MANIFEST.in +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/README.md +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/setup.cfg +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/flask/qna_routes.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/flask/vac_routes.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/route.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/agents/swagger.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/archive/archive.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/auth/refresh.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/auth/run.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/azure/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/azure/auth.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/azure/blobs.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/bots/discord.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/azure.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/encode_metadata.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/images.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/cli.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/configs.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/swagger.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/cli/vertex.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/components/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/components/retriever.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/custom_logging.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/database.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/database/uuid.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/excel/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/excel/plugin.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/gcs/download_folder.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/genai/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/genai/init.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/genai/process_funcs_cls.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/genai/safety.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/invoke/async_class.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/invoke/direct_vac_func.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/llamaindex/user_history.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/qna/retry.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/terraform/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/terraform/tfvars_editor.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/tools/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/api_key.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/config.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/config_class.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/utils/version.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/extensions_call.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/extensions_class.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/genai_functions.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/init.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/safety.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo/vertex/type_dict_to_json.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/SOURCES.txt +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/tests/test_chat_history.py +0 -0
- {sunholo-0.90.5 → sunholo-0.91.0}/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.91.0
|
|
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.91.0.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -24,6 +24,7 @@ Requires-Dist: langchain>=0.2.12
|
|
|
24
24
|
Requires-Dist: langchain_experimental>=0.0.61
|
|
25
25
|
Requires-Dist: langchain-community>=0.2.11
|
|
26
26
|
Provides-Extra: all
|
|
27
|
+
Requires-Dist: anthropic[vertex]; extra == "all"
|
|
27
28
|
Requires-Dist: asyncpg; extra == "all"
|
|
28
29
|
Requires-Dist: azure-identity; extra == "all"
|
|
29
30
|
Requires-Dist: azure-storage-blob; extra == "all"
|
|
@@ -98,6 +99,7 @@ Requires-Dist: pytesseract; extra == "pipeline"
|
|
|
98
99
|
Requires-Dist: tabulate; extra == "pipeline"
|
|
99
100
|
Requires-Dist: unstructured[local-inference]==0.14.9; extra == "pipeline"
|
|
100
101
|
Provides-Extra: gcp
|
|
102
|
+
Requires-Dist: anthropic[vertex]; extra == "gcp"
|
|
101
103
|
Requires-Dist: google-api-python-client; extra == "gcp"
|
|
102
104
|
Requires-Dist: google-cloud-alloydb-connector[pg8000]; extra == "gcp"
|
|
103
105
|
Requires-Dist: google-auth-httplib2; extra == "gcp"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
|
-
version = '0.
|
|
3
|
+
version = '0.91.0'
|
|
4
4
|
|
|
5
5
|
setup(
|
|
6
6
|
name='sunholo',
|
|
@@ -36,6 +36,7 @@ setup(
|
|
|
36
36
|
extras_require={
|
|
37
37
|
# Define optional dependencies with feature names
|
|
38
38
|
'all': [
|
|
39
|
+
"anthropic[vertex]",
|
|
39
40
|
"asyncpg",
|
|
40
41
|
"azure-identity",
|
|
41
42
|
"azure-storage-blob",
|
|
@@ -115,6 +116,7 @@ setup(
|
|
|
115
116
|
"unstructured[local-inference]==0.14.9",
|
|
116
117
|
],
|
|
117
118
|
'gcp': [
|
|
119
|
+
"anthropic[vertex]",
|
|
118
120
|
"google-api-python-client",
|
|
119
121
|
"google-cloud-alloydb-connector[pg8000]",
|
|
120
122
|
"google-auth-httplib2",
|
|
@@ -139,7 +141,7 @@ setup(
|
|
|
139
141
|
"tiktoken"
|
|
140
142
|
],
|
|
141
143
|
'anthropic': [
|
|
142
|
-
"langchain-anthropic>=0.1.13"
|
|
144
|
+
"langchain-anthropic>=0.1.13"
|
|
143
145
|
],
|
|
144
146
|
'tools' : [
|
|
145
147
|
'openapi-spec-validator',
|
|
@@ -114,9 +114,18 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
|
|
|
114
114
|
elif llm_str == 'anthropic':
|
|
115
115
|
from langchain_anthropic import ChatAnthropic
|
|
116
116
|
if model is None:
|
|
117
|
-
model = 'claude-3-
|
|
117
|
+
model = 'claude-3-5-sonnet-20240620'
|
|
118
118
|
log.info(f"No 'model' value in config file - selecting default {model}")
|
|
119
119
|
return ChatAnthropic(model_name = model, temperature=0)
|
|
120
|
+
elif llm_str == 'anthropic-vertex':
|
|
121
|
+
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
|
|
122
|
+
if model is None:
|
|
123
|
+
model = "claude-3-5-sonnet@20240620"
|
|
124
|
+
log.info(f"No 'model' value in config file - selecting default {model}")
|
|
125
|
+
gcp_config = config.vacConfig("gcp_config")
|
|
126
|
+
return ChatAnthropicVertex(model_name=model,
|
|
127
|
+
project=gcp_config.get('project_id'),
|
|
128
|
+
location=gcp_config.get('location'))
|
|
120
129
|
|
|
121
130
|
if llm_str is None:
|
|
122
131
|
raise NotImplementedError(f'No llm implemented for {llm_str}')
|
|
@@ -3,7 +3,7 @@ try:
|
|
|
3
3
|
import pg8000
|
|
4
4
|
import sqlalchemy
|
|
5
5
|
from sqlalchemy.exc import DatabaseError, ProgrammingError
|
|
6
|
-
from langchain_google_alloydb_pg import AlloyDBEngine
|
|
6
|
+
from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBVectorStore
|
|
7
7
|
except ImportError:
|
|
8
8
|
AlloyDBEngine = None
|
|
9
9
|
pass
|
|
@@ -12,6 +12,7 @@ from .database import get_vector_size
|
|
|
12
12
|
from .uuid import generate_uuid_from_object_id
|
|
13
13
|
from ..custom_logging import log
|
|
14
14
|
from ..utils import ConfigManager
|
|
15
|
+
from ..components import get_embeddings
|
|
15
16
|
|
|
16
17
|
class AlloyDBClient:
|
|
17
18
|
"""
|
|
@@ -62,6 +63,7 @@ class AlloyDBClient:
|
|
|
62
63
|
if not alloydb_config:
|
|
63
64
|
raise ValueError("Must specify vac.alloydb_config")
|
|
64
65
|
self.config = alloydb_config
|
|
66
|
+
self.vector_name = self.config.vector_name
|
|
65
67
|
project_id = alloydb_config["project_id"]
|
|
66
68
|
region = alloydb_config["region"]
|
|
67
69
|
cluster_name = alloydb_config["cluster"]
|
|
@@ -87,6 +89,11 @@ class AlloyDBClient:
|
|
|
87
89
|
log.info("Build with Langchain engine - will use default service account for auth")
|
|
88
90
|
self.engine = self._create_engine()
|
|
89
91
|
self.engine_type = "langchain"
|
|
92
|
+
|
|
93
|
+
if self.engine_type == "langchain":
|
|
94
|
+
self.vectorstore = self.get_vectorstore()
|
|
95
|
+
else:
|
|
96
|
+
self.vectorstore = None
|
|
90
97
|
|
|
91
98
|
def _build_instance_uri(self, project_id, region, cluster_name, instance_name):
|
|
92
99
|
return f"projects/{project_id}/locations/{region}/clusters/{cluster_name}/instances/{instance_name}"
|
|
@@ -134,6 +141,52 @@ class AlloyDBClient:
|
|
|
134
141
|
|
|
135
142
|
return engine
|
|
136
143
|
|
|
144
|
+
def _get_embedder(self, vector_name):
|
|
145
|
+
return get_embeddings(vector_name)
|
|
146
|
+
|
|
147
|
+
def get_vectorstore(self):
|
|
148
|
+
if self.engine_type != "langchain":
|
|
149
|
+
raise ValueError("Not available using pg8000 engine")
|
|
150
|
+
|
|
151
|
+
if self.vector_name is None:
|
|
152
|
+
raise ValueError("No vectorname found - init with ConfigManager?")
|
|
153
|
+
|
|
154
|
+
vector_size = get_vector_size(self.vector_name)
|
|
155
|
+
table_name = f"{self.vector_name}_vectorstore_{vector_size}"
|
|
156
|
+
|
|
157
|
+
log.info(f"Initialised AlloyDBClient with AlloyDBVectorStore: {table_name}")
|
|
158
|
+
self.vectorstore = AlloyDBVectorStore.create_sync(
|
|
159
|
+
engine=self.engine,
|
|
160
|
+
table_name=table_name,
|
|
161
|
+
embedding_service=self._get_embedder(self.vector_name),
|
|
162
|
+
metadata_columns=["source", "docstore_doc_id"]
|
|
163
|
+
#metadata_columns=["source", "eventTime"]
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
return self.vectorstore
|
|
167
|
+
|
|
168
|
+
def _similarity_search(self, query, source_filter:str="", free_filter:str=None):
|
|
169
|
+
|
|
170
|
+
if free_filter is None:
|
|
171
|
+
source_filter_cmd = f"source %LIKE% {source_filter}" if source_filter else None
|
|
172
|
+
else:
|
|
173
|
+
source_filter_cmd = free_filter
|
|
174
|
+
|
|
175
|
+
log.info(f"Similarity search for {query} and {source_filter_cmd}")
|
|
176
|
+
|
|
177
|
+
return query, source_filter_cmd
|
|
178
|
+
|
|
179
|
+
def similarity_search(self, query, source_filter:str="", free_filter:str=None, k:int=5):
|
|
180
|
+
|
|
181
|
+
query, source_filter_cmd = self._similarity_search(query, source_filter, free_filter)
|
|
182
|
+
|
|
183
|
+
return self.vectorstore.similarity_search(query, filter=source_filter_cmd, k=k)
|
|
184
|
+
|
|
185
|
+
async def asimilarity_search(self, query, source_filter:str="", free_filter:str=None, k:int=5):
|
|
186
|
+
query, source_filter_cmd = self._similarity_search(query, source_filter, free_filter)
|
|
187
|
+
|
|
188
|
+
return await self.vectorstore.asimilarity_search(query, filter=source_filter_cmd, k=k)
|
|
189
|
+
|
|
137
190
|
def execute_sql(self, sql_statement):
|
|
138
191
|
if self.engine_type == "pg8000":
|
|
139
192
|
return self._execute_sql_pg8000(sql_statement)
|
|
@@ -3,6 +3,7 @@ import json
|
|
|
3
3
|
|
|
4
4
|
from ..pubsub import decode_pubsub_message
|
|
5
5
|
from langfuse import Langfuse
|
|
6
|
+
import traceback
|
|
6
7
|
from ..custom_logging import log
|
|
7
8
|
|
|
8
9
|
# Example of how eval_funcs might be structured
|
|
@@ -71,7 +72,7 @@ def do_evals(trace_id, eval_funcs: list=[eval_length], **kwargs) -> dict:
|
|
|
71
72
|
try:
|
|
72
73
|
eval_result = eval_func(trace) # Assuming eval_func returns a dict with 'score' and 'reason'
|
|
73
74
|
except Exception as e:
|
|
74
|
-
eval_result = {"score": 0, "reason":f"ERROR: {str(e)}"}
|
|
75
|
+
eval_result = {"score": 0, "reason":f"ERROR: {str(e)} traceback: {traceback.format_exc()}"}
|
|
75
76
|
eval_results.append(eval_result)
|
|
76
77
|
|
|
77
78
|
eval_name = eval_func.__name__
|
|
@@ -178,6 +178,8 @@ class LlamaIndexVertexCorpusManager:
|
|
|
178
178
|
|
|
179
179
|
def query_corpus(self, query:str, corpus_disply_name:str):
|
|
180
180
|
corpus = self.find_corpus_from_list(corpus_disply_name)
|
|
181
|
+
|
|
182
|
+
log.info(f"Querying {corpus.name=} with {query=}")
|
|
181
183
|
|
|
182
184
|
response:RetrieveContextsResponse = rag.retrieval_query(
|
|
183
185
|
rag_resources=[
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.91.0
|
|
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.91.0.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -24,6 +24,7 @@ Requires-Dist: langchain>=0.2.12
|
|
|
24
24
|
Requires-Dist: langchain_experimental>=0.0.61
|
|
25
25
|
Requires-Dist: langchain-community>=0.2.11
|
|
26
26
|
Provides-Extra: all
|
|
27
|
+
Requires-Dist: anthropic[vertex]; extra == "all"
|
|
27
28
|
Requires-Dist: asyncpg; extra == "all"
|
|
28
29
|
Requires-Dist: azure-identity; extra == "all"
|
|
29
30
|
Requires-Dist: azure-storage-blob; extra == "all"
|
|
@@ -98,6 +99,7 @@ Requires-Dist: pytesseract; extra == "pipeline"
|
|
|
98
99
|
Requires-Dist: tabulate; extra == "pipeline"
|
|
99
100
|
Requires-Dist: unstructured[local-inference]==0.14.9; extra == "pipeline"
|
|
100
101
|
Provides-Extra: gcp
|
|
102
|
+
Requires-Dist: anthropic[vertex]; extra == "gcp"
|
|
101
103
|
Requires-Dist: google-api-python-client; extra == "gcp"
|
|
102
104
|
Requires-Dist: google-cloud-alloydb-connector[pg8000]; extra == "gcp"
|
|
103
105
|
Requires-Dist: google-auth-httplib2; extra == "gcp"
|
|
@@ -5,6 +5,7 @@ langchain_experimental>=0.0.61
|
|
|
5
5
|
langchain-community>=0.2.11
|
|
6
6
|
|
|
7
7
|
[all]
|
|
8
|
+
anthropic[vertex]
|
|
8
9
|
asyncpg
|
|
9
10
|
azure-identity
|
|
10
11
|
azure-storage-blob
|
|
@@ -83,6 +84,7 @@ requests
|
|
|
83
84
|
rich
|
|
84
85
|
|
|
85
86
|
[gcp]
|
|
87
|
+
anthropic[vertex]
|
|
86
88
|
google-api-python-client
|
|
87
89
|
google-cloud-alloydb-connector[pg8000]
|
|
88
90
|
google-auth-httplib2
|
|
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
|
|
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
|