glchat-plugin 0.0.0__py3-none-any.whl → 0.2.1__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.
@@ -0,0 +1 @@
1
+ """Module for glchat_plugin context."""
@@ -0,0 +1,57 @@
1
+ """Provides a class for context manager.
2
+
3
+ Authors:
4
+ Ryan Ignatius Hadiwijaya (ryan.i.hadiwijaya@gdplabs.id)
5
+
6
+ References:
7
+ NONE
8
+ """
9
+
10
+ from contextvars import ContextVar
11
+
12
+
13
+ class ContextManager:
14
+ """A Context Manager.
15
+
16
+ This class is used to manage the context of the application.
17
+ """
18
+
19
+ _tenant: ContextVar[str | None] = ContextVar("tenant_id", default=None)
20
+ _user: ContextVar[str | None] = ContextVar("user_id", default=None)
21
+
22
+ @classmethod
23
+ def set_tenant(cls, tenant_id: str) -> None:
24
+ """Set the tenant id in the context.
25
+
26
+ Args:
27
+ tenant_id (str): The tenant id.
28
+ """
29
+ cls._tenant.set(tenant_id)
30
+
31
+ @classmethod
32
+ def get_tenant(cls) -> str | None:
33
+ """Get the tenant id from the context.
34
+
35
+ Returns:
36
+ str | None: The tenant id.
37
+ """
38
+ tenant_id = cls._tenant.get()
39
+ return tenant_id
40
+
41
+ @classmethod
42
+ def set_user(cls, user_id: str) -> None:
43
+ """Set the user id in the context.
44
+
45
+ Args:
46
+ user_id (str): The user id.
47
+ """
48
+ cls._user.set(user_id)
49
+
50
+ @classmethod
51
+ def get_user(cls) -> str | None:
52
+ """Get the user id from the context.
53
+
54
+ Returns:
55
+ str | None: The user id.
56
+ """
57
+ return cls._user.get()
@@ -0,0 +1 @@
1
+ """Module for glchat_plugin custom service."""
@@ -0,0 +1,31 @@
1
+ """Provides a base class for tenant service.
2
+
3
+ Authors:
4
+ Ryan Ignatius Hadiwijaya (ryan.i.hadiwijaya@gdplabs.id)
5
+
6
+ References:
7
+ NONE
8
+ """
9
+
10
+ from abc import ABC, abstractmethod
11
+ from typing import Any
12
+
13
+
14
+ class BaseTenantService(ABC):
15
+ """A base class for tenant service."""
16
+
17
+ @abstractmethod
18
+ async def get_tenant_id(self, **kwargs: Any) -> str:
19
+ """Abstract method to get the tenant id.
20
+
21
+ Args:
22
+ **kwargs (Any): Additional keyword arguments for tenant identification.
23
+ The kwargs are Fast API Request object.
24
+
25
+ Returns:
26
+ str: tenant id.
27
+
28
+ Raises:
29
+ NotImplementedError: If the method is not implemented.
30
+ """
31
+ raise NotImplementedError
@@ -0,0 +1,82 @@
1
+ """Provides a base class for user service.
2
+
3
+ Authors:
4
+ Immanuel Rhesa (immanuel.rhesa@gdplabs.id)
5
+ Hermes Vincentius Gani (hermes.v.gani@gdplabs.id)
6
+
7
+ References:
8
+ NONE
9
+ """
10
+
11
+ from abc import ABC, abstractmethod
12
+ from typing import Any
13
+
14
+
15
+ class BaseUserService(ABC):
16
+ """A base class for user service."""
17
+
18
+ @abstractmethod
19
+ async def get_user_id(self, **kwargs: Any) -> str | None:
20
+ """Abstract method to get the user id.
21
+
22
+ Args:
23
+ **kwargs (Any): Additional keyword arguments for user identification.
24
+
25
+ Returns:
26
+ str | None: user id, None if not found.
27
+
28
+ Raises:
29
+ NotImplementedError: If the method is not implemented.
30
+ """
31
+ raise NotImplementedError
32
+
33
+ @abstractmethod
34
+ async def register(self, **kwargs: Any):
35
+ """Abstract method to register a new user.
36
+
37
+ Args:
38
+ **kwargs (Any): Additional keyword arguments for user registration.
39
+
40
+ Raises:
41
+ NotImplementedError: If the method is not implemented.
42
+ """
43
+ raise NotImplementedError
44
+
45
+ @abstractmethod
46
+ async def login(self, **kwargs: Any):
47
+ """Abstract method to authenticate and login a user.
48
+
49
+ Args:
50
+ **kwargs (Any): Additional keyword arguments for user login.
51
+
52
+ Raises:
53
+ NotImplementedError: If the method is not implemented.
54
+ """
55
+ raise NotImplementedError
56
+
57
+ @abstractmethod
58
+ async def get_applications(self, **kwargs: Any) -> Any:
59
+ """Abstract method to get user applications.
60
+
61
+ Args:
62
+ **kwargs (Any): Additional keyword arguments for retrieving applications.
63
+
64
+ Returns:
65
+ Any: User applications data.
66
+
67
+ Raises:
68
+ NotImplementedError: If the method is not implemented.
69
+ """
70
+ raise NotImplementedError
71
+
72
+ @abstractmethod
73
+ async def set_user_applications(self, **kwargs: Any):
74
+ """Abstract method to set user applications.
75
+
76
+ Args:
77
+ **kwargs (Any): Additional keyword arguments for setting user applications.
78
+
79
+ Raises:
80
+ NotImplementedError: If the method is not implemented.
81
+ """
82
+ raise NotImplementedError
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glchat-plugin
3
- Version: 0.0.0
3
+ Version: 0.2.1
4
4
  Author-email: GenAI SDK Team <gat-sdk@gdplabs.id>
5
5
  Requires-Python: <3.13,>=3.11
6
6
  Description-Content-Type: text/markdown
@@ -2,16 +2,21 @@ glchat_plugin/__init__.py,sha256=SHSBMz7JDU6MecyIrhHu5-3NVs89JkXhyvD3ZGOkWOE,37
2
2
  glchat_plugin/config/__init__.py,sha256=DNnX8B_TvAN89oyMgq32zG1DeaezODrihiAXTwOPT5o,39
3
3
  glchat_plugin/config/app_config.py,sha256=9_ShYtaQ7Rp14sSkrIFLoOAMlbwVlm13EuCxzOn4NCI,426
4
4
  glchat_plugin/config/constant.py,sha256=hdTXG5mIULV86DepClE97VGhn9E-HtsjZ9PyLKKEdmc,689
5
+ glchat_plugin/context/__init__.py,sha256=3Wx_apMIS6z-m6eRs6hoyOsJFLJfKmMFOkrPDkPQfJI,40
6
+ glchat_plugin/context/context_manager.py,sha256=0lhO0w_hd5dUdIEJQ2LOJFZsgpzitQU_aPZfTfQK3vw,1302
5
7
  glchat_plugin/pipeline/__init__.py,sha256=Sk-NfIGyA9VKIg0Bt5OHatNUYyWVPh9i5xhE5DFAfbo,41
6
8
  glchat_plugin/pipeline/base_pipeline_preset_config.py,sha256=2DxJlroZ_tvVO6DYo1R07cjhWgKQJpysw1GsJ3BNRnw,1100
7
9
  glchat_plugin/pipeline/pipeline_handler.py,sha256=vDvIPI7Y39K_DI3jvQZsXC9YzQLUI4TuC-boyasdey8,24405
8
10
  glchat_plugin/pipeline/pipeline_plugin.py,sha256=1i7w7WepM5gON4Kx10SjL7NV7-SYVAmRE1EW2m_dOYg,4028
11
+ glchat_plugin/service/__init__.py,sha256=9T4qzyYL052qLqva5el1F575OTRNaaf9tb9UvW-leTc,47
12
+ glchat_plugin/service/base_tenant_service.py,sha256=CB-jJWXi87nTcjO1XhPoSgNMf2YA_LfXoHr30ye0VtI,734
13
+ glchat_plugin/service/base_user_service.py,sha256=qnRKl2u1xhGc4wMaOd_h_mAuxM7GduyDbqebj-k3GDE,2211
9
14
  glchat_plugin/storage/__init__.py,sha256=VNO7ua2yAOLzXwe6H6zDZz9yXbhQfKqNJzxE3G8IyfA,50
10
15
  glchat_plugin/storage/base_anonymizer_storage.py,sha256=oFwovWrsjM7v1YjeN-4p-M3OGnAeo_Y7-9xqlToI180,1969
11
16
  glchat_plugin/storage/base_chat_history_storage.py,sha256=JvUUFMu_9jRBQ9yug_x7S4rQjZEA1vM5ombDvz-7zCE,11095
12
17
  glchat_plugin/tools/__init__.py,sha256=OFotHbgQ8mZEbdlvlv5aVMdxfubPvkVWAcTwhIPdIqQ,542
13
18
  glchat_plugin/tools/decorators.py,sha256=AvQBV18wzXWdC483RSSmpfh92zsqTyp8SzDLIkreIGU,3925
14
- glchat_plugin-0.0.0.dist-info/METADATA,sha256=NEZYkCIYTqWadnHpdzciOFNLkVLlf3b3lJLsELoS3DY,2063
15
- glchat_plugin-0.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- glchat_plugin-0.0.0.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
17
- glchat_plugin-0.0.0.dist-info/RECORD,,
19
+ glchat_plugin-0.2.1.dist-info/METADATA,sha256=ifI1xRBYDUJTJhbsXYuwIM3ocETs87mkODs9h5VrXcg,2063
20
+ glchat_plugin-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ glchat_plugin-0.2.1.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
22
+ glchat_plugin-0.2.1.dist-info/RECORD,,