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).
43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
import time
|
|
from anthropic import Anthropic
|
|
from .base import BaseClient
|
|
|
|
|
|
class ClaudeClient(BaseClient):
|
|
def __init__(
|
|
self,
|
|
model: str = "claude-3-opus-20240229",
|
|
api_config: dict = None,
|
|
max_requests_per_minute=200,
|
|
request_window=60,
|
|
):
|
|
super().__init__(model, api_config, max_requests_per_minute, request_window)
|
|
self.client = Anthropic(api_key=self.api_config["ANTHROPIC_API_KEY"])
|
|
|
|
def _call(self, messages: str, **kwargs):
|
|
response = self.client.messages.create(
|
|
messages=messages,
|
|
model=self.model,
|
|
max_tokens=2048,
|
|
)
|
|
return response.content[0].text
|
|
|
|
def get_request_length(self, messages):
|
|
return 1
|
|
|
|
def construct_message_list(
|
|
self,
|
|
prompt_list: list[str],
|
|
system_role: str = None,
|
|
):
|
|
if system_role is None:
|
|
Warning("system_role is not used in this case")
|
|
# system role is not used in this case
|
|
messages_list = list()
|
|
for prompt in prompt_list:
|
|
messages = [
|
|
{"role": "user", "content": prompt},
|
|
]
|
|
messages_list.append(messages)
|
|
return messages_list
|