caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
Builds PaperTrail from the base skeleton into a full evidence-verification platform
for the "Built with Claude: Life Sciences" hackathon (Builder Track).

New named-user features (Build Beyond the Bench):
- Lab Notebook Companion — rough bench notes -> structured, searchable, grounded
  experiment records (lib/labNotebook, /console/lab-notebook, migration 0059)
- Clinical Trial Matcher — de-identified patient notes -> ranked eligible
  ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning
  (lib/trialMatcher, /console/trial-matcher, migrations 0060)

Platform:
- Deterministic verification moat (biostats recompute, exact-span grounding)
- 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar,
  PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier)
- Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise
  governance (RBAC, /api/v1 gateway, metering, audit chain, retention)
- 17 OSS projects assimilated into native TypeScript on our stack (backend/engines
  retained + credited in NOTICE)
- Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site
- Next.js 16 upgrade, benchmark harness (honest smoke-test caveat)

Licensing: Apache-2.0 (LICENSE + NOTICE).
2026-07-10 16:23:13 +03:00

54 lines
1.6 KiB
Python

import time
import openai
from openai import OpenAI
from .base import BaseClient
class LocalOpenAIClient(BaseClient):
"""Support Local host LLM chatbot with OpenAI API.
see https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md for example usage.
"""
def __init__(
self,
model: str = "",
api_config: dict = None,
max_requests_per_minute=200,
request_window=60,
):
super().__init__(model, api_config, max_requests_per_minute, request_window)
openai.api_key = api_config["LOCAL_API_KEY"]
openai.base_url = api_config["LOCAL_API_URL"]
def _call(self, messages: str, **kwargs):
seed = kwargs.get("seed", 42) # default seed is 42
assert type(seed) is int, "Seed must be an integer."
response = openai.chat.completions.create(
response_format={"type": "json_object"},
seed=seed,
model=self.model,
messages=messages,
)
r = response.choices[0].message.content
return r
def get_request_length(self, messages):
# TODO: check if we should return the len(menages) instead
return 1
def construct_message_list(
self,
prompt_list: list[str],
system_role: str = "You are a helpful assistant designed to output JSON.",
):
messages_list = list()
for prompt in prompt_list:
messages = [
{"role": "system", "content": system_role},
{"role": "user", "content": prompt},
]
messages_list.append(messages)
return messages_list