sunholo 0.62.12__tar.gz → 0.62.14__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.62.12 → sunholo-0.62.14}/PKG-INFO +2 -2
- {sunholo-0.62.12 → sunholo-0.62.14}/setup.py +1 -1
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/flask/qna_routes.py +2 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/run_proxy.py +1 -1
- sunholo-0.62.14/sunholo/vertex/__init__.py +3 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/vertex/memory_tools.py +51 -1
- sunholo-0.62.14/sunholo/vertex/safety.py +35 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/PKG-INFO +2 -2
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/SOURCES.txt +1 -0
- sunholo-0.62.14/tests/test_config.py +34 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/tests/test_dispatch_to_qa.py +5 -1
- sunholo-0.62.12/sunholo/vertex/__init__.py +0 -2
- sunholo-0.62.12/tests/test_config.py +0 -11
- {sunholo-0.62.12 → sunholo-0.62.14}/LICENSE.txt +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/MANIFEST.in +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/README.md +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/setup.cfg +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/route.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/archive/archive.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/auth/run.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/bots/discord.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/data_to_embed_pubsub.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/images.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/cli.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/configs.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/components/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/components/llm.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/components/retriever.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/database.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/database/uuid.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/llamaindex/generate.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/logging.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/qna/retry.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/config.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo/vertex/init.py +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/requires.txt +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.62.12 → sunholo-0.62.14}/tests/test_chat_history.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.62.
|
|
3
|
+
Version: 0.62.14
|
|
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.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.62.14.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -206,6 +206,8 @@ def prep_vac(request, vector_name):
|
|
|
206
206
|
stream_wait_time = data.pop('stream_wait_time', 7)
|
|
207
207
|
stream_timeout = data.pop('stream_timeout', 120)
|
|
208
208
|
chat_history = data.pop('chat_history', None)
|
|
209
|
+
vector_name = data.pop('vector_name', vector_name)
|
|
210
|
+
|
|
209
211
|
paired_messages = extract_chat_history(chat_history)
|
|
210
212
|
|
|
211
213
|
all_input = {'user_input': user_input,
|
|
@@ -277,7 +277,7 @@ def setup_proxy_subparser(subparsers):
|
|
|
277
277
|
start_parser.add_argument('--port', type=int, help='Port to run the proxy on. Auto-assigns if not provided.')
|
|
278
278
|
start_parser.add_argument('--local', action='store_true', help='Run the service locally instead of proxying to Cloud Run.')
|
|
279
279
|
start_parser.add_argument('--app-type', choices=['flask', 'fastapi'], help='If local, type of the local app (flask or fastapi).')
|
|
280
|
-
start_parser.add_argument('--app-folder', help='If local, folder containing the local app.py')
|
|
280
|
+
start_parser.add_argument('--app-folder', default=".", help='If local, folder containing the local app.py')
|
|
281
281
|
start_parser.add_argument('--log-file', action='store_true', help='Whether to create a file containing proxy logs.')
|
|
282
282
|
start_parser.set_defaults(func=lambda args: start_proxy(args.service_name,
|
|
283
283
|
args.region,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
try:
|
|
2
2
|
from vertexai.preview import rag
|
|
3
|
-
from vertexai.preview.generative_models import Tool, grounding
|
|
3
|
+
from vertexai.preview.generative_models import Tool, grounding, GenerationResponse
|
|
4
4
|
except ImportError:
|
|
5
5
|
rag = None
|
|
6
6
|
|
|
@@ -89,3 +89,53 @@ def get_vertex_memories(vector_name):
|
|
|
89
89
|
log.warning("No llamaindex Vertex corpus configurations could be found")
|
|
90
90
|
|
|
91
91
|
return tools
|
|
92
|
+
|
|
93
|
+
def print_grounding_response(response):
|
|
94
|
+
"""Prints Gemini response with grounding citations."""
|
|
95
|
+
grounding_metadata = response.candidates[0].grounding_metadata
|
|
96
|
+
|
|
97
|
+
# Citation indices are in byte units
|
|
98
|
+
ENCODING = "utf-8"
|
|
99
|
+
text_bytes = response.text.encode(ENCODING)
|
|
100
|
+
|
|
101
|
+
prev_index = 0
|
|
102
|
+
markdown_text = ""
|
|
103
|
+
|
|
104
|
+
sources: dict[str, str] = {}
|
|
105
|
+
footnote = 1
|
|
106
|
+
for attribution in grounding_metadata.grounding_attributions:
|
|
107
|
+
context = attribution.web or attribution.retrieved_context
|
|
108
|
+
if not context:
|
|
109
|
+
log.info(f"Skipping Grounding Attribution {attribution}")
|
|
110
|
+
continue
|
|
111
|
+
|
|
112
|
+
title = context.title
|
|
113
|
+
uri = context.uri
|
|
114
|
+
end_index = int(attribution.segment.end_index)
|
|
115
|
+
|
|
116
|
+
if uri not in sources:
|
|
117
|
+
sources[uri] = {"title": title, "footnote": footnote}
|
|
118
|
+
footnote += 1
|
|
119
|
+
|
|
120
|
+
text_segment = text_bytes[prev_index:end_index].decode(ENCODING)
|
|
121
|
+
markdown_text += f"{text_segment} [[{sources[uri]['footnote']}]]({uri})"
|
|
122
|
+
prev_index = end_index
|
|
123
|
+
|
|
124
|
+
if prev_index < len(text_bytes):
|
|
125
|
+
markdown_text += str(text_bytes[prev_index:], encoding=ENCODING)
|
|
126
|
+
|
|
127
|
+
markdown_text += "\n## Grounding Sources\n"
|
|
128
|
+
|
|
129
|
+
if grounding_metadata.web_search_queries:
|
|
130
|
+
markdown_text += (
|
|
131
|
+
f"\n**Web Search Queries:** {grounding_metadata.web_search_queries}\n"
|
|
132
|
+
)
|
|
133
|
+
elif grounding_metadata.retrieval_queries:
|
|
134
|
+
markdown_text += (
|
|
135
|
+
f"\n**Retrieval Queries:** {grounding_metadata.retrieval_queries}\n"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
for uri, source in sources.items():
|
|
139
|
+
markdown_text += f"{source['footnote']}. [{source['title']}]({uri})\n"
|
|
140
|
+
|
|
141
|
+
log.info(markdown_text)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from vertexai.generative_models import (
|
|
3
|
+
HarmCategory,
|
|
4
|
+
HarmBlockThreshold,
|
|
5
|
+
)
|
|
6
|
+
except ImportError:
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
def vertex_safety(threshold: str = "BLOCK_ONLY_HIGH"):
|
|
10
|
+
"""
|
|
11
|
+
BLOCK_ONLY_HIGH - block when high probability of unsafe content is detected
|
|
12
|
+
BLOCK_MEDIUM_AND_ABOVE - block when medium or high probability of content is detected
|
|
13
|
+
BLOCK_LOW_AND_ABOVE - block when low, medium, or high probability of unsafe content is detected
|
|
14
|
+
BLOCK_NONE - no block, but need to be on an allow list to use
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
if threshold == 'BLOCK_ONLY_HIGH':
|
|
18
|
+
thresh = HarmBlockThreshold.BLOCK_ONLY_HIGH
|
|
19
|
+
elif threshold == 'BLOCK_MEDIUM_AND_ABOVE':
|
|
20
|
+
thresh = HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE
|
|
21
|
+
elif threshold == 'BLOCK_LOW_AND_ABOVE':
|
|
22
|
+
thresh = HarmBlockThreshold.BLOCK_LOW_AND_ABOVE
|
|
23
|
+
elif threshold == 'BLOCK_NONE':
|
|
24
|
+
thresh = HarmBlockThreshold.BLOCK_NONE
|
|
25
|
+
else:
|
|
26
|
+
raise ValueError("Invalid threshold")
|
|
27
|
+
|
|
28
|
+
safety_settings = {
|
|
29
|
+
HarmCategory.HARM_CATEGORY_HARASSMENT: thresh,
|
|
30
|
+
HarmCategory.HARM_CATEGORY_HATE_SPEECH: thresh,
|
|
31
|
+
HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: thresh,
|
|
32
|
+
HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: thresh,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return safety_settings
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.62.
|
|
3
|
+
Version: 0.62.14
|
|
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.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.62.14.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from unittest.mock import patch, mock_open
|
|
3
|
+
from sunholo.utils import config
|
|
4
|
+
|
|
5
|
+
def test_load_config():
|
|
6
|
+
expected_config = {"key": "value"}
|
|
7
|
+
with pytest.raises(FileNotFoundError):
|
|
8
|
+
config.load_config("non_existent_file")
|
|
9
|
+
with patch("builtins.open", mock_open(read_data='{"key": "value"}'), create=True):
|
|
10
|
+
result, _ = config.load_config("mock_file.json")
|
|
11
|
+
assert result == expected_config
|
|
12
|
+
|
|
13
|
+
# Test cases for load_config_key function
|
|
14
|
+
@patch("sunholo.utils.config.load_all_configs")
|
|
15
|
+
def test_load_config_key(mock_load_all_configs):
|
|
16
|
+
mock_load_all_configs.return_value = {
|
|
17
|
+
"vacConfig": {
|
|
18
|
+
"vac": {
|
|
19
|
+
"test_vector": {
|
|
20
|
+
"key1": "value1",
|
|
21
|
+
"key2": "value2"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
# Test existing key
|
|
27
|
+
assert config.load_config_key("key1", "test_vector", "vacConfig") == "value1"
|
|
28
|
+
# Test non-existing key
|
|
29
|
+
result = config.load_config_key("non_existing_key", "test_vector", "vacConfig")
|
|
30
|
+
assert result is None
|
|
31
|
+
|
|
32
|
+
# Test invalid configuration
|
|
33
|
+
with pytest.raises(KeyError):
|
|
34
|
+
config.load_config_key("key1", "test_vector", "invalidConfig")
|
|
@@ -4,7 +4,11 @@ from sunholo.agents.dispatch_to_qa import prep_request_payload
|
|
|
4
4
|
|
|
5
5
|
@pytest.mark.parametrize("user_input, chat_history, vector_name, stream, expected_endpoint, expected_payload", [
|
|
6
6
|
("What is AI?", [], "my_vector", False, "http://example.com/invoke", {"user_input": "What is AI?", "chat_history": [], "vector_name": "my_vector"}),
|
|
7
|
-
("Tell me about ML", ["Previous chat message"], "another_vector", True, "http://example.com/stream", {"user_input": "Tell me about ML", "chat_history": ["Previous chat message"], "vector_name": "another_vector"})
|
|
7
|
+
("Tell me about ML", ["Previous chat message"], "another_vector", True, "http://example.com/stream", {"user_input": "Tell me about ML", "chat_history": ["Previous chat message"], "vector_name": "another_vector"}),
|
|
8
|
+
# Additional test cases to cover all logic paths
|
|
9
|
+
("", [], "empty_input_vector", False, "http://example.com/invoke", {"user_input": "", "chat_history": [], "vector_name": "empty_input_vector"}),
|
|
10
|
+
("Valid input", ["Chat history present"], "history_vector", False, "http://example.com/invoke", {"user_input": "Valid input", "chat_history": ["Chat history present"], "vector_name": "history_vector"}),
|
|
11
|
+
("Stream request", [], "stream_vector", True, "http://example.com/stream", {"user_input": "Stream request", "chat_history": [], "vector_name": "stream_vector"})
|
|
8
12
|
])
|
|
9
13
|
@patch('sunholo.agents.dispatch_to_qa.load_config_key')
|
|
10
14
|
@patch('sunholo.agents.dispatch_to_qa.route_endpoint')
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
from unittest.mock import patch, mock_open
|
|
3
|
-
from sunholo.utils import config
|
|
4
|
-
|
|
5
|
-
def test_load_config():
|
|
6
|
-
expected_config = {"key": "value"}
|
|
7
|
-
with pytest.raises(FileNotFoundError):
|
|
8
|
-
config.load_config("non_existent_file")
|
|
9
|
-
with patch("builtins.open", mock_open(read_data='{"key": "value"}'), create=True):
|
|
10
|
-
result, _ = config.load_config("mock_file.json")
|
|
11
|
-
assert result == expected_config
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|