behive 0.3.2__tar.gz → 0.3.3__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.
- {behive-0.3.2/src/behive.egg-info → behive-0.3.3}/PKG-INFO +2 -2
- {behive-0.3.2 → behive-0.3.3}/README.md +1 -1
- {behive-0.3.2 → behive-0.3.3}/pyproject.toml +1 -1
- {behive-0.3.2 → behive-0.3.3}/src/behive/cli.py +1 -1
- {behive-0.3.2 → behive-0.3.3}/src/behive/client.py +1 -4
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/db.py +5 -4
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/prescout.py +2 -2
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/process.py +17 -8
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen_fact_mem.py +5 -4
- {behive-0.3.2 → behive-0.3.3}/src/behive/knowledge_graph.py +5 -3
- {behive-0.3.2 → behive-0.3.3}/src/behive/server.py +2 -2
- {behive-0.3.2 → behive-0.3.3/src/behive.egg-info}/PKG-INFO +2 -2
- {behive-0.3.2 → behive-0.3.3}/tests/test_server_integration.py +1 -1
- {behive-0.3.2 → behive-0.3.3}/LICENSE +0 -0
- {behive-0.3.2 → behive-0.3.3}/setup.cfg +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/__init__.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/compat/__init__.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/compat/shims.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/config.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/__init__.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/__main__.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/api_scout.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/bedrock_compat.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/bionic_quorum.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/constants.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/db_helpers.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/domain_reputation.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/drones.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/events.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/guardrail.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/harvest.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/hive_api_sources.json +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/llm.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/orchestrator.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/preprocessor.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/quality.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen_calibrator.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen_memory.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen_planner_extracted.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/queen_primer.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/runner.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/scout.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/search_backends.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/engine/synth.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/init-db.sql +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/mcp_server.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive/models.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive.egg-info/SOURCES.txt +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive.egg-info/dependency_links.txt +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive.egg-info/entry_points.txt +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive.egg-info/requires.txt +0 -0
- {behive-0.3.2 → behive-0.3.3}/src/behive.egg-info/top_level.txt +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_db_integration.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_e2e_pipeline.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_llm.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_regression.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_search_backends.py +0 -0
- {behive-0.3.2 → behive-0.3.3}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: behive
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Research engine that builds structured knowledge graphs from any topic
|
|
5
5
|
Author-email: QA10 <hello@qa10.io>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -254,7 +254,7 @@ behive serve
|
|
|
254
254
|
**Step 3:** Restart Claude Desktop. Done. Now ask:
|
|
255
255
|
> "Research the EU AI Act enforcement timeline and penalties"
|
|
256
256
|
|
|
257
|
-
Claude will call BeHive automatically,
|
|
257
|
+
Claude will call BeHive automatically, search across multiple sources, and return scored claims instead of guessing from training data.
|
|
258
258
|
|
|
259
259
|
<details>
|
|
260
260
|
<summary><strong>What happens under the hood</strong></summary>
|
|
@@ -191,7 +191,7 @@ behive serve
|
|
|
191
191
|
**Step 3:** Restart Claude Desktop. Done. Now ask:
|
|
192
192
|
> "Research the EU AI Act enforcement timeline and penalties"
|
|
193
193
|
|
|
194
|
-
Claude will call BeHive automatically,
|
|
194
|
+
Claude will call BeHive automatically, search across multiple sources, and return scored claims instead of guessing from training data.
|
|
195
195
|
|
|
196
196
|
<details>
|
|
197
197
|
<summary><strong>What happens under the hood</strong></summary>
|
|
@@ -10,7 +10,7 @@ behive = ["init-db.sql", "engine/hive_api_sources.json"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "behive"
|
|
13
|
-
version = "0.3.
|
|
13
|
+
version = "0.3.3"
|
|
14
14
|
description = "Research engine that builds structured knowledge graphs from any topic"
|
|
15
15
|
readme = "README.md"
|
|
16
16
|
license = "MIT"
|
|
@@ -154,7 +154,7 @@ def cmd_serve(args):
|
|
|
154
154
|
|
|
155
155
|
print(f"""
|
|
156
156
|
\033[33m ╔══════════════════════════════════════╗
|
|
157
|
-
║ 🐝 BeHive Research Engine v0.3.
|
|
157
|
+
║ 🐝 BeHive Research Engine v0.3.3 ║
|
|
158
158
|
╚══════════════════════════════════════╝\033[0m
|
|
159
159
|
|
|
160
160
|
API: http://{args.host}:{args.port}
|
|
@@ -30,10 +30,7 @@ class BeHiveClient:
|
|
|
30
30
|
):
|
|
31
31
|
self.api_url = api_url or os.environ.get("BEHIVE_API_URL")
|
|
32
32
|
self.api_key = api_key or os.environ.get("BEHIVE_API_KEY")
|
|
33
|
-
self.db_url = db_url or os.environ.get(
|
|
34
|
-
"BEHIVE_DB_URL",
|
|
35
|
-
"postgresql://behive_user:REDACTED@localhost:5432/hive"
|
|
36
|
-
)
|
|
33
|
+
self.db_url = db_url or os.environ.get("BEHIVE_DB_URL")
|
|
37
34
|
self._backend = self._detect_backend()
|
|
38
35
|
|
|
39
36
|
def _detect_backend(self) -> str:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
3
|
-
Replaces DuckDB for all read/write operations.
|
|
2
|
+
behive.engine.db — PostgreSQL connection layer for HIVE pipeline.
|
|
4
3
|
|
|
5
|
-
Connection
|
|
4
|
+
Connection configured via environment variables:
|
|
5
|
+
BEHIVE_DB_URL=postgresql://user:pass@host:5432/dbname
|
|
6
|
+
or individual HIVE_PG_USER, HIVE_PG_PASSWORD, HIVE_PG_DATABASE, HIVE_PG_HOST, HIVE_PG_PORT
|
|
6
7
|
|
|
7
8
|
Usage:
|
|
8
9
|
from hive2_pg import get_pg_connection, get_pg_pool
|
|
@@ -24,7 +25,7 @@ import logging
|
|
|
24
25
|
log = logging.getLogger(__name__)
|
|
25
26
|
# Module-level constants for compat with legacy hive2_db imports
|
|
26
27
|
DB_BACKEND = "postgres"
|
|
27
|
-
DB_PATH = os.environ.get("BEHIVE_DB_URL", "
|
|
28
|
+
DB_PATH = os.environ.get("BEHIVE_DB_URL", "")
|
|
28
29
|
import psycopg2.pool
|
|
29
30
|
import json
|
|
30
31
|
import threading
|
|
@@ -475,7 +475,7 @@ def _ensure_prescout_schema(con: Any) -> None:
|
|
|
475
475
|
last_modified VARCHAR,
|
|
476
476
|
robots_tag VARCHAR,
|
|
477
477
|
head_latency_ms INTEGER,
|
|
478
|
-
snippet_density DOUBLE,
|
|
478
|
+
snippet_density DOUBLE PRECISION,
|
|
479
479
|
resource_type VARCHAR,
|
|
480
480
|
routing_decision VARCHAR,
|
|
481
481
|
flags JSON,
|
|
@@ -497,7 +497,7 @@ def _ensure_prescout_schema(con: Any) -> None:
|
|
|
497
497
|
content_preview TEXT,
|
|
498
498
|
extraction_method VARCHAR,
|
|
499
499
|
estimated_harvest_s FLOAT,
|
|
500
|
-
extraction_confidence DOUBLE,
|
|
500
|
+
extraction_confidence DOUBLE PRECISION,
|
|
501
501
|
routing_final VARCHAR,
|
|
502
502
|
priority INTEGER DEFAULT 5,
|
|
503
503
|
verified_at TIMESTAMP DEFAULT NOW(),
|
|
@@ -129,9 +129,18 @@ DB_PATH = ""
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
def _db_connect_retry(path: str = DB_PATH, read_only: bool = False, max_retries: int = 5):
|
|
132
|
-
"""Connect to database with retry
|
|
132
|
+
"""Connect to database with retry and exponential backoff."""
|
|
133
|
+
import time as _t
|
|
133
134
|
if _pg_available:
|
|
134
|
-
|
|
135
|
+
for attempt in range(max_retries):
|
|
136
|
+
try:
|
|
137
|
+
return hive2_db.connect(path, read_only=read_only)
|
|
138
|
+
except Exception as e:
|
|
139
|
+
if attempt == max_retries - 1:
|
|
140
|
+
raise
|
|
141
|
+
wait = min(2 ** attempt, 10)
|
|
142
|
+
log.warning(f"PG connect retry {attempt+1}/{max_retries}: {e}, waiting {wait}s")
|
|
143
|
+
_t.sleep(wait)
|
|
135
144
|
import time as _t
|
|
136
145
|
for attempt in range(max_retries):
|
|
137
146
|
try:
|
|
@@ -147,15 +156,15 @@ def _db_connect_retry(path: str = DB_PATH, read_only: bool = False, max_retries:
|
|
|
147
156
|
return _hive_db.connect(read_only=read_only)
|
|
148
157
|
|
|
149
158
|
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
# LLM model selection — resolved at runtime via llm.py BYOK layer
|
|
160
|
+
# These are only used as fallback identifiers if _byok_complete is unavailable
|
|
161
|
+
MODEL_FAST_PRIMARY = os.environ.get("BEHIVE_MODEL", "") # Auto-detected from API keys
|
|
162
|
+
MODEL_FAST_FALLBACK = MODEL_FAST_PRIMARY
|
|
163
|
+
MODEL_DEEP = MODEL_FAST_PRIMARY
|
|
155
164
|
|
|
156
165
|
# Concurrency limits
|
|
157
166
|
BATCH_SIZE = 20 # docs processed concurrently
|
|
158
|
-
|
|
167
|
+
MAX_LLM_CALLS = 4 # global semaphore cap
|
|
159
168
|
|
|
160
169
|
# Dedup threshold (rapidfuzz)
|
|
161
170
|
DEDUP_THRESHOLD = 85
|
|
@@ -66,10 +66,11 @@ import hive2_db as _hive_db # PostgreSQL via unified layer
|
|
|
66
66
|
log = logging.getLogger(__name__)
|
|
67
67
|
|
|
68
68
|
DUCKDB_PATH = os.environ.get("BEHIVE_LEGACY_DB", "") # Legacy — PostgreSQL is primary
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
# Optional Bedrock-specific settings (only used for embeddings fallback when boto3 available)
|
|
71
|
+
BEDROCK_REGION = os.environ.get("AWS_DEFAULT_REGION", os.environ.get("BEHIVE_BEDROCK_REGION", "us-east-1"))
|
|
72
|
+
EMBED_MODEL_ID = os.environ.get("BEHIVE_EMBED_MODEL", "amazon.titan-embed-text-v2:0")
|
|
71
73
|
EMBED_DIMS = 512
|
|
72
|
-
HAIKU_MODEL_ID = "eu.anthropic.claude-haiku-4-5-20251001-v1:0"
|
|
73
74
|
|
|
74
75
|
# Wzorzec z mem0/configs/prompts.py linia 468 — ADDITIVE_EXTRACTION_PROMPT
|
|
75
76
|
# Modified for HIVE: extracts facts from synthesis/intelligence reports
|
|
@@ -179,7 +180,7 @@ def _haiku(prompt: str, max_tokens: int = 600) -> Optional[str]:
|
|
|
179
180
|
"messages": [{"role": "user", "content": prompt}],
|
|
180
181
|
})
|
|
181
182
|
try:
|
|
182
|
-
resp = bc.invoke_model(modelId=
|
|
183
|
+
resp = bc.invoke_model(modelId=os.environ.get("BEHIVE_BEDROCK_MODEL", "us.anthropic.claude-haiku-4-5-20251001-v1:0"), body=body)
|
|
183
184
|
return json.loads(resp["body"].read())["content"][0]["text"].strip()
|
|
184
185
|
except Exception as exc:
|
|
185
186
|
log.warning("Bedrock Haiku fallback failed: %s", exc)
|
|
@@ -244,9 +244,11 @@ def ingest_entities_from_claims(mission_id: str, claims: list[dict] | None = Non
|
|
|
244
244
|
try:
|
|
245
245
|
import psycopg2
|
|
246
246
|
conn = psycopg2.connect(
|
|
247
|
-
dbname="
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
dbname=os.environ.get("HIVE_PG_DATABASE", os.environ.get("PGDATABASE", "hive")),
|
|
248
|
+
user=os.environ.get("HIVE_PG_USER", os.environ.get("PGUSER", "behive")),
|
|
249
|
+
password=os.environ.get("HIVE_PG_PASSWORD", os.environ.get("PGPASSWORD", "")),
|
|
250
|
+
host=os.environ.get("HIVE_PG_HOST", os.environ.get("PGHOST", "127.0.0.1")),
|
|
251
|
+
port=int(os.environ.get("HIVE_PG_PORT", os.environ.get("PGPORT", "5432")))
|
|
250
252
|
)
|
|
251
253
|
cur = conn.cursor()
|
|
252
254
|
cur.execute(
|
|
@@ -96,7 +96,7 @@ async def lifespan(app: FastAPI):
|
|
|
96
96
|
app = FastAPI(
|
|
97
97
|
title="BeHive Research Engine",
|
|
98
98
|
description="Deep research with structured knowledge extraction",
|
|
99
|
-
version="0.3.
|
|
99
|
+
version="0.3.3",
|
|
100
100
|
lifespan=lifespan,
|
|
101
101
|
)
|
|
102
102
|
|
|
@@ -164,7 +164,7 @@ class ResearchRequest(BaseModel):
|
|
|
164
164
|
|
|
165
165
|
class HealthResponse(BaseModel):
|
|
166
166
|
status: str = "ok"
|
|
167
|
-
version: str = "0.3.
|
|
167
|
+
version: str = "0.3.3"
|
|
168
168
|
missions_total: int = 0
|
|
169
169
|
claims_total: int = 0
|
|
170
170
|
avg_quality: float = 0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: behive
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Research engine that builds structured knowledge graphs from any topic
|
|
5
5
|
Author-email: QA10 <hello@qa10.io>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -254,7 +254,7 @@ behive serve
|
|
|
254
254
|
**Step 3:** Restart Claude Desktop. Done. Now ask:
|
|
255
255
|
> "Research the EU AI Act enforcement timeline and penalties"
|
|
256
256
|
|
|
257
|
-
Claude will call BeHive automatically,
|
|
257
|
+
Claude will call BeHive automatically, search across multiple sources, and return scored claims instead of guessing from training data.
|
|
258
258
|
|
|
259
259
|
<details>
|
|
260
260
|
<summary><strong>What happens under the hood</strong></summary>
|
|
@@ -41,7 +41,7 @@ class TestHealthEndpoint:
|
|
|
41
41
|
def test_health_has_version(self, behive_server_url):
|
|
42
42
|
data = requests.get(f"{behive_server_url}/health").json()
|
|
43
43
|
assert "version" in data
|
|
44
|
-
assert data["version"] == "0.3.
|
|
44
|
+
assert data["version"] == "0.3.3"
|
|
45
45
|
|
|
46
46
|
def test_health_has_metrics(self, behive_server_url):
|
|
47
47
|
data = requests.get(f"{behive_server_url}/health").json()
|
|
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
|
|
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
|