Skip to content

K-Dense-AI/scientific-agent-skills / skills/open-notebook

open-notebook

Verified

Organizes research with the self-hosted Open Notebook alternative to NotebookLM. Supports source ingestion (PDFs, web pages, audio, video, and Office documents), cited document chat, text and vector search, notes, custom transformations, and multi-speaker podcasts. Use when automating Open Notebook through its REST API or configuring its local or cloud AI providers, including OpenAI, Anthropic, Google, Ollama, Groq, and Mistral.

scripts/_common.py

View on GitHub
"""Small requests client shared by the Open Notebook examples (v1.14.0)."""

import os
from urllib.parse import quote

import requests


def api_url():
    """Accept the backend origin or an origin already ending in /api."""
    base = os.getenv("OPEN_NOTEBOOK_URL", "http://localhost:5055").rstrip("/")
    return base if base.endswith("/api") else base + "/api"


def record_path(record_id):
    """Encode a server-returned record ID as one URL path segment."""
    return quote(str(record_id), safe="")


def request(method, path, **kwargs):
    """Send an authenticated request; fail before decoding a non-success response."""
    headers = dict(kwargs.pop("headers", {}))
    password = os.getenv("OPEN_NOTEBOOK_PASSWORD")
    if password:
        headers["Authorization"] = f"Bearer {password}"
    kwargs.setdefault("timeout", (10, 300))
    # A redirect is not expected for these exact routes. Do not forward a secret
    # or a mutation body to a different path/deployment implicitly.
    response = requests.request(
        method, api_url() + path, headers=headers, allow_redirects=False, **kwargs
    )
    try:
        response.raise_for_status()
    except requests.HTTPError:
        response.close()
        raise
    if 300 <= response.status_code < 400:
        response.close()
        raise requests.HTTPError("Unexpected Open Notebook redirect", response=response)
    return response


def request_json(method, path, **kwargs):
    with request(method, path, **kwargs) as response:
        return response.json()
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall