sunholo 0.63.0__tar.gz → 0.64.4__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.63.0 → sunholo-0.64.4}/PKG-INFO +3 -2
- {sunholo-0.63.0 → sunholo-0.64.4}/setup.py +2 -1
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/flask/qna_routes.py +156 -9
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/langfuse/callback.py +3 -4
- sunholo-0.64.4/sunholo/utils/version.py +3 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/PKG-INFO +3 -2
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/SOURCES.txt +1 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/requires.txt +1 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/LICENSE.txt +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/MANIFEST.in +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/README.md +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/setup.cfg +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/route.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/archive/archive.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/auth/run.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/bots/discord.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/data_to_embed_pubsub.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/images.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/cli.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/configs.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/components/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/components/llm.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/components/retriever.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/database.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/database/uuid.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/llamaindex/generate.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/logging.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/qna/retry.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/config.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/vertex/init.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo/vertex/safety.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/tests/test_chat_history.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/tests/test_chunker.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/tests/test_config.py +0 -0
- {sunholo-0.63.0 → sunholo-0.64.4}/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.
|
|
3
|
+
Version: 0.64.4
|
|
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.64.4.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
21
|
Requires-Dist: google-auth
|
|
22
|
+
Requires-Dist: tenacity==8.3.0
|
|
22
23
|
Requires-Dist: langchain
|
|
23
24
|
Requires-Dist: langchain_experimental
|
|
24
25
|
Requires-Dist: langchain-community
|
|
@@ -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.64.4'
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name='sunholo',
|
|
@@ -29,6 +29,7 @@ setup(
|
|
|
29
29
|
install_requires=[
|
|
30
30
|
# Base dependencies
|
|
31
31
|
"google-auth", # to check if on gcp
|
|
32
|
+
"tenacity==8.3.0",
|
|
32
33
|
"langchain",
|
|
33
34
|
"langchain_experimental",
|
|
34
35
|
"langchain-community",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import json
|
|
17
17
|
import traceback
|
|
18
18
|
import datetime
|
|
19
|
+
import uuid
|
|
19
20
|
|
|
20
21
|
from ...agents import extract_chat_history, handle_special_commands
|
|
21
22
|
from ...qna.parsers import parse_output
|
|
@@ -23,7 +24,11 @@ from ...streaming import start_streaming_chat
|
|
|
23
24
|
from ...archive import archive_qa
|
|
24
25
|
from ...logging import log
|
|
25
26
|
from ...utils.config import load_config
|
|
26
|
-
|
|
27
|
+
from ...utils.version import sunholo_version
|
|
28
|
+
import os
|
|
29
|
+
from ...gcs.add_file import add_file_to_gcs
|
|
30
|
+
|
|
31
|
+
|
|
27
32
|
try:
|
|
28
33
|
from flask import request, jsonify, Response
|
|
29
34
|
except ImportError:
|
|
@@ -34,6 +39,7 @@ try:
|
|
|
34
39
|
except ImportError:
|
|
35
40
|
pass
|
|
36
41
|
|
|
42
|
+
|
|
37
43
|
def register_qna_routes(app, stream_interpreter, vac_interpreter):
|
|
38
44
|
|
|
39
45
|
@app.route("/")
|
|
@@ -155,9 +161,122 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
|
|
|
155
161
|
span.end(output=jsonify(bot_output))
|
|
156
162
|
trace.update(output=jsonify(bot_output))
|
|
157
163
|
|
|
164
|
+
# {'answer': 'output'}
|
|
158
165
|
return jsonify(bot_output)
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
@app.route('/openai/v1/chat/completions', methods=['POST'])
|
|
168
|
+
@app.route('/openai/v1/chat/completions/<vector_name>', methods=['POST'])
|
|
169
|
+
def openai_compatible_endpoint(vector_name=None):
|
|
170
|
+
data = request.get_json()
|
|
171
|
+
log.info(f'openai_compatible_endpoint got data: {data}')
|
|
172
|
+
|
|
173
|
+
vector_name = vector_name or data.pop('model', None)
|
|
174
|
+
messages = data.pop('messages', None)
|
|
175
|
+
chat_history = data.pop('chat_history', None)
|
|
176
|
+
stream = data.pop('stream', False)
|
|
177
|
+
|
|
178
|
+
log.info(f'openai_compatible_endpoint got data: {data} for vector: {vector_name}')
|
|
179
|
+
|
|
180
|
+
if not messages:
|
|
181
|
+
return jsonify({"error": "No messages provided"}), 400
|
|
182
|
+
|
|
183
|
+
user_message = next((msg['content'] for msg in messages if msg['role'] == 'user'), None)
|
|
184
|
+
if not user_message:
|
|
185
|
+
return jsonify({"error": "No user message provided"}), 400
|
|
186
|
+
|
|
187
|
+
all_input = {
|
|
188
|
+
"user_input": user_message,
|
|
189
|
+
"chat_history": chat_history,
|
|
190
|
+
"kwargs": data
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
observed_stream_interpreter = observe()(stream_interpreter)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
response_id = str(uuid.uuid4())
|
|
197
|
+
|
|
198
|
+
def generate_response_content():
|
|
199
|
+
for chunk in start_streaming_chat(question=user_message,
|
|
200
|
+
vector_name=vector_name,
|
|
201
|
+
qna_func=observed_stream_interpreter,
|
|
202
|
+
chat_history=all_input["chat_history"],
|
|
203
|
+
wait_time=all_input.get("stream_wait_time", 1),
|
|
204
|
+
timeout=all_input.get("stream_timeout", 60),
|
|
205
|
+
**all_input["kwargs"]
|
|
206
|
+
):
|
|
207
|
+
if isinstance(chunk, dict) and 'answer' in chunk:
|
|
208
|
+
openai_chunk = {
|
|
209
|
+
"id": response_id,
|
|
210
|
+
"object": "chat.completion.chunk",
|
|
211
|
+
"created": str(datetime.time()),
|
|
212
|
+
"model": vector_name,
|
|
213
|
+
"system_fingerprint": sunholo_version(),
|
|
214
|
+
"choices": [{
|
|
215
|
+
"index": 0,
|
|
216
|
+
"delta": {"content": chunk['answer']},
|
|
217
|
+
"logprobs": None,
|
|
218
|
+
"finish_reason": None
|
|
219
|
+
}]
|
|
220
|
+
}
|
|
221
|
+
yield json.dumps(openai_chunk) + "\n"
|
|
222
|
+
else:
|
|
223
|
+
log.info(f"Unknown chunk: {chunk}")
|
|
224
|
+
|
|
225
|
+
final_chunk = {
|
|
226
|
+
"id": response_id,
|
|
227
|
+
"object": "chat.completion.chunk",
|
|
228
|
+
"created": str(datetime.time()),
|
|
229
|
+
"model": vector_name,
|
|
230
|
+
"system_fingerprint": sunholo_version(),
|
|
231
|
+
"choices": [{
|
|
232
|
+
"index": 0,
|
|
233
|
+
"delta": {},
|
|
234
|
+
"logprobs": None,
|
|
235
|
+
"finish_reason": "stop"
|
|
236
|
+
}]
|
|
237
|
+
}
|
|
238
|
+
yield json.dumps(final_chunk) + "\n"
|
|
239
|
+
|
|
240
|
+
if stream:
|
|
241
|
+
return Response(generate_response_content(), content_type='text/plain; charset=utf-8')
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
bot_output = observed_stream_interpreter(
|
|
245
|
+
question=user_message,
|
|
246
|
+
vector_name=vector_name,
|
|
247
|
+
chat_history=all_input["chat_history"],
|
|
248
|
+
**all_input["kwargs"]
|
|
249
|
+
)
|
|
250
|
+
bot_output = parse_output(bot_output)
|
|
251
|
+
|
|
252
|
+
openai_response = {
|
|
253
|
+
"id": response_id,
|
|
254
|
+
"object": "chat.completion",
|
|
255
|
+
"created": str(datetime.time()),
|
|
256
|
+
"model": vector_name,
|
|
257
|
+
"system_fingerprint": sunholo_version(),
|
|
258
|
+
"choices": [{
|
|
259
|
+
"index": 0,
|
|
260
|
+
"message": {
|
|
261
|
+
"role": "assistant",
|
|
262
|
+
"content": bot_output.get('answer', ''),
|
|
263
|
+
},
|
|
264
|
+
"logprobs": None,
|
|
265
|
+
"finish_reason": "stop"
|
|
266
|
+
}],
|
|
267
|
+
"usage": {
|
|
268
|
+
"prompt_tokens": len(user_message.split()),
|
|
269
|
+
"completion_tokens": len(bot_output.get('answer', '').split()),
|
|
270
|
+
"total_tokens": len(user_message.split()) + len(bot_output.get('answer', '').split())
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
log.info(f"OpenAI response: {openai_response}")
|
|
275
|
+
return jsonify(openai_response)
|
|
276
|
+
|
|
277
|
+
except Exception as err:
|
|
278
|
+
return jsonify({'error': f'QNA_ERROR: An error occurred: {str(err)} traceback: {traceback.format_exc()}'}), 500
|
|
279
|
+
|
|
161
280
|
|
|
162
281
|
def create_langfuse_trace(request, vector_name):
|
|
163
282
|
try:
|
|
@@ -172,10 +291,8 @@ def create_langfuse_trace(request, vector_name):
|
|
|
172
291
|
session_id = request.headers.get("X-Session-ID")
|
|
173
292
|
message_source = request.headers.get("X-Message-Source")
|
|
174
293
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
package_version = version('sunholo')
|
|
178
|
-
tags = [f"sunholo-v{package_version}"]
|
|
294
|
+
package_version = sunholo_version()
|
|
295
|
+
tags = [package_version]
|
|
179
296
|
if message_source:
|
|
180
297
|
tags.append(message_source)
|
|
181
298
|
|
|
@@ -191,8 +308,28 @@ def prep_vac(request, vector_name):
|
|
|
191
308
|
#trace = create_langfuse_trace(request, vector_name)
|
|
192
309
|
trace = None
|
|
193
310
|
span = None
|
|
194
|
-
|
|
311
|
+
|
|
312
|
+
if request.content_type.startswith('application/json'):
|
|
313
|
+
data = request.get_json()
|
|
314
|
+
elif request.content_type.startswith('multipart/form-data'):
|
|
315
|
+
data = request.form.to_dict()
|
|
316
|
+
if 'file' in request.files:
|
|
317
|
+
file = request.files['file']
|
|
318
|
+
if file.filename != '':
|
|
319
|
+
log.info(f"Found file: {file.filename} to upload to GCS")
|
|
320
|
+
try:
|
|
321
|
+
image_uri, mime_type = handle_file_upload(file, vector_name)
|
|
322
|
+
data["image_uri"] = image_uri
|
|
323
|
+
data["mime"] = mime_type
|
|
324
|
+
except Exception as e:
|
|
325
|
+
return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
|
|
326
|
+
else:
|
|
327
|
+
return jsonify({"error": "No file selected"}), 400
|
|
328
|
+
else:
|
|
329
|
+
return jsonify({"error": "Unsupported content type"}), 400
|
|
330
|
+
|
|
195
331
|
log.info(f"vac/{vector_name} got data: {data}")
|
|
332
|
+
|
|
196
333
|
config, _ = load_config("config/llm_config.yaml")
|
|
197
334
|
vac_configs = config.get("vac")
|
|
198
335
|
if vac_configs:
|
|
@@ -213,7 +350,7 @@ def prep_vac(request, vector_name):
|
|
|
213
350
|
'vector_name': vector_name,
|
|
214
351
|
'chat_history': paired_messages,
|
|
215
352
|
'stream_wait_time': stream_wait_time,
|
|
216
|
-
'stream_timeout':stream_timeout,
|
|
353
|
+
'stream_timeout': stream_timeout,
|
|
217
354
|
'kwargs': data}
|
|
218
355
|
|
|
219
356
|
if trace:
|
|
@@ -233,4 +370,14 @@ def prep_vac(request, vector_name):
|
|
|
233
370
|
"command_response": command_response,
|
|
234
371
|
"all_input": all_input,
|
|
235
372
|
"vac_config": vac_config
|
|
236
|
-
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def handle_file_upload(file, vector_name):
|
|
377
|
+
try:
|
|
378
|
+
file.save(file.filename)
|
|
379
|
+
image_uri = add_file_to_gcs(file.filename, vector_name)
|
|
380
|
+
os.remove(file.filename) # Clean up the saved file
|
|
381
|
+
return image_uri, file.mimetype
|
|
382
|
+
except Exception as e:
|
|
383
|
+
raise Exception(f'File upload failed: {str(e)}')
|
|
@@ -7,6 +7,8 @@ try:
|
|
|
7
7
|
except ImportError:
|
|
8
8
|
CallbackHandler = None
|
|
9
9
|
|
|
10
|
+
from ..utils.version import sunholo_version
|
|
11
|
+
|
|
10
12
|
def create_langfuse_callback(**kwargs):
|
|
11
13
|
|
|
12
14
|
if not CallbackHandler:
|
|
@@ -40,10 +42,7 @@ def add_langfuse_tracing(
|
|
|
40
42
|
session_id = request.headers.get("X-Session-ID")
|
|
41
43
|
message_source = request.headers.get("X-Message-Source")
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
from importlib.metadata import version
|
|
45
|
-
package_version = version('sunholo')
|
|
46
|
-
tags = [f"sunholo-v{package_version}"]
|
|
45
|
+
tags = [sunholo_version()]
|
|
47
46
|
if message_source:
|
|
48
47
|
tags.append(message_source)
|
|
49
48
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.64.4
|
|
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.64.4.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
21
|
Requires-Dist: google-auth
|
|
22
|
+
Requires-Dist: tenacity==8.3.0
|
|
22
23
|
Requires-Dist: langchain
|
|
23
24
|
Requires-Dist: langchain_experimental
|
|
24
25
|
Requires-Dist: langchain-community
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|