igbot-base 0.0.21__py3-none-any.whl → 0.0.22__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.
- igbot_base/llmmemory.py +1 -1
 - igbot_base/tokenizer.py +14 -3
 - {igbot_base-0.0.21.dist-info → igbot_base-0.0.22.dist-info}/METADATA +1 -1
 - {igbot_base-0.0.21.dist-info → igbot_base-0.0.22.dist-info}/RECORD +6 -6
 - {igbot_base-0.0.21.dist-info → igbot_base-0.0.22.dist-info}/WHEEL +1 -1
 - {igbot_base-0.0.21.dist-info → igbot_base-0.0.22.dist-info}/top_level.txt +0 -0
 
    
        igbot_base/llmmemory.py
    CHANGED
    
    
    
        igbot_base/tokenizer.py
    CHANGED
    
    | 
         @@ -1,16 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            from abc import ABC, abstractmethod
         
     | 
| 
      
 2 
     | 
    
         
            +
            from typing import Union, Dict
         
     | 
| 
      
 3 
     | 
    
         
            +
            import json
         
     | 
| 
       2 
4 
     | 
    
         
             
            import tiktoken
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            class BaseTokenizer(ABC):
         
     | 
| 
       6 
8 
     | 
    
         
             
                @abstractmethod
         
     | 
| 
       7 
     | 
    
         
            -
                def count_tokens(self,  
     | 
| 
      
 9 
     | 
    
         
            +
                def count_tokens(self, data: Union[str, Dict, None]) -> int:
         
     | 
| 
       8 
10 
     | 
    
         
             
                    pass
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
13 
     | 
    
         
             
            class OpenAiTokenizer(BaseTokenizer):
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       12 
15 
     | 
    
         
             
                def __init__(self, model_name):
         
     | 
| 
       13 
16 
     | 
    
         
             
                    self.__tokenizer = tiktoken.encoding_for_model(model_name)
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                def count_tokens(self,  
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
      
 18 
     | 
    
         
            +
                def count_tokens(self, data: Union[str: Dict, None]) -> int:
         
     | 
| 
      
 19 
     | 
    
         
            +
                    if data is None:
         
     | 
| 
      
 20 
     | 
    
         
            +
                        return 0
         
     | 
| 
      
 21 
     | 
    
         
            +
                    elif isinstance(data, str):
         
     | 
| 
      
 22 
     | 
    
         
            +
                        return len(self.__tokenizer.encode(data))
         
     | 
| 
      
 23 
     | 
    
         
            +
                    elif isinstance(data, dict):
         
     | 
| 
      
 24 
     | 
    
         
            +
                        dict_as_str = json.dumps(data, separators=(",", ":"))
         
     | 
| 
      
 25 
     | 
    
         
            +
                        return len(self.__tokenizer.encode(dict_as_str))
         
     | 
| 
      
 26 
     | 
    
         
            +
                    else:
         
     | 
| 
      
 27 
     | 
    
         
            +
                        raise TypeError("Expected either a string, a dictionary, or None.")
         
     | 
| 
         @@ -4,17 +4,17 @@ igbot_base/agent_response.py,sha256=fmZLaPlpnolXWrPVtNah20nI3Cble21DMQybPJxMvrs, 
     | 
|
| 
       4 
4 
     | 
    
         
             
            igbot_base/base_exception.py,sha256=uRZXwYdsER2y_Rlah1TaSXwR6Kb9t2lNyngar0p5YFk,2146
         
     | 
| 
       5 
5 
     | 
    
         
             
            igbot_base/exception_handler.py,sha256=Er5LbNt2ga2-e0GSzkJw66E-NS1dN_2msTRyyac1qX8,536
         
     | 
| 
       6 
6 
     | 
    
         
             
            igbot_base/llm.py,sha256=0zul2Q3aiCpdhcLbTcpdSPkLdX7Dvwhhiv2V_KH7YRo,2157
         
     | 
| 
       7 
     | 
    
         
            -
            igbot_base/llmmemory.py,sha256= 
     | 
| 
      
 7 
     | 
    
         
            +
            igbot_base/llmmemory.py,sha256=fhHrqYi3VTDsCc5riK0pbcIUH4rC_xYOJdFKZ_9zndM,1099
         
     | 
| 
       8 
8 
     | 
    
         
             
            igbot_base/logging_adapter.py,sha256=kMuAaQPCba2luk0-WPxAbPNJaBL1yZsaff35ltKWgww,256
         
     | 
| 
       9 
9 
     | 
    
         
             
            igbot_base/models.py,sha256=cgZwQ2GEeM_hCUxSwyls0b9CsjIsgImjzq7b3c289g4,1226
         
     | 
| 
       10 
10 
     | 
    
         
             
            igbot_base/persistable_memory.py,sha256=867Z4l_awD23QSTFDK3uN9TEttKfDpxx9g19c7ULG1Y,167
         
     | 
| 
       11 
11 
     | 
    
         
             
            igbot_base/prompt_template.py,sha256=q7bnU2Rp2Cvm4ixEmKHCyuolTPan6CHfYVAomT5kp10,1573
         
     | 
| 
       12 
12 
     | 
    
         
             
            igbot_base/response_formats.py,sha256=Sp679VfkcyxsR19ddFEHTOM7Ox0u2WBhdji_Y9pVc2M,94
         
     | 
| 
       13 
13 
     | 
    
         
             
            igbot_base/retriever.py,sha256=YHBHxiuPttsIAtjwwIz0fa9q2uFtsg0WoMRCorCt1PM,635
         
     | 
| 
       14 
     | 
    
         
            -
            igbot_base/tokenizer.py,sha256= 
     | 
| 
      
 14 
     | 
    
         
            +
            igbot_base/tokenizer.py,sha256=uvDNr3UOeNL7Hg9HTfcFd-Fzf04SRSyEoOgYoo077Qs,825
         
     | 
| 
       15 
15 
     | 
    
         
             
            igbot_base/tool.py,sha256=ghjuU3cK_VElHGStUl3IYf9dlRDOGM_aQucUQNUH3mU,431
         
     | 
| 
       16 
16 
     | 
    
         
             
            igbot_base/vectorstore.py,sha256=f-S9DmOuehC0rtVAPGz22Guo7ddb1jVw7BygzFJM624,928
         
     | 
| 
       17 
     | 
    
         
            -
            igbot_base-0.0. 
     | 
| 
       18 
     | 
    
         
            -
            igbot_base-0.0. 
     | 
| 
       19 
     | 
    
         
            -
            igbot_base-0.0. 
     | 
| 
       20 
     | 
    
         
            -
            igbot_base-0.0. 
     | 
| 
      
 17 
     | 
    
         
            +
            igbot_base-0.0.22.dist-info/METADATA,sha256=78jnUQdCKgRLQe165z5TBeMDX1BlLdzVOl96ldamszE,235
         
     | 
| 
      
 18 
     | 
    
         
            +
            igbot_base-0.0.22.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
         
     | 
| 
      
 19 
     | 
    
         
            +
            igbot_base-0.0.22.dist-info/top_level.txt,sha256=RGpEN0pLsnfNLoLfpw1D_nLSyZwi3ggSaDq07o4ZEAI,11
         
     | 
| 
      
 20 
     | 
    
         
            +
            igbot_base-0.0.22.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     |