sunholo 0.119.11__py3-none-any.whl → 0.119.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.
- sunholo/discovery_engine/chunker_handler.py +4 -0
 - sunholo/discovery_engine/discovery_engine_client.py +87 -0
 - sunholo/discovery_engine/get_ai_search_chunks.py +1 -1
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/METADATA +1 -1
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/RECORD +9 -9
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/LICENSE.txt +0 -0
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/WHEEL +0 -0
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/entry_points.txt +0 -0
 - {sunholo-0.119.11.dist-info → sunholo-0.119.13.dist-info}/top_level.txt +0 -0
 
| 
         @@ -152,6 +152,10 @@ def discovery_engine_chunker_check(message_data, 
     | 
|
| 
       152 
152 
     | 
    
         | 
| 
       153 
153 
     | 
    
         
             
                    return llama
         
     | 
| 
       154 
154 
     | 
    
         | 
| 
      
 155 
     | 
    
         
            +
                # If not processing and only memory, do not process further
         
     | 
| 
      
 156 
     | 
    
         
            +
                if not process and total_memories == 1:
         
     | 
| 
      
 157 
     | 
    
         
            +
                    return metadata
         
     | 
| 
      
 158 
     | 
    
         
            +
                
         
     | 
| 
       155 
159 
     | 
    
         
             
                elif llama:
         
     | 
| 
       156 
160 
     | 
    
         
             
                    log.info("Discovery Engine found but not the only memory, continuing with other processes.")
         
     | 
| 
       157 
161 
     | 
    
         | 
| 
         @@ -726,6 +726,67 @@ class DiscoveryEngineClient: 
     | 
|
| 
       726 
726 
     | 
    
         
             
                    log.info("Discovery engine response object")
         
     | 
| 
       727 
727 
     | 
    
         
             
                    return search_response
         
     | 
| 
       728 
728 
     | 
    
         | 
| 
      
 729 
     | 
    
         
            +
                async def async_search_with_filters(self, query, filter_str=None,
         
     | 
| 
      
 730 
     | 
    
         
            +
                                        num_previous_chunks=3, num_next_chunks=3, 
         
     | 
| 
      
 731 
     | 
    
         
            +
                                        page_size=10, parse_chunks_to_string=True, 
         
     | 
| 
      
 732 
     | 
    
         
            +
                                        serving_config="default_serving_config",
         
     | 
| 
      
 733 
     | 
    
         
            +
                                        data_store_ids: Optional[List[str]] = None):
         
     | 
| 
      
 734 
     | 
    
         
            +
                    """
         
     | 
| 
      
 735 
     | 
    
         
            +
                    Searches with a generic filter string asynchronously.
         
     | 
| 
      
 736 
     | 
    
         
            +
             
     | 
| 
      
 737 
     | 
    
         
            +
                    Args:
         
     | 
| 
      
 738 
     | 
    
         
            +
                        query (str): The search query.
         
     | 
| 
      
 739 
     | 
    
         
            +
                        filter_str (str, optional): The filter string to apply (e.g., "source LIKE 'my_source' AND eventTime > TIMESTAMP('2024-01-01')").
         
     | 
| 
      
 740 
     | 
    
         
            +
                        #... other parameters from get_chunks
         
     | 
| 
      
 741 
     | 
    
         
            +
             
     | 
| 
      
 742 
     | 
    
         
            +
                    Returns:
         
     | 
| 
      
 743 
     | 
    
         
            +
                        discoveryengine.SearchResponse or str: The search response object or string of chunks.
         
     | 
| 
      
 744 
     | 
    
         
            +
                    """
         
     | 
| 
      
 745 
     | 
    
         
            +
             
     | 
| 
      
 746 
     | 
    
         
            +
                    serving_config_path = self.async_search_client.serving_config_path(
         
     | 
| 
      
 747 
     | 
    
         
            +
                        self.project_id,
         
     | 
| 
      
 748 
     | 
    
         
            +
                        self.location,
         
     | 
| 
      
 749 
     | 
    
         
            +
                        self.data_store_id,
         
     | 
| 
      
 750 
     | 
    
         
            +
                        serving_config
         
     | 
| 
      
 751 
     | 
    
         
            +
                    )
         
     | 
| 
      
 752 
     | 
    
         
            +
             
     | 
| 
      
 753 
     | 
    
         
            +
                    search_request = discoveryengine.SearchRequest(
         
     | 
| 
      
 754 
     | 
    
         
            +
                        serving_config=serving_config_path,
         
     | 
| 
      
 755 
     | 
    
         
            +
                        query=query,
         
     | 
| 
      
 756 
     | 
    
         
            +
                        page_size=page_size, 
         
     | 
| 
      
 757 
     | 
    
         
            +
                        content_search_spec=discoveryengine.SearchRequest.ContentSearchSpec(
         
     | 
| 
      
 758 
     | 
    
         
            +
                            search_result_mode="CHUNKS", 
         
     | 
| 
      
 759 
     | 
    
         
            +
                            chunk_spec=discoveryengine.SearchRequest.ContentSearchSpec.ChunkSpec(
         
     | 
| 
      
 760 
     | 
    
         
            +
                                num_previous_chunks=num_previous_chunks,
         
     | 
| 
      
 761 
     | 
    
         
            +
                                num_next_chunks=num_next_chunks,
         
     | 
| 
      
 762 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 763 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 764 
     | 
    
         
            +
                        filter=filter_str # name:'ANY("king kong")'
         
     | 
| 
      
 765 
     | 
    
         
            +
                    )
         
     | 
| 
      
 766 
     | 
    
         
            +
             
     | 
| 
      
 767 
     | 
    
         
            +
                    if data_store_ids:
         
     | 
| 
      
 768 
     | 
    
         
            +
                        search_request.data_store_specs = [
         
     | 
| 
      
 769 
     | 
    
         
            +
                            discoveryengine.SearchRequest.DataStoreSpec(
         
     | 
| 
      
 770 
     | 
    
         
            +
                                data_store=self._search_data_store_path(data_store_id, serving_config=serving_config)
         
     | 
| 
      
 771 
     | 
    
         
            +
                            )
         
     | 
| 
      
 772 
     | 
    
         
            +
                            for data_store_id in data_store_ids
         
     | 
| 
      
 773 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 774 
     | 
    
         
            +
             
     | 
| 
      
 775 
     | 
    
         
            +
                    log.info(f"Discovery engine request with filter: {search_request=}")
         
     | 
| 
      
 776 
     | 
    
         
            +
                    try:
         
     | 
| 
      
 777 
     | 
    
         
            +
                        search_response = await self.async_search_client.search(search_request)
         
     | 
| 
      
 778 
     | 
    
         
            +
                    except Exception as e:
         
     | 
| 
      
 779 
     | 
    
         
            +
                        log.info(f"No results {search_request.data_store_specs=}: {str(e)}")
         
     | 
| 
      
 780 
     | 
    
         
            +
                        return None
         
     | 
| 
      
 781 
     | 
    
         
            +
                    
         
     | 
| 
      
 782 
     | 
    
         
            +
                    if parse_chunks_to_string:
         
     | 
| 
      
 783 
     | 
    
         
            +
                        big_string = await self.async_process_chunks(search_response)
         
     | 
| 
      
 784 
     | 
    
         
            +
                        log.info(f"Discovery engine chunks string sample: {big_string[:100]}")
         
     | 
| 
      
 785 
     | 
    
         
            +
                        return big_string
         
     | 
| 
      
 786 
     | 
    
         
            +
                    
         
     | 
| 
      
 787 
     | 
    
         
            +
                    log.info("Discovery engine response object")
         
     | 
| 
      
 788 
     | 
    
         
            +
                    return search_response
         
     | 
| 
      
 789 
     | 
    
         
            +
             
     | 
| 
       729 
790 
     | 
    
         
             
                def search_by_objectId_and_or_date(self, query, objectId=None, date=None, **kwargs):
         
     | 
| 
       730 
791 
     | 
    
         
             
                    """
         
     | 
| 
       731 
792 
     | 
    
         
             
                    Searches and filters by objectId (exact match) and/or date.
         
     | 
| 
         @@ -751,3 +812,29 @@ class DiscoveryEngineClient: 
     | 
|
| 
       751 
812 
     | 
    
         
             
                    else:
         
     | 
| 
       752 
813 
     | 
    
         
             
                        # No filters, perform regular search
         
     | 
| 
       753 
814 
     | 
    
         
             
                        return self.search_with_filters(query, **kwargs)
         
     | 
| 
      
 815 
     | 
    
         
            +
             
     | 
| 
      
 816 
     | 
    
         
            +
                async def async_search_by_objectId_and_or_date(self, query, objectId=None, date=None, **kwargs):
         
     | 
| 
      
 817 
     | 
    
         
            +
                    """
         
     | 
| 
      
 818 
     | 
    
         
            +
                    Searches and filters by objectId (exact match) and/or date asynchronously.
         
     | 
| 
      
 819 
     | 
    
         
            +
             
     | 
| 
      
 820 
     | 
    
         
            +
                    Args:
         
     | 
| 
      
 821 
     | 
    
         
            +
                        query (str): The search query.
         
     | 
| 
      
 822 
     | 
    
         
            +
                        objectId (str, optional): The exact objectId to filter by.
         
     | 
| 
      
 823 
     | 
    
         
            +
                        date (str, optional): The literal_iso_8601_datetime_format date to filter by e.g. 2025-02-24T12:25:30.123Z
         
     | 
| 
      
 824 
     | 
    
         
            +
                        **kwargs: Additional keyword arguments to pass to `async_search_with_filters`.
         
     | 
| 
      
 825 
     | 
    
         
            +
             
     | 
| 
      
 826 
     | 
    
         
            +
                    Returns:
         
     | 
| 
      
 827 
     | 
    
         
            +
                        list: A list of search results.
         
     | 
| 
      
 828 
     | 
    
         
            +
                    """
         
     | 
| 
      
 829 
     | 
    
         
            +
                    filter_clauses = []
         
     | 
| 
      
 830 
     | 
    
         
            +
                    if objectId:
         
     | 
| 
      
 831 
     | 
    
         
            +
                        filter_clauses.append(f'objectId: ANY("{objectId}")')
         
     | 
| 
      
 832 
     | 
    
         
            +
                    if date:
         
     | 
| 
      
 833 
     | 
    
         
            +
                        filter_clauses.append(f'eventTime >= "{date}"')
         
     | 
| 
      
 834 
     | 
    
         
            +
             
     | 
| 
      
 835 
     | 
    
         
            +
                    if filter_clauses:
         
     | 
| 
      
 836 
     | 
    
         
            +
                        filter_str = " AND ".join(filter_clauses)  # Combine with AND
         
     | 
| 
      
 837 
     | 
    
         
            +
                        return await self.async_search_with_filters(query, filter_str, **kwargs)
         
     | 
| 
      
 838 
     | 
    
         
            +
                    else:
         
     | 
| 
      
 839 
     | 
    
         
            +
                        # No filters, perform regular search
         
     | 
| 
      
 840 
     | 
    
         
            +
                        return await self.async_search_with_filters(query, **kwargs)
         
     | 
| 
         @@ -116,7 +116,7 @@ async def async_get_all_chunks(question:str, config:ConfigManager, filter_str=No 
     | 
|
| 
       116 
116 
     | 
    
         
             
            async def async_get_chunks(question, vector_name, num_chunks, filter_str, project_id=None):
         
     | 
| 
       117 
117 
     | 
    
         
             
                de = DiscoveryEngineClient(vector_name, project_id=project_id)
         
     | 
| 
       118 
118 
     | 
    
         
             
                try:
         
     | 
| 
       119 
     | 
    
         
            -
                    return await de. 
     | 
| 
      
 119 
     | 
    
         
            +
                    return await de.async_search_with_filters(query=question, 
         
     | 
| 
       120 
120 
     | 
    
         
             
                                                        filter_str=filter_str,
         
     | 
| 
       121 
121 
     | 
    
         
             
                                                        num_previous_chunks=num_chunks, 
         
     | 
| 
       122 
122 
     | 
    
         
             
                                                        num_next_chunks=num_chunks)
         
     | 
| 
         @@ -72,11 +72,11 @@ sunholo/database/sql/sb/delete_source_row.sql,sha256=r6fEuUKdbiLHCDGKSbKINDCpJjs 
     | 
|
| 
       72 
72 
     | 
    
         
             
            sunholo/database/sql/sb/return_sources.sql,sha256=89KAnxfK8n_qGK9jy1OQT8f9n4uYUtYL5cCxbC2mj_c,255
         
     | 
| 
       73 
73 
     | 
    
         
             
            sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3-zZI,89
         
     | 
| 
       74 
74 
     | 
    
         
             
            sunholo/discovery_engine/__init__.py,sha256=hLgqRDJ22Aov9o2QjAEfsVgnL3kMdM-g5p8RJ9OyKdQ,130
         
     | 
| 
       75 
     | 
    
         
            -
            sunholo/discovery_engine/chunker_handler.py,sha256= 
     | 
| 
      
 75 
     | 
    
         
            +
            sunholo/discovery_engine/chunker_handler.py,sha256=2775W5wHzdkYXqkRMlwh8MRbas20wcMnnnNngo0ljms,6160
         
     | 
| 
       76 
76 
     | 
    
         
             
            sunholo/discovery_engine/cli.py,sha256=KGVle5rkLL49oF9TQhrGI--8017IvvLOEoYur545Qb0,12790
         
     | 
| 
       77 
77 
     | 
    
         
             
            sunholo/discovery_engine/create_new.py,sha256=WUi4_xh_dFaGX3xA9jkNKZhaR6LCELjMPeRb0hyj4FU,1226
         
     | 
| 
       78 
     | 
    
         
            -
            sunholo/discovery_engine/discovery_engine_client.py,sha256= 
     | 
| 
       79 
     | 
    
         
            -
            sunholo/discovery_engine/get_ai_search_chunks.py,sha256= 
     | 
| 
      
 78 
     | 
    
         
            +
            sunholo/discovery_engine/discovery_engine_client.py,sha256=w3ZwAcP9t8cGgwEQZsf4_b1HPnnIzgetTiaEvG4tMwI,36741
         
     | 
| 
      
 79 
     | 
    
         
            +
            sunholo/discovery_engine/get_ai_search_chunks.py,sha256=I6Dt1CznqEvE7XIZ2PkLqopmjpO96iVEWJJqL5cJjOU,5554
         
     | 
| 
       80 
80 
     | 
    
         
             
            sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
         
     | 
| 
       81 
81 
     | 
    
         
             
            sunholo/embedder/embed_chunk.py,sha256=did2pKkWM2o0KkRcb0H9l2x_WjCq6OyuHDxGbITFKPM,6530
         
     | 
| 
       82 
82 
     | 
    
         
             
            sunholo/embedder/embed_metadata.py,sha256=2ziUIdVwnbCUU8gOwQWEvkrRcyp-7IeyZfSsWNkMquA,866
         
     | 
| 
         @@ -166,9 +166,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875 
     | 
|
| 
       166 
166 
     | 
    
         
             
            sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
         
     | 
| 
       167 
167 
     | 
    
         
             
            sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
         
     | 
| 
       168 
168 
     | 
    
         
             
            sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
         
     | 
| 
       169 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
       170 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
       171 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
       172 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
       173 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
       174 
     | 
    
         
            -
            sunholo-0.119. 
     | 
| 
      
 169 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
         
     | 
| 
      
 170 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/METADATA,sha256=m5LFMkpjiaKq1GOIq6HYsOt66fe0gcrSUW80_FlmbRk,9715
         
     | 
| 
      
 171 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
         
     | 
| 
      
 172 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
         
     | 
| 
      
 173 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
         
     | 
| 
      
 174 
     | 
    
         
            +
            sunholo-0.119.13.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |