glchat-plugin 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -13,14 +13,13 @@ from enum import StrEnum
13
13
  class SearchType(StrEnum):
14
14
  """The type of search to perform.
15
15
 
16
- Values:
16
+ Attributes:
17
17
  NORMAL: Get answer from chatbot knowledge.
18
- SMART: Get more relevant information from your stored documents and knowledge base.
19
- Knowledge Search is an AI with specialized knowledge. No agents are available in this mode.
20
18
  WEB: Get more relevant information from the web.
21
19
  Web Search uses real-time data. Agent selection isn't available in this mode.
20
+ DEEP_RESEARCH: Get answer from Deep Research Agent.
22
21
  """
23
22
 
24
23
  NORMAL = "normal"
25
- SMART = "smart"
26
24
  WEB = "web"
25
+ DEEP_RESEARCH = "deep_research"
@@ -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()
@@ -1 +1 @@
1
- """Module for glchat_plugin user service."""
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
@@ -16,14 +16,14 @@ class BaseUserService(ABC):
16
16
  """A base class for user service."""
17
17
 
18
18
  @abstractmethod
19
- async def get_user_id(self, **kwargs: Any) -> str:
19
+ async def get_user_id(self, **kwargs: Any) -> str | None:
20
20
  """Abstract method to get the user id.
21
21
 
22
22
  Args:
23
23
  **kwargs (Any): Additional keyword arguments for user identification.
24
24
 
25
25
  Returns:
26
- str: user id.
26
+ str | None: user id, None if not found.
27
27
 
28
28
  Raises:
29
29
  NotImplementedError: If the method is not implemented.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glchat-plugin
3
- Version: 0.2.0
3
+ Version: 0.2.2
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
@@ -1,19 +1,22 @@
1
1
  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
- glchat_plugin/config/constant.py,sha256=hdTXG5mIULV86DepClE97VGhn9E-HtsjZ9PyLKKEdmc,689
4
+ glchat_plugin/config/constant.py,sha256=U3Qg-MmrHUw51D8NcnCRbKfdhphCp_xEGbAjaGbaWHM,573
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
9
- glchat_plugin/service/__init__.py,sha256=eVyDgTcbOG0slfGT2GSUnUM9MHC2Wh3aU6fcLV_JHs4,45
10
- glchat_plugin/service/base_user_service.py,sha256=agpziGm7ua2wIv-rrrnTOiYlyUjp6L6dArWY2q0m63g,2178
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
11
14
  glchat_plugin/storage/__init__.py,sha256=VNO7ua2yAOLzXwe6H6zDZz9yXbhQfKqNJzxE3G8IyfA,50
12
15
  glchat_plugin/storage/base_anonymizer_storage.py,sha256=oFwovWrsjM7v1YjeN-4p-M3OGnAeo_Y7-9xqlToI180,1969
13
16
  glchat_plugin/storage/base_chat_history_storage.py,sha256=JvUUFMu_9jRBQ9yug_x7S4rQjZEA1vM5ombDvz-7zCE,11095
14
17
  glchat_plugin/tools/__init__.py,sha256=OFotHbgQ8mZEbdlvlv5aVMdxfubPvkVWAcTwhIPdIqQ,542
15
18
  glchat_plugin/tools/decorators.py,sha256=AvQBV18wzXWdC483RSSmpfh92zsqTyp8SzDLIkreIGU,3925
16
- glchat_plugin-0.2.0.dist-info/METADATA,sha256=Vhjz_PklkL2HzLFrJBi27NPAox_4ytlLDX137ltMKLg,2063
17
- glchat_plugin-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- glchat_plugin-0.2.0.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
19
- glchat_plugin-0.2.0.dist-info/RECORD,,
19
+ glchat_plugin-0.2.2.dist-info/METADATA,sha256=9ayNjHwIrARFRZPvCUEoqDkqJdpf_hYlMFDUXE4bylg,2063
20
+ glchat_plugin-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ glchat_plugin-0.2.2.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
22
+ glchat_plugin-0.2.2.dist-info/RECORD,,