sunholo 0.140.12__py3-none-any.whl → 0.140.13__py3-none-any.whl

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.
@@ -441,10 +441,10 @@ def create_message_element(message: dict):
441
441
  ```
442
442
  """
443
443
  if 'text' in message: # This is a Slack or Google Chat message
444
- log.info(f"Found text element - {message['text']}")
444
+ #log.info(f"Found text element - {message['text']}")
445
445
  return message['text']
446
446
  elif 'content' in message: # Discord or OpenAI history message
447
- log.info(f"Found content element - {message['content']}")
447
+ #log.info(f"Found content element - {message['content']}")
448
448
  return message['content']
449
449
  else:
450
450
  raise KeyError(f"Could not extract 'content' or 'text' element from message: {message}, {type(message)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.140.12
3
+ Version: 0.140.13
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -393,78 +393,102 @@ sunholo proxy list # List running proxies
393
393
 
394
394
  ## 📝 Examples
395
395
 
396
- ### Vertex AI Chat with Memory
396
+ ### Chat with History Extraction
397
397
 
398
398
  ```python
399
399
  from sunholo.utils import ConfigManager
400
400
  from sunholo.components import pick_llm
401
- from sunholo.agents import memory_client
401
+ from sunholo.agents import extract_chat_history
402
402
 
403
403
  config = ConfigManager('my-agent')
404
404
  llm = pick_llm(config=config)
405
- memory = memory_client(config=config)
406
405
 
407
- # Chat with context
408
- response = llm.invoke("What is Google Cloud?")
409
- memory.add_message("user", "What is Google Cloud?")
410
- memory.add_message("assistant", response)
406
+ # Extract chat history from messages
407
+ chat_history = [
408
+ {"role": "user", "content": "Hello"},
409
+ {"role": "assistant", "content": "Hi there!"}
410
+ ]
411
+ history_str = extract_chat_history(chat_history)
412
+
413
+ # Use in prompt
414
+ response = llm.invoke(f"Given this history:\n{history_str}\n\nUser: How are you?")
411
415
  ```
412
416
 
413
- ### Document Processing with Discovery Engine
417
+ ### Document Processing with Chunker
414
418
 
415
419
  ```python
416
- from sunholo.discovery_engine import DiscoveryEngineClient
417
- from sunholo.chunker import chunk_doc
420
+ from sunholo.chunker import direct_file_to_embed
421
+ from sunholo.utils import ConfigManager
418
422
 
