beekeeper-core 1.0.7__tar.gz → 1.0.9__tar.gz
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.
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/PKG-INFO +6 -6
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/guardrails/types.py +3 -1
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/llms/decorators.py +79 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/pyproject.toml +6 -6
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/.gitignore +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/README.md +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/document/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/document/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/embeddings/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/embeddings/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/evaluation/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/evaluation/context_similarity.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/flows/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/flows/ingestion_flow.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/guardrails/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/guardrails/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/llms/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/llms/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/llms/types.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/monitors/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/monitors/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/monitors/types.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/observers/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/observers/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/observers/types.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/prompts/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/prompts/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/prompts/utils.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/readers/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/readers/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/readers/directory.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/schema.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/semantic.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/sentence.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/token.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/text_chunkers/utils.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/tools/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/tools/base.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/utils/pairwise.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/vector_stores/__init__.py +0 -0
- {beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/vector_stores/base.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: beekeeper-core
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.9
|
|
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>
|
|
@@ -9,14 +9,14 @@ Keywords: AI,LLM,QA,RAG,data,observability,retrieval,semantic-search
|
|
|
9
9
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
10
10
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
11
11
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
-
Requires-Python: <4.0,>=3.
|
|
13
|
-
Requires-Dist: deprecated<2.0.0,>=1.
|
|
12
|
+
Requires-Python: <4.0,>=3.11
|
|
13
|
+
Requires-Dist: deprecated<2.0.0,>=1.3.1
|
|
14
14
|
Requires-Dist: nltk<4.0.0,>=3.9.2
|
|
15
15
|
Requires-Dist: numpy<1.27.0,>=1.26.4
|
|
16
|
-
Requires-Dist: pydantic<3.0.0,>=2.
|
|
17
|
-
Requires-Dist: tiktoken<0.
|
|
16
|
+
Requires-Dist: pydantic<3.0.0,>=2.12.5
|
|
17
|
+
Requires-Dist: tiktoken<0.13.0,>=0.12.0
|
|
18
18
|
Provides-Extra: dev
|
|
19
|
-
Requires-Dist: ruff>=0.
|
|
19
|
+
Requires-Dist: ruff>=0.14.9; extra == 'dev'
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
22
22
|
# Beekeeper Core
|
|
@@ -7,5 +7,7 @@ class GuardrailResponse(BaseModel):
|
|
|
7
7
|
"""Guardrail response."""
|
|
8
8
|
|
|
9
9
|
text: str = Field(..., description="Generated text response")
|
|
10
|
-
action: Optional[str] = Field(
|
|
10
|
+
action: Optional[str] = Field(
|
|
11
|
+
default=None, description="Action taken by the guardrail"
|
|
12
|
+
)
|
|
11
13
|
raw: Optional[Any] = Field(default=None)
|
|
@@ -6,10 +6,16 @@ from typing import Callable
|
|
|
6
6
|
|
|
7
7
|
from beekeeper.core.llms.types import ChatMessage
|
|
8
8
|
from beekeeper.core.monitors.types import PayloadRecord
|
|
9
|
+
from deprecated import deprecated
|
|
9
10
|
|
|
10
11
|
logger = getLogger(__name__)
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
@deprecated(
|
|
15
|
+
reason="'llm_chat_observer()' is deprecated and will be removed in a future version. Use 'llm_chat_monitor()'.",
|
|
16
|
+
version="1.0.8",
|
|
17
|
+
action="always",
|
|
18
|
+
)
|
|
13
19
|
def llm_chat_observer() -> Callable:
|
|
14
20
|
"""
|
|
15
21
|
Decorator to wrap a method with llm handler logic.
|
|
@@ -81,3 +87,76 @@ def llm_chat_observer() -> Callable:
|
|
|
81
87
|
return async_wrapper
|
|
82
88
|
|
|
83
89
|
return decorator
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def llm_chat_monitor() -> Callable:
|
|
93
|
+
"""
|
|
94
|
+
Decorator to wrap a method with llm handler logic.
|
|
95
|
+
Looks for observability instances in `self.callback_manager`.
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
def decorator(f: Callable) -> Callable:
|
|
99
|
+
def async_wrapper(self, *args, **kwargs):
|
|
100
|
+
callback_manager_fns = getattr(self, "callback_manager", None)
|
|
101
|
+
|
|
102
|
+
start_time = time.time()
|
|
103
|
+
llm_return_val = f(self, *args, **kwargs)
|
|
104
|
+
response_time = int((time.time() - start_time) * 1000)
|
|
105
|
+
|
|
106
|
+
if callback_manager_fns:
|
|
107
|
+
|
|
108
|
+
def async_callback_thread():
|
|
109
|
+
try:
|
|
110
|
+
# Extract input messages
|
|
111
|
+
if len(args) > 0 and isinstance(args[0], ChatMessage):
|
|
112
|
+
input_chat_messages = args[0]
|
|
113
|
+
elif "messages" in kwargs:
|
|
114
|
+
input_chat_messages = kwargs["messages"]
|
|
115
|
+
else:
|
|
116
|
+
raise ValueError(
|
|
117
|
+
"No messages provided in positional or keyword arguments"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# Get the user's latest message after each interaction to chat observability.
|
|
121
|
+
user_messages = [
|
|
122
|
+
msg for msg in input_chat_messages if msg.role == "user"
|
|
123
|
+
]
|
|
124
|
+
last_user_message = (
|
|
125
|
+
user_messages[-1].content if user_messages else None
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Get the system/instruct (first) message to chat observability.
|
|
129
|
+
system_messages = [
|
|
130
|
+
msg for msg in input_chat_messages if msg.role == "system"
|
|
131
|
+
]
|
|
132
|
+
system_message = (
|
|
133
|
+
system_messages[0].content if system_messages else None
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
callback = callback_manager_fns(
|
|
137
|
+
payload=PayloadRecord(
|
|
138
|
+
input_text=(system_message or "") + last_user_message,
|
|
139
|
+
generated_text=llm_return_val.message.content,
|
|
140
|
+
generated_token_count=llm_return_val.raw["usage"][
|
|
141
|
+
"completion_tokens"
|
|
142
|
+
],
|
|
143
|
+
input_token_count=llm_return_val.raw["usage"][
|
|
144
|
+
"prompt_tokens"
|
|
145
|
+
],
|
|
146
|
+
response_time=response_time,
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
if asyncio.iscoroutine(callback):
|
|
151
|
+
asyncio.run(callback)
|
|
152
|
+
|
|
153
|
+
except Exception as e:
|
|
154
|
+
logger.error(f"Observability callback error: {e}")
|
|
155
|
+
|
|
156
|
+
threading.Thread(target=async_callback_thread).start()
|
|
157
|
+
|
|
158
|
+
return llm_return_val
|
|
159
|
+
|
|
160
|
+
return async_wrapper
|
|
161
|
+
|
|
162
|
+
return decorator
|
|
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "beekeeper-core"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.9"
|
|
8
8
|
description = "Load any data in one line of code and connect with AI applications"
|
|
9
9
|
authors = [{ name = "Leonardo Furnielis", email = "leonardofurnielis@outlook.com" }]
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
11
11
|
readme = "README.md"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.11,<4.0"
|
|
13
13
|
keywords = ["AI", "LLM", "QA", "RAG", "data", "observability", "retrieval", "semantic-search"]
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
@@ -17,16 +17,16 @@ classifiers = [
|
|
|
17
17
|
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
18
18
|
]
|
|
19
19
|
dependencies = [
|
|
20
|
-
"deprecated>=1.
|
|
20
|
+
"deprecated>=1.3.1,<2.0.0",
|
|
21
21
|
"nltk>=3.9.2,<4.0.0",
|
|
22
22
|
"numpy>=1.26.4,<1.27.0",
|
|
23
|
-
"pydantic>=2.
|
|
24
|
-
"tiktoken>=0.
|
|
23
|
+
"pydantic>=2.12.5,<3.0.0",
|
|
24
|
+
"tiktoken>=0.12.0,<0.13.0",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
28
28
|
dev = [
|
|
29
|
-
"ruff>=0.
|
|
29
|
+
"ruff>=0.14.9",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beekeeper_core-1.0.7 → beekeeper_core-1.0.9}/beekeeper/core/evaluation/context_similarity.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|