osbot-utils 2.72.0__py3-none-any.whl → 2.74.0__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.
- osbot_utils/helpers/flows/actions/Flow__Data.py +1 -1
- osbot_utils/helpers/flows/models/Flow_Run__Event.py +6 -5
- osbot_utils/helpers/flows/models/Schema__Flow__Artifact.py +1 -1
- osbot_utils/helpers/flows/models/Schema__Flow__Result.py +1 -1
- osbot_utils/helpers/flows/schemas/Schema__Flow__Data.py +1 -1
- osbot_utils/helpers/flows/schemas/Schema__Flow__Event.py +1 -1
- osbot_utils/helpers/flows/schemas/Schema__Flow__Log.py +1 -1
- osbot_utils/helpers/flows/schemas/Schema__Flow__Task__Data.py +1 -1
- osbot_utils/helpers/generators/Generator_Manager.py +1 -1
- osbot_utils/helpers/generators/Model__Generator_Target.py +1 -1
- osbot_utils/helpers/html/schemas/Schema__Html_Document.py +1 -1
- osbot_utils/helpers/llms/actions/LLM_Request__Execute.py +2 -1
- osbot_utils/helpers/llms/actions/Type_Safe__Schema_For__LLMs.py +10 -10
- osbot_utils/helpers/llms/builders/LLM_Request__Builder.py +3 -2
- osbot_utils/helpers/llms/builders/LLM_Request__Builder__Open_AI.py +2 -1
- osbot_utils/helpers/llms/builders/LLM_Request__Factory.py +1 -1
- osbot_utils/helpers/llms/cache/LLM_Cache__Path_Generator.py +7 -6
- osbot_utils/helpers/llms/cache/LLM_Request__Cache.py +10 -10
- osbot_utils/helpers/llms/cache/LLM_Request__Cache__File_System.py +5 -3
- osbot_utils/helpers/llms/cache/LLM_Request__Cache__Storage.py +2 -2
- osbot_utils/helpers/llms/cache/Virtual_Storage__Local__Folder.py +7 -7
- osbot_utils/helpers/llms/cache/Virtual_Storage__Sqlite.py +7 -7
- osbot_utils/helpers/llms/schemas/Safe_Str__LLM__Model_Name.py +1 -1
- osbot_utils/helpers/llms/schemas/Schema__LLM_Cache__Index.py +6 -5
- osbot_utils/helpers/llms/schemas/Schema__LLM_Request__Data.py +2 -1
- osbot_utils/helpers/llms/schemas/Schema__LLM_Response.py +1 -1
- osbot_utils/helpers/llms/schemas/Schema__LLM_Response__Cache.py +7 -6
- osbot_utils/helpers/xml/rss/RSS__Feed__Parser.py +1 -1
- osbot_utils/helpers/xml/rss/RSS__Item.py +1 -1
- osbot_utils/type_safe/Type_Safe.py +11 -10
- osbot_utils/type_safe/Type_Safe__Base.py +3 -3
- osbot_utils/{helpers → type_safe/primitives}/safe_float/Safe_Float__Engineering.py +2 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_float/Safe_Float__Money.py +1 -2
- osbot_utils/{helpers → type_safe/primitives}/safe_float/Safe_Float__Percentage_Exact.py +1 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_int/Safe_Int.py +3 -3
- osbot_utils/{helpers → type_safe/primitives}/safe_int/__init__.py +1 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_str/Safe_Str.py +3 -3
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/cryptography/hashes}/Safe_Str__Hash.py +3 -3
- osbot_utils/type_safe/primitives/safe_str/cryptography/hashes/Safe_Str__SHA1.py +26 -0
- osbot_utils/type_safe/primitives/safe_str/cryptography/hashes/Safe_Str__SHA1__Short.py +24 -0
- osbot_utils/type_safe/primitives/safe_str/cryptography/nacl/Safe_Str__NaCl__Private_Key.py +27 -0
- osbot_utils/type_safe/primitives/safe_str/cryptography/nacl/Safe_Str__NaCl__Public_Key.py +28 -0
- osbot_utils/type_safe/primitives/safe_str/cryptography/nacl/Schema__NaCl__Keys.py +8 -0
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/filesystem}/Safe_Str__File__Name.py +1 -1
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/filesystem}/Safe_Str__File__Path.py +1 -1
- osbot_utils/type_safe/primitives/safe_str/git/Safe_Str__Git__Branch.py +27 -0
- osbot_utils/type_safe/primitives/safe_str/git/Safe_Str__Git__Ref.py +63 -0
- osbot_utils/type_safe/primitives/safe_str/git/Safe_Str__Git__Ref_Base.py +73 -0
- osbot_utils/type_safe/primitives/safe_str/git/Safe_Str__Git__Tag.py +17 -0
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/git}/Safe_Str__Version.py +2 -2
- osbot_utils/type_safe/primitives/safe_str/github/Safe_Str__GitHub__Repo.py +46 -0
- osbot_utils/type_safe/primitives/safe_str/github/Safe_Str__GitHub__Repo_Name.py +35 -0
- osbot_utils/type_safe/primitives/safe_str/github/Safe_Str__GitHub__Repo_Owner.py +39 -0
- osbot_utils/type_safe/primitives/safe_str/github/__init__.py +0 -0
- osbot_utils/{helpers → type_safe/primitives}/safe_str/http/Safe_Str__Http__Content_Type.py +1 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_str/http/Safe_Str__Http__ETag.py +1 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_str/http/Safe_Str__Http__Last_Modified.py +1 -1
- osbot_utils/{helpers → type_safe/primitives}/safe_str/http/Safe_Str__Http__Text.py +1 -1
- osbot_utils/type_safe/primitives/safe_str/http/__init__.py +0 -0
- osbot_utils/{helpers → type_safe/primitives/safe_str/identifiers}/Guid.py +3 -2
- osbot_utils/type_safe/primitives/safe_str/identifiers/__init__.py +0 -0
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/text}/Safe_Str__Text.py +1 -1
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/text}/Safe_Str__Text__Dangerous.py +1 -1
- osbot_utils/type_safe/primitives/safe_str/text/__init__.py +0 -0
- osbot_utils/{helpers/safe_str/http → type_safe/primitives/safe_str/web}/Safe_Str__Html.py +1 -1
- osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/web}/Safe_Str__Url.py +1 -1
- osbot_utils/type_safe/primitives/safe_str/web/__init__.py +0 -0
- osbot_utils/{helpers/safe_int → type_safe/primitives/safe_uint}/Safe_UInt.py +2 -1
- osbot_utils/{helpers/safe_int → type_safe/primitives/safe_uint}/Safe_UInt__Byte.py +1 -1
- osbot_utils/{helpers/safe_int → type_safe/primitives/safe_uint}/Safe_UInt__FileSize.py +1 -1
- osbot_utils/{helpers/safe_int → type_safe/primitives/safe_uint}/Safe_UInt__Percentage.py +1 -1
- osbot_utils/{helpers/safe_int → type_safe/primitives/safe_uint}/Safe_UInt__Port.py +1 -1
- osbot_utils/type_safe/primitives/safe_uint/__init__.py +0 -0
- osbot_utils/type_safe/type_safe_core/__init__.py +0 -0
- osbot_utils/type_safe/{Type_Safe__Dict.py → type_safe_core/collections/Type_Safe__Dict.py} +4 -3
- osbot_utils/type_safe/type_safe_core/collections/__init__.py +0 -0
- osbot_utils/type_safe/type_safe_core/decorators/__init__.py +0 -0
- osbot_utils/type_safe/{decorators → type_safe_core/decorators}/type_safe.py +2 -1
- osbot_utils/type_safe/{Type_Safe__Method.py → type_safe_core/methods/Type_Safe__Method.py} +4 -5
- osbot_utils/type_safe/type_safe_core/methods/__init__.py +0 -0
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Annotations.py +1 -1
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Cache.py +3 -3
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Convert.py +3 -3
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Json_Compressor.py +6 -6
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Raise_Exception.py +1 -1
- osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Validation.py +8 -7
- osbot_utils/type_safe/type_safe_core/shared/__init__.py +0 -0
- osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__Class_Kwargs.py +8 -7
- osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__Default_Value.py +6 -6
- osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__From_Json.py +16 -17
- osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__Init.py +7 -6
- osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__Set_Attr.py +7 -7
- osbot_utils/type_safe/type_safe_core/steps/__init__.py +0 -0
- osbot_utils/utils/Files.py +2 -3
- osbot_utils/version +1 -1
- osbot_utils-2.74.0.dist-info/METADATA +212 -0
- {osbot_utils-2.72.0.dist-info → osbot_utils-2.74.0.dist-info}/RECORD +122 -98
- osbot_utils-2.72.0.dist-info/METADATA +0 -44
- /osbot_utils/{helpers/safe_float → type_safe/primitives}/__init__.py +0 -0
- /osbot_utils/{helpers → type_safe/primitives}/safe_float/Safe_Float.py +0 -0
- /osbot_utils/{helpers/safe_str → type_safe/primitives/safe_float}/__init__.py +0 -0
- /osbot_utils/{helpers → type_safe/primitives/safe_int}/Timestamp_Now.py +0 -0
- /osbot_utils/{helpers/safe_str/schemas → type_safe/primitives/safe_str}/Enum__Safe_Str__Regex_Mode.py +0 -0
- /osbot_utils/{helpers/safe_str/http → type_safe/primitives/safe_str}/__init__.py +0 -0
- /osbot_utils/{helpers/safe_str/schemas → type_safe/primitives/safe_str/cryptography}/__init__.py +0 -0
- /osbot_utils/type_safe/{decorators → primitives/safe_str/cryptography/hashes}/__init__.py +0 -0
- /osbot_utils/type_safe/{methods → primitives/safe_str/cryptography/nacl}/__init__.py +0 -0
- /osbot_utils/type_safe/{shared → primitives/safe_str/filesystem}/__init__.py +0 -0
- /osbot_utils/type_safe/{steps → primitives/safe_str/git}/__init__.py +0 -0
- /osbot_utils/{helpers → type_safe/primitives/safe_str/identifiers}/Random_Guid.py +0 -0
- /osbot_utils/{helpers → type_safe/primitives/safe_str/identifiers}/Random_Guid_Short.py +0 -0
- /osbot_utils/{helpers → type_safe/primitives/safe_str/identifiers}/Safe_Id.py +0 -0
- /osbot_utils/{helpers/safe_str/http → type_safe/primitives/safe_str/web}/Safe_Str__IP_Address.py +0 -0
- /osbot_utils/type_safe/{Type_Safe__List.py → type_safe_core/collections/Type_Safe__List.py} +0 -0
- /osbot_utils/type_safe/{Type_Safe__Set.py → type_safe_core/collections/Type_Safe__Set.py} +0 -0
- /osbot_utils/type_safe/{Type_Safe__Tuple.py → type_safe_core/collections/Type_Safe__Tuple.py} +0 -0
- /osbot_utils/type_safe/{methods → type_safe_core/methods}/type_safe_property.py +0 -0
- /osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Json_Compressor__Type_Registry.py +0 -0
- /osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Not_Cached.py +0 -0
- /osbot_utils/type_safe/{shared → type_safe_core/shared}/Type_Safe__Shared__Variables.py +0 -0
- /osbot_utils/type_safe/{steps → type_safe_core/steps}/Type_Safe__Step__Default_Kwargs.py +0 -0
- {osbot_utils-2.72.0.dist-info → osbot_utils-2.74.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.72.0.dist-info → osbot_utils-2.74.0.dist-info}/WHEEL +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Optional, Dict, Any
|
2
|
-
from osbot_utils.
|
2
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
3
3
|
from osbot_utils.helpers.flows.models.Flow_Run__Event import Flow_Run__Event
|
4
4
|
from osbot_utils.helpers.flows.models.Schema__Flow__Artifact import Schema__Flow__Artifact
|
5
5
|
from osbot_utils.helpers.flows.models.Schema__Flow__Result import Schema__Flow__Result
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
from osbot_utils.type_safe.
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.
|
5
|
-
from osbot_utils.helpers.flows.models.
|
1
|
+
|
2
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Random_Guid import Random_Guid
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
4
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
5
|
+
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
6
|
+
from osbot_utils.helpers.flows.models.Flow_Run__Event_Type import Flow_Run__Event_Type
|
6
7
|
|
7
8
|
class Flow_Run__Event(Type_Safe):
|
8
9
|
event_id : Random_Guid
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
2
|
-
from osbot_utils.
|
2
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
3
3
|
|
4
4
|
class Schema__Flow__Result(Type_Safe): # Represents a result produced by the flow
|
5
5
|
key : str
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Optional, Dict, List, Any
|
2
|
-
from osbot_utils.
|
2
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
3
3
|
from osbot_utils.helpers.flows.models.Flow_Run__Event import Flow_Run__Event
|
4
4
|
from osbot_utils.helpers.flows.models.Schema__Flow__Artifact import Schema__Flow__Artifact
|
5
5
|
from osbot_utils.helpers.flows.models.Schema__Flow__Result import Schema__Flow__Result
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# todo: this needs refactoring with the Flow_Run__Event events stored in the Schema__Flow__Data. object
|
2
2
|
|
3
3
|
|
4
|
-
# from osbot_utils.
|
4
|
+
# from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
5
5
|
# from osbot_utils.helpers.flows.schemas.Schema__Flow__Event__Data import Schema__Flow__Event__Data
|
6
6
|
# from osbot_utils.type_safe.Type_Safe import Type_Safe
|
7
7
|
#
|
@@ -4,7 +4,7 @@ from types import Generator
|
|
4
4
|
from typing import Dict # Typing imports for type hints
|
5
5
|
from typing import Union
|
6
6
|
from osbot_utils.type_safe.Type_Safe import Type_Safe # Type_Safe base class for type-safe attributes
|
7
|
-
from osbot_utils.
|
7
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Random_Guid import Random_Guid # Helper for generating unique IDs
|
8
8
|
from osbot_utils.helpers.generators.Generator_Context_Manager import Generator_Context_Manager
|
9
9
|
from osbot_utils.helpers.generators.Model__Generator_State import Model__Generator_State
|
10
10
|
from osbot_utils.helpers.generators.Model__Generator_Target import Model__Generator_Target
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from types import GeneratorType
|
2
2
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
3
|
-
from osbot_utils.
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Random_Guid import Random_Guid
|
4
4
|
from osbot_utils.helpers.generators.Model__Generator_State import Model__Generator_State
|
5
5
|
|
6
6
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from osbot_utils.
|
1
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
2
2
|
from osbot_utils.helpers.html.schemas.Schema__Html_Node import Schema__Html_Node
|
3
3
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
4
4
|
|
@@ -5,7 +5,8 @@ from osbot_utils.helpers.llms.platforms.open_ai.API__LLM__Open_AI import API__
|
|
5
5
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request import Schema__LLM_Request
|
6
6
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response import Schema__LLM_Response
|
7
7
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
8
|
-
from osbot_utils.type_safe.decorators.type_safe
|
8
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
9
|
+
|
9
10
|
|
10
11
|
class LLM_Request__Execute(Type_Safe):
|
11
12
|
llm_cache : LLM_Request__Cache
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import re
|
2
|
-
from typing
|
3
|
-
from osbot_utils.type_safe.Type_Safe
|
4
|
-
from osbot_utils.type_safe.decorators.type_safe
|
5
|
-
from osbot_utils.type_safe.shared.Type_Safe__Cache
|
6
|
-
from osbot_utils.type_safe.validators.Type_Safe__Validator
|
7
|
-
from osbot_utils.type_safe.validators.Validator__Min
|
8
|
-
from osbot_utils.type_safe.validators.Validator__Max
|
9
|
-
from osbot_utils.type_safe.validators.Validator__Regex
|
10
|
-
from osbot_utils.type_safe.validators.Validator__One_Of
|
11
|
-
from osbot_utils.helpers.python_compatibility.python_3_8
|
2
|
+
from typing import Type, Any, List, Dict, Tuple, Set, Optional, Union, get_origin, get_args
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
4
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
5
|
+
from osbot_utils.type_safe.type_safe_core.shared.Type_Safe__Cache import type_safe_cache
|
6
|
+
from osbot_utils.type_safe.validators.Type_Safe__Validator import Type_Safe__Validator
|
7
|
+
from osbot_utils.type_safe.validators.Validator__Min import Validator__Min
|
8
|
+
from osbot_utils.type_safe.validators.Validator__Max import Validator__Max
|
9
|
+
from osbot_utils.type_safe.validators.Validator__Regex import Validator__Regex
|
10
|
+
from osbot_utils.type_safe.validators.Validator__One_Of import Validator__One_Of
|
11
|
+
from osbot_utils.helpers.python_compatibility.python_3_8 import Annotated
|
12
12
|
import inspect
|
13
13
|
|
14
14
|
|
@@ -6,9 +6,10 @@ from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Data impo
|
|
6
6
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Function_Call import Schema__LLM_Request__Function_Call
|
7
7
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Message__Content import Schema__LLM_Request__Message__Content
|
8
8
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Message__Role import Schema__LLM_Request__Message__Role
|
9
|
-
from osbot_utils.helpers.safe_str.Safe_Str__Text import Safe_Str__Text
|
10
9
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
11
|
-
from osbot_utils.type_safe.
|
10
|
+
from osbot_utils.type_safe.primitives.safe_str.text.Safe_Str__Text import Safe_Str__Text
|
11
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
12
|
+
|
12
13
|
|
13
14
|
class LLM_Request__Builder(Type_Safe):
|
14
15
|
schema_generator : Type_Safe__Schema_For__LLMs
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import Dict, Any
|
2
2
|
from osbot_utils.helpers.llms.builders.LLM_Request__Builder import LLM_Request__Builder
|
3
|
-
from osbot_utils.type_safe.decorators.type_safe
|
3
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
4
|
+
|
4
5
|
|
5
6
|
class LLM_Request__Builder__Open_AI(LLM_Request__Builder):
|
6
7
|
|
@@ -2,7 +2,7 @@ from typing import Type, Opt
|
|
2
2
|
from osbot_utils.helpers.llms.builders.LLM_Request__Builder import LLM_Request__Builder
|
3
3
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Data import Schema__LLM_Request__Data
|
4
4
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
5
|
-
from osbot_utils.type_safe.decorators.type_safe
|
5
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
6
6
|
|
7
7
|
|
8
8
|
class LLM_Request__Factory(Type_Safe): # Factory class for creating common LLM request patterns.
|
@@ -1,9 +1,10 @@
|
|
1
|
-
from datetime
|
2
|
-
from typing
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.
|
5
|
-
from osbot_utils.type_safe.
|
6
|
-
from osbot_utils.type_safe.decorators.type_safe
|
1
|
+
from datetime import datetime
|
2
|
+
from typing import List, Optional
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Safe_Id import Safe_Id
|
4
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
5
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
6
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
7
|
+
|
7
8
|
|
8
9
|
class LLM_Cache__Path_Generator(Type_Safe):
|
9
10
|
@type_safe
|
@@ -1,13 +1,13 @@
|
|
1
|
-
from typing
|
2
|
-
from osbot_utils.helpers.Obj_Id
|
3
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Cache__Index
|
4
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request
|
5
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response
|
6
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response__Cache
|
7
|
-
from osbot_utils.
|
8
|
-
from osbot_utils.type_safe.
|
9
|
-
from osbot_utils.type_safe.decorators.type_safe
|
10
|
-
from osbot_utils.utils.Json
|
1
|
+
from typing import Dict, Optional, List
|
2
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
3
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Cache__Index import Schema__LLM_Cache__Index
|
4
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request import Schema__LLM_Request
|
5
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response import Schema__LLM_Response
|
6
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response__Cache import Schema__LLM_Response__Cache
|
7
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
8
|
+
from osbot_utils.type_safe.primitives.safe_str.cryptography.hashes.Safe_Str__Hash import Safe_Str__Hash
|
9
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
10
|
+
from osbot_utils.utils.Json import json_md5
|
11
11
|
|
12
12
|
SIZE__VALUE_HASH = 10
|
13
13
|
|
@@ -2,7 +2,7 @@ from datetime
|
|
2
2
|
from typing import Optional, List
|
3
3
|
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
|
4
4
|
from osbot_utils.helpers.Obj_Id import Obj_Id
|
5
|
-
from osbot_utils.
|
5
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Safe_Id import Safe_Id
|
6
6
|
from osbot_utils.helpers.llms.cache.LLM_Cache__Path_Generator import LLM_Cache__Path_Generator
|
7
7
|
from osbot_utils.helpers.llms.cache.LLM_Request__Cache import LLM_Request__Cache
|
8
8
|
from osbot_utils.helpers.llms.cache.LLM_Request__Cache__Storage import LLM_Request__Cache__Storage
|
@@ -11,8 +11,10 @@ from osbot_utils.helpers.llms.schemas.Schema__LLM_Cache__Index
|
|
11
11
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request import Schema__LLM_Request
|
12
12
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response import Schema__LLM_Response
|
13
13
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response__Cache import Schema__LLM_Response__Cache
|
14
|
-
from osbot_utils.
|
15
|
-
|
14
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
15
|
+
|
16
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
17
|
+
|
16
18
|
|
17
19
|
class LLM_Request__Cache__File_System(LLM_Request__Cache):
|
18
20
|
virtual_storage: Virtual_Storage__Local__Folder
|
@@ -4,10 +4,10 @@ from osbot_utils.decorators.methods.cache_on_self
|
|
4
4
|
from osbot_utils.helpers.llms.cache.Virtual_Storage__Local__Folder import Virtual_Storage__Local__Folder
|
5
5
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Cache__Index import Schema__LLM_Cache__Index
|
6
6
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response__Cache import Schema__LLM_Response__Cache
|
7
|
-
from osbot_utils.helpers.safe_str.Safe_Str__File__Path import Safe_Str__File__Path
|
8
7
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
9
|
-
from osbot_utils.type_safe.decorators.type_safe import type_safe
|
10
8
|
from osbot_utils.helpers.Obj_Id import Obj_Id, is_obj_id
|
9
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
10
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
11
11
|
from osbot_utils.utils.Files import path_combine_safe, file_name_without_extension, parent_folder
|
12
12
|
|
13
13
|
FILE_NAME__CACHE_INDEX = "cache_index.json"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
from typing
|
2
|
-
from osbot_utils.decorators.methods.cache_on_self
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.type_safe.
|
5
|
-
from osbot_utils.type_safe.decorators.type_safe
|
6
|
-
from osbot_utils.utils.Files
|
7
|
-
from osbot_utils.utils.Json
|
1
|
+
from typing import List, Optional, Dict, Any
|
2
|
+
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
4
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
5
|
+
from osbot_utils.type_safe.type_safe_core.decorators.type_safe import type_safe
|
6
|
+
from osbot_utils.utils.Files import current_temp_folder, path_combine_safe, folder_create, file_exists, folder_exists, file_delete, parent_folder, create_folder, files_recursive
|
7
|
+
from osbot_utils.utils.Json import json_save_file, json_load_file
|
8
8
|
|
9
9
|
class Virtual_Storage__Local__Folder(Type_Safe):
|
10
10
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
from typing
|
2
|
-
from osbot_utils.
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.
|
5
|
-
from osbot_utils.helpers.
|
6
|
-
from osbot_utils.
|
7
|
-
from osbot_utils.
|
1
|
+
from typing import List, Optional, Dict, Any
|
2
|
+
from osbot_utils.utils.Files import path_combine_safe
|
3
|
+
from osbot_utils.utils.Json import json_parse, json_dumps
|
4
|
+
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
|
5
|
+
from osbot_utils.helpers.sqlite.domains.Sqlite__DB__Files import Sqlite__DB__Files
|
6
|
+
from osbot_utils.helpers.llms.cache.Virtual_Storage__Local__Folder import Virtual_Storage__Local__Folder
|
7
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
8
8
|
|
9
9
|
class Virtual_Storage__Sqlite(Virtual_Storage__Local__Folder):
|
10
10
|
db : Sqlite__DB__Files # SQLite database for file storage (defaults to an in memory db)
|
@@ -1,8 +1,9 @@
|
|
1
|
-
from typing
|
2
|
-
from osbot_utils.helpers.Obj_Id
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.
|
5
|
-
from osbot_utils.type_safe.
|
1
|
+
from typing import Dict
|
2
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
4
|
+
from osbot_utils.type_safe.primitives.safe_str.cryptography.hashes.Safe_Str__Hash import Safe_Str__Hash
|
5
|
+
from osbot_utils.type_safe.primitives.safe_str.filesystem.Safe_Str__File__Path import Safe_Str__File__Path
|
6
|
+
|
6
7
|
|
7
8
|
class Schema__LLM_Cache__Index(Type_Safe):
|
8
9
|
cache_id__from__hash__request : Dict[Safe_Str__Hash, Obj_Id] # map hash of the full request to a Schema__LLM_Response__Cache to the cache_id
|
@@ -2,8 +2,9 @@ from typing impo
|
|
2
2
|
from osbot_utils.helpers.llms.schemas.Safe_Str__LLM__Model_Name import Safe_Str__LLM__Model_Name
|
3
3
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Function_Call import Schema__LLM_Request__Function_Call
|
4
4
|
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request__Message__Content import Schema__LLM_Request__Message__Content
|
5
|
-
from osbot_utils.helpers.safe_str.Safe_Str__Text import Safe_Str__Text
|
6
5
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
6
|
+
from osbot_utils.type_safe.primitives.safe_str.text.Safe_Str__Text import Safe_Str__Text
|
7
|
+
|
7
8
|
|
8
9
|
class Schema__LLM_Request__Data(Type_Safe): # Schema for LLM API request data
|
9
10
|
model : Safe_Str__LLM__Model_Name # LLM model identifier
|
@@ -1,9 +1,10 @@
|
|
1
|
-
from osbot_utils.helpers.Obj_Id
|
2
|
-
from osbot_utils.
|
3
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request
|
4
|
-
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response
|
5
|
-
from osbot_utils.
|
6
|
-
from osbot_utils.type_safe.
|
1
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
2
|
+
from osbot_utils.type_safe.primitives.safe_int.Timestamp_Now import Timestamp_Now
|
3
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Request import Schema__LLM_Request
|
4
|
+
from osbot_utils.helpers.llms.schemas.Schema__LLM_Response import Schema__LLM_Response
|
5
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
6
|
+
from osbot_utils.type_safe.primitives.safe_str.cryptography.hashes.Safe_Str__Hash import Safe_Str__Hash
|
7
|
+
|
7
8
|
|
8
9
|
class Schema__LLM_Response__Cache(Type_Safe):
|
9
10
|
cache_id : Obj_Id
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Dict, Any
|
2
|
-
from osbot_utils.
|
2
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Guid import Guid
|
3
3
|
from osbot_utils.helpers.xml.rss.RSS__Channel import RSS__Channel
|
4
4
|
from osbot_utils.helpers.xml.rss.RSS__Feed import RSS__Feed
|
5
5
|
from osbot_utils.helpers.xml.rss.RSS__Image import RSS__Image
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Dict, List, Any
|
2
2
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
3
|
-
from osbot_utils.
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.identifiers.Guid import Guid
|
4
4
|
from osbot_utils.helpers.xml.rss.RSS__Enclosure import RSS__Enclosure
|
5
5
|
|
6
6
|
class RSS__Item(Type_Safe):
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# todo: find a way to add these documentations strings to a separate location so that
|
2
2
|
# the data is available in IDE's code complete
|
3
|
-
from osbot_utils.type_safe.shared.Type_Safe__Validation
|
4
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__Class_Kwargs
|
5
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__Default_Kwargs
|
6
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__Default_Value
|
7
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__Init
|
8
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__Set_Attr
|
9
|
-
from osbot_utils.utils.Objects
|
3
|
+
from osbot_utils.type_safe.type_safe_core.shared.Type_Safe__Validation import type_safe_validation
|
4
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__Class_Kwargs import type_safe_step_class_kwargs
|
5
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__Default_Kwargs import type_safe_step_default_kwargs
|
6
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__Default_Value import type_safe_step_default_value
|
7
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__Init import type_safe_step_init
|
8
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__Set_Attr import type_safe_step_set_attr
|
9
|
+
from osbot_utils.utils.Objects import serialize_to_dict
|
10
10
|
|
11
11
|
class Type_Safe:
|
12
12
|
|
@@ -63,7 +63,7 @@ class Type_Safe:
|
|
63
63
|
return self.serialize_to_dict()
|
64
64
|
|
65
65
|
def json__compress(self): # todo: see if this is the best place to put these Type_Safe__Json_Compressor methods
|
66
|
-
from osbot_utils.type_safe.shared.Type_Safe__Json_Compressor import Type_Safe__Json_Compressor
|
66
|
+
from osbot_utils.type_safe.type_safe_core.shared.Type_Safe__Json_Compressor import Type_Safe__Json_Compressor
|
67
67
|
return Type_Safe__Json_Compressor().compress(self)
|
68
68
|
|
69
69
|
# todo: see if we still need this. now that Type_Safe handles base types, there should be no need for this
|
@@ -107,11 +107,12 @@ class Type_Safe:
|
|
107
107
|
|
108
108
|
@classmethod
|
109
109
|
def from_json(cls, json_data, raise_on_not_found=False):
|
110
|
-
from osbot_utils.type_safe.steps.Type_Safe__Step__From_Json import type_safe_step_from_json
|
110
|
+
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__From_Json import type_safe_step_from_json # circular dependency on Type_Safe
|
111
111
|
return type_safe_step_from_json.from_json(cls, json_data, raise_on_not_found)
|
112
112
|
|
113
113
|
@classmethod
|
114
114
|
def from_json__compressed(cls, json_data): # todo: see if this is the best place to put these Type_Safe__Json_Compressor methods
|
115
|
-
|
115
|
+
|
116
|
+
from osbot_utils.type_safe.type_safe_core.shared.Type_Safe__Json_Compressor import Type_Safe__Json_Compressor
|
116
117
|
json_data__decompressed = Type_Safe__Json_Compressor().decompress(json_data)
|
117
118
|
return cls.from_json(json_data__decompressed)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import types
|
2
|
-
from typing
|
3
|
-
from osbot_utils.helpers.Obj_Id
|
4
|
-
from osbot_utils.type_safe.shared.Type_Safe__Cache
|
2
|
+
from typing import get_args, Union, Optional, Any, ForwardRef
|
3
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
4
|
+
from osbot_utils.type_safe.type_safe_core.shared.Type_Safe__Cache import type_safe_cache
|
5
5
|
|
6
6
|
EXACT_TYPE_MATCH = (int, float, str, bytes, bool, complex)
|
7
7
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
from typing
|
2
|
-
from osbot_utils.
|
3
|
-
from osbot_utils.type_safe.
|
1
|
+
from typing import Optional, Union
|
2
|
+
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
|
3
|
+
from osbot_utils.type_safe.primitives.safe_float.Safe_Float import Safe_Float
|
4
4
|
|
5
5
|
|
6
6
|
class Safe_Int(Type_Safe__Primitive, int): # Base class for type-safe integers with validation rules
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import re
|
2
|
-
from typing
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.type_safe.
|
2
|
+
from typing import Optional
|
3
|
+
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
|
4
|
+
from osbot_utils.type_safe.primitives.safe_str.Enum__Safe_Str__Regex_Mode import Enum__Safe_Str__Regex_Mode
|
5
5
|
|
6
6
|
TYPE_SAFE__STR__REGEX__SAFE_STR = re.compile(r'[^a-zA-Z0-9]') # Only allow alphanumerics and numbers
|
7
7
|
TYPE_SAFE__STR__MAX_LENGTH = 512
|
osbot_utils/{helpers/safe_str → type_safe/primitives/safe_str/cryptography/hashes}/Safe_Str__Hash.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import re
|
2
|
-
from typing
|
3
|
-
from osbot_utils.
|
4
|
-
from osbot_utils.utils.Misc
|
2
|
+
from typing import Any
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.Safe_Str import Safe_Str
|
4
|
+
from osbot_utils.utils.Misc import bytes_md5
|
5
5
|
|
6
6
|
# Constants for hash validation
|
7
7
|
SIZE__VALUE_HASH = 10
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import re
|
2
|
+
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.Enum__Safe_Str__Regex_Mode import Enum__Safe_Str__Regex_Mode
|
4
|
+
from osbot_utils.type_safe.primitives.safe_str.Safe_Str import Safe_Str
|
5
|
+
|
6
|
+
|
7
|
+
# Full 40-character commit SHA
|
8
|
+
TYPE_SAFE_STR__GITHUB__SHA__REGEX = re.compile(r'^[a-fA-F0-9]{40}$')
|
9
|
+
TYPE_SAFE_STR__GITHUB__SHA__LENGTH = 40
|
10
|
+
|
11
|
+
# todo: move to OSBot_Utils
|
12
|
+
class Safe_Str__SHA1(Safe_Str):
|
13
|
+
"""
|
14
|
+
Safe string class for full 40-character Git commit SHAs.
|
15
|
+
|
16
|
+
Examples:
|
17
|
+
- "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"
|
18
|
+
- "abc1234567890abcdef1234567890abcdef12345"
|
19
|
+
"""
|
20
|
+
regex = TYPE_SAFE_STR__GITHUB__SHA__REGEX
|
21
|
+
regex_mode = Enum__Safe_Str__Regex_Mode.MATCH
|
22
|
+
max_length = TYPE_SAFE_STR__GITHUB__SHA__LENGTH
|
23
|
+
exact_length = True
|
24
|
+
allow_empty = False
|
25
|
+
trim_whitespace = True
|
26
|
+
strict_validation = True
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import re
|
2
|
+
from osbot_utils.type_safe.primitives.safe_str.Enum__Safe_Str__Regex_Mode import Enum__Safe_Str__Regex_Mode
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.Safe_Str import Safe_Str
|
4
|
+
|
5
|
+
|
6
|
+
TYPE_SAFE_STR__GITHUB__SHA_SHORT__REGEX = re.compile(r'^[a-fA-F0-9]{7}$')
|
7
|
+
TYPE_SAFE_STR__GITHUB__SHA_SHORT__LENGTH = 7
|
8
|
+
|
9
|
+
# todo: move to OSBot_Utils
|
10
|
+
class Safe_Str__SHA1__Short(Safe_Str):
|
11
|
+
"""
|
12
|
+
Safe string class for short 7-character Git commit SHAs.
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
- "7fd1a60"
|
16
|
+
- "abc1234"
|
17
|
+
"""
|
18
|
+
regex = TYPE_SAFE_STR__GITHUB__SHA_SHORT__REGEX
|
19
|
+
regex_mode = Enum__Safe_Str__Regex_Mode.MATCH
|
20
|
+
max_length = TYPE_SAFE_STR__GITHUB__SHA_SHORT__LENGTH
|
21
|
+
exact_length = True
|
22
|
+
allow_empty = False
|
23
|
+
trim_whitespace = True
|
24
|
+
strict_validation = True
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import re
|
2
|
+
from osbot_utils.type_safe.primitives.safe_str.Safe_Str import Safe_Str
|
3
|
+
from osbot_utils.type_safe.primitives.safe_str.Enum__Safe_Str__Regex_Mode import Enum__Safe_Str__Regex_Mode
|
4
|
+
|
5
|
+
TYPE_SAFE_STR__NACL__PRIVATE_KEY__REGEX = re.compile(r'^[a-fA-F0-9]{64}$')
|
6
|
+
TYPE_SAFE_STR__NACL__PRIVATE_KEY__LENGTH = 64 # 32 bytes as hex = 64 characters
|
7
|
+
|
8
|
+
class Safe_Str__NaCl__Private_Key(Safe_Str):
|
9
|
+
"""
|
10
|
+
Safe string class for NaCl (Curve25519) private keys in hexadecimal format.
|
11
|
+
|
12
|
+
NaCl private keys are 32 bytes (256 bits), represented as 64 hexadecimal characters.
|
13
|
+
These keys are used with libsodium/PyNaCl for asymmetric encryption.
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
- "d4c8f7e3a2b1c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3"
|
17
|
+
- "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
|
18
|
+
|
19
|
+
Security Note: Private keys should NEVER be exposed or logged.
|
20
|
+
"""
|
21
|
+
regex = TYPE_SAFE_STR__NACL__PRIVATE_KEY__REGEX
|
22
|
+
regex_mode = Enum__Safe_Str__Regex_Mode.MATCH
|
23
|
+
max_length = TYPE_SAFE_STR__NACL__PRIVATE_KEY__LENGTH
|
24
|
+
exact_length = True
|
25
|
+
allow_empty = False
|
26
|
+
trim_whitespace = True
|
27
|
+
strict_validation = True
|