beekeeper-core 1.0.5__py3-none-any.whl → 1.0.7__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,4 @@
1
+ from beekeeper.core.guardrails.base import BaseGuardrail
2
+ from beekeeper.core.guardrails.types import GuardrailResponse
3
+
4
+ __all__ = ["BaseGuardrail", "GuardrailResponse"]
@@ -0,0 +1,15 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ from beekeeper.core.guardrails.types import GuardrailResponse
4
+
5
+
6
+ class BaseGuardrail(ABC):
7
+ """Abstract base class defining the interface for LLMs."""
8
+
9
+ @classmethod
10
+ def class_name(cls) -> str:
11
+ return "BaseGuardrail"
12
+
13
+ @abstractmethod
14
+ def enforce(self, text: str, direction: str) -> GuardrailResponse:
15
+ """Runs policies enforcement to specified guardrail."""
@@ -0,0 +1,11 @@
1
+ from typing import Any, Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class GuardrailResponse(BaseModel):
7
+ """Guardrail response."""
8
+
9
+ text: str = Field(..., description="Generated text response")
10
+ action: Optional[str] = Field(default=None, description="Action taken by the guardrail")
11
+ raw: Optional[Any] = Field(default=None)
@@ -5,7 +5,7 @@ from logging import getLogger
5
5
  from typing import Callable
6
6
 
7
7
  from beekeeper.core.llms.types import ChatMessage
8
- from beekeeper.core.observers.types import PayloadRecord
8
+ from beekeeper.core.monitors.types import PayloadRecord
9
9
 
10
10
  logger = getLogger(__name__)
11
11
 
@@ -22,6 +22,18 @@ class PromptTemplate(BaseModel):
22
22
  def __init__(self, template: str):
23
23
  super().__init__(template=template)
24
24
 
25
+ @classmethod
26
+ def from_value(cls, value: str) -> "PromptTemplate":
27
+ if isinstance(value, cls):
28
+ return value
29
+
30
+ if isinstance(value, str):
31
+ return cls(value)
32
+
33
+ raise TypeError(
34
+ f"Invalid type for parameter 'prompt_template'. Expected str or PromptTemplate, but received {type(value).__name__}."
35
+ )
36
+
25
37
  def format(self, **kwargs):
26
38
  """
27
39
  Formats the template using the provided dynamic variables.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beekeeper-core
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: Load any data in one line of code and connect with AI applications
5
5
  Project-URL: Repository, https://github.com/beekeeper-ai/beekeeper
6
6
  Author-email: Leonardo Furnielis <leonardofurnielis@outlook.com>
@@ -8,9 +8,12 @@ beekeeper/core/evaluation/__init__.py,sha256=FyZGpbTXcIM3BynssiS6wUm2KZkMnLVmKF5
8
8
  beekeeper/core/evaluation/context_similarity.py,sha256=kT1J3HUgF51HHQA5Sew9ahbSV_jhgbCBMRYqPLKlljQ,2690
9
9
  beekeeper/core/flows/__init__.py,sha256=v6VLJ309l5bHYcG1JLUu6_kRoOwIZazonH4-n_UQzYQ,91
10
10
  beekeeper/core/flows/ingestion_flow.py,sha256=lfZM6lHF9rBTviimSlptHm_1htaA5qLLhE-Sm_7fwGY,6110
11
+ beekeeper/core/guardrails/__init__.py,sha256=onznwYWAyOaxOVeYZle7oDtj3QJODQvJHcf5td_laZg,169
12
+ beekeeper/core/guardrails/base.py,sha256=T-Ywr80iTL0EFYarCymFEEI3QkMsrw27JVh_0407sEU,427
13
+ beekeeper/core/guardrails/types.py,sha256=pAJz5tjp5EQ4GdWLPuCxc-aD16BpHwP5JKm1b90thUY,345
11
14
  beekeeper/core/llms/__init__.py,sha256=PN-5Y_Km_l2vO8v9d7iJ6_5xPCZJBh8UzwqRvQZlmTo,250
12
15
  beekeeper/core/llms/base.py,sha256=cMllU_pJeNQGnSXX8WfHc09nrlLLx7cSKtRk9e_ubSg,1174
13
- beekeeper/core/llms/decorators.py,sha256=lPfrQPFiCLAp468mVsiX6DIxSIvmrHjz3urnV9-q54U,3284
16
+ beekeeper/core/llms/decorators.py,sha256=4Cgl4IORYvJBGuxRnwc3L_nIIjNqO1ADIVVo1vbfVHU,3283
14
17
  beekeeper/core/llms/types.py,sha256=CqLsB78y6-y8actABp87nHQh3AhHcE5i4IjeUxaXyA4,722
15
18
  beekeeper/core/monitors/__init__.py,sha256=TvoiIUJtWRO_4zqCICsFaGl_v4Tpvft1M542Bi13pOI,112
16
19
  beekeeper/core/monitors/base.py,sha256=3ooSfgVpWoRLe2TqizHMRK_bI5C-sla57aYJ47FmIXM,980
@@ -19,7 +22,7 @@ beekeeper/core/observers/__init__.py,sha256=Z5sDAajai4QLdGIrjq-vr5eJEBhriMMCw5u4
19
22
  beekeeper/core/observers/base.py,sha256=y1SE_0WQusKhVomFuZCkk42Jb7r93ZS6r_j8vs_Y_r4,1203
20
23
  beekeeper/core/observers/types.py,sha256=s-4tB8OdeaCUIRvi6FLuib2u4Yl9evqQdCundNREXQY,217
21
24
  beekeeper/core/prompts/__init__.py,sha256=kFp2N5giNEMA4hc3eZqstqaZu0c0BRAnP0NuF5aUaqI,85
22
- beekeeper/core/prompts/base.py,sha256=cuRSv30aromymNO2wuuprrrWFm5PxRTymYoVqscK4Us,739
25
+ beekeeper/core/prompts/base.py,sha256=Edh77DuYm8lDhJvHazC5hgaiQEit-R4M-TWLX8-gIU0,1106
23
26
  beekeeper/core/prompts/utils.py,sha256=Cqpefzzxd6DxPbOKVyUCsIs-ibBGKhYU6ppYqhPT9vM,1378
24
27
  beekeeper/core/readers/__init__.py,sha256=vPCmWmK92LYL-R0LFcPqjOKFHqxW0xUP5r6M9GNxoqY,157
25
28
  beekeeper/core/readers/base.py,sha256=46VRNkCmKP2RWJT1-kRTSHG9SjY1xbhKUy1a7-OrgPg,418
@@ -35,6 +38,6 @@ beekeeper/core/tools/base.py,sha256=A6TXn7g3DAZMREYAobfVlyOBuJn_8mIeCByc5412L9Y,
35
38
  beekeeper/core/utils/pairwise.py,sha256=cpi8GItPFSYP4sjB5zgTFHi6JfBVWsMnNu8koA9VYQU,536
36
39
  beekeeper/core/vector_stores/__init__.py,sha256=R5SRG3YpOZqRwIfBLB8KVV6FALWqhIzIhCjRGj-bwPc,93
37
40
  beekeeper/core/vector_stores/base.py,sha256=YFW1ioZbFEcJovAh0ZCpHnj0eiXtZvqy_pj2lxPS92k,1652
38
- beekeeper_core-1.0.5.dist-info/METADATA,sha256=pqrWdjzADRBoDT7isFqwT61vxWetsG_-DHDEIv5cOcU,1331
39
- beekeeper_core-1.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
40
- beekeeper_core-1.0.5.dist-info/RECORD,,
41
+ beekeeper_core-1.0.7.dist-info/METADATA,sha256=sM7H64t1_nZxfW7_WyvOZb_JkQ26twMLEZQ8Cnu8zt0,1331
42
+ beekeeper_core-1.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ beekeeper_core-1.0.7.dist-info/RECORD,,