419
- # Initialize client
420
- client = DiscoveryEngineClient(
421
- project_id='my-project',
422
- data_store_id='my-datastore'
423
+ config = ConfigManager('my-agent')
424
+
425
+ # Process a file directly
426
+ result = direct_file_to_embed(
427
+ "document.pdf",
428
+ embed_prefix="doc",
429
+ metadata={"source": "user_upload"},
430
+ vectorstore=config.vacConfig("vectorstore")
423
431
  )
432
+ ```
433
+
434
+ ### Vertex AI with Memory Tools
435
+
436
+ ```python
437
+ from sunholo.vertex import get_vertex_memories
438
+ from sunholo.utils import ConfigManager
439
+
440
+ config = ConfigManager('my-agent')
424
441
 
425
- # Process and index document
426
- chunks = chunk_doc.chunk_file("document.pdf", chunk_size=1000)
427
- client.import_documents(chunks)
442
+ # Get Vertex AI memory configuration
443
+ memory_config = get_vertex_memories(config)
428
444
 
429
- # Search
430
- results = client.search("What is the main topic?")
445
+ # Use with Vertex AI
446
+ if memory_config:
447
+ print(f"Memory tools configured: {memory_config}")
431
448
  ```
432
449
 
433
- ### Streaming Flask API
450
+ ### Streaming Response with Flask
434
451
 
435
452
  ```python
436
- from sunholo.agents import dispatch_to_qa
453
+ from sunholo.agents import send_to_qa
454
+ from flask import Response, request
437
455
 
438
456
  @app.route('/vac/streaming/<vac_name>', methods=['POST'])
439
457
  def streaming_endpoint(vac_name):
440
458
  question = request.json.get('user_input')
441
459
 
442
460
  def generate():
443
- for chunk in dispatch_to_qa(
461
+ # Stream responses from the QA system
462
+ response = send_to_qa(
444
463
  question,
445
464
  vac_name=vac_name,
446
465
  stream=True
447
- ):
448
- yield f"data: {chunk}\n\n"
466
+ )
467
+ if hasattr(response, '__iter__'):
468
+ for chunk in response:
469
+ yield f"data: {chunk}\n\n"
470
+ else:
471
+ yield f"data: {response}\n\n"
449
472
 
450
473
  return Response(generate(), content_type='text/event-stream')
451
474
  ```
452
475
 
453
- ### Deploy from Template
476
+ ### Discovery Engine Integration
454
477
 
455
- ```bash
456
- # Create from template
457
- sunholo init my-api --template agent
458
-
459
- # Customize configuration
460
- cd my-api
461
- vi config/vac_config.yaml
478
+ ```python
479
+ from sunholo.discovery_engine import DiscoveryEngineClient
462
480
 
463
- # Test locally
464
- sunholo vac chat my-agent --local
481
+ # Initialize client
482
+ client = DiscoveryEngineClient(
483
+ project_id='my-project',
484
+ data_store_id='my-datastore'
485
+ )
465
486
 
466
- # Deploy to production
467
- sunholo deploy my-agent
487
+ # Search documents
488
+ results = client.search("What is Vertex AI?")
489
+ for result in results:
490
+ print(f"Content: {result.chunk.content}")
491
+ print(f"Score: {result.relevance_score}")
468
492
  ```
469
493
 
470
494
  ## 🧪 Testing
@@ -2,7 +2,7 @@ sunholo/__init__.py,sha256=InRbX4V0-qdNHo9zYH3GEye7ASLR6LX8-SMvPV4Jsaw,1212
2
2
  sunholo/custom_logging.py,sha256=JXZTnXp_DixP3jwYfKw4LYRDS9IuTq7ctCgfZbI2rxA,22023
3
3
  sunholo/langchain_types.py,sha256=uZ4zvgej_f7pLqjtu4YP7qMC_eZD5ym_5x4pyvA1Ih4,1834
4
4
  sunholo/agents/__init__.py,sha256=AauG3l0y4r5Fzx1zJfZ634M4o-0o7B7J5T8k_gPvNqE,370
5
- sunholo/agents/chat_history.py,sha256=e2NmiooaRUxKGr_aoU05rzhHi3VsKjbZZmzeDr2yJJE,17780
5
+ sunholo/agents/chat_history.py,sha256=gRuIUyU-53A72Q17SmSgf6Ok3YO8hKAZhsc64976018,17782
6
6
  sunholo/agents/dispatch_to_qa.py,sha256=NHihwAoCJ5_Lk11e_jZnucVUGQyZHCB-YpkfMHBCpQk,8882
7
7
  sunholo/agents/langserve.py,sha256=C46ph2mnygr6bdHijYWYyfQDI9ylAF0_9Kx2PfcCJpU,4414
8
8
  sunholo/agents/pubsub.py,sha256=TscZN_6am6DfaQkC-Yl18ZIBOoLE-0nDSiil6GpQEh4,1344
@@ -168,9 +168,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
168
168
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
169
169
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
170
170
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
171
- sunholo-0.140.12.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
- sunholo-0.140.12.dist-info/METADATA,sha256=UBt83NkXY5EpTwdtDF5LCOe2IsBXlR1TCVx9EoAuAOA,17116
173
- sunholo-0.140.12.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
174
- sunholo-0.140.12.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
- sunholo-0.140.12.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
- sunholo-0.140.12.dist-info/RECORD,,
171
+ sunholo-0.140.13.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.140.13.dist-info/METADATA,sha256=4GvUi1znwq6b_Ohjtx4uMQMQH6o-DWF4mNg1so-sQhM,17843
173
+ sunholo-0.140.13.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
174
+ sunholo-0.140.13.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.140.13.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.140.13.dist-info/RECORD,,