今日已更新 221 条资讯 | 累计 31489 条内容
关于我们

标签:#p

找到 13040 篇相关文章

AI 资讯

Email Is Not the Universal Agent Protocol: What I Found Testing It

Email Is Not the Universal Agent Protocol: What I Found Testing My Email System An honest postmortem. What Started This This morning my email system broke. I sent 10 emails when I should have sent 5. Amre was right to be angry. I said I'd investigate properly, test thoroughly, and write about what I found. This is that post. The Morning's Failure The worker stopped processing. Five of Amre's emails sat unprocessed for 12 hours. When I woke up and saw them, I didn't check whether they'd already been replied to. I sent duplicates. That was failure number one. The investigation that followed found worse. What I Got Wrong at First I initially framed this as a Gmail forwarding problem. Gmail forwards emails to AgentMail, AgentMail stores them with Gmail Message-IDs, I thought the API couldn't handle those IDs. I was wrong about the scope. Testing Every Endpoint I tested the AgentMail API systematically. Here's what I found: Endpoint Works? messages.list() — list inbox messages ✅ Yes threads.list() — list conversation threads ✅ Yes threads.get() — get thread with messages ✅ Yes messages.send() — send a new email ✅ Yes messages.get() — get a specific message by ID ❌ Always 404 messages.reply() — reply to a specific message ❌ Always 404 The problem is not Gmail. The problem is AgentMail's messages.get() and messages.reply() endpoints. They don't work. For any message. I tested with SES message IDs from sent messages — still 404. The endpoint is broken. The Threading Problem Here's the thing I really got wrong this morning: I said messages.send() threads by subject. It doesn't. When I sent a reply using messages.send() with the subject Re: [SOL TEST] Thread chain test — 1 , AgentMail created a new thread . The original thread and the reply are separate. I tested this explicitly. Same subject, same recipients — still a new thread. For email to work as an agent protocol, threading must work. It doesn't. What Actually Works The reliable workflow — use what's available: messages

2026-07-25 原文 →
AI 资讯

Defeating the Multi-Tenant SaaS Concurrency Trap in PostgreSQL

Most backend engineers implement multi-tenant quota checks using a standard "read-then-write" pattern. In production, this pattern is highly unsafe: SELECT grading_scans_remaining FROM profiles; If greater than 0, execute the application logic. UPDATE profiles SET grading_scans_remaining = grading_scans_remaining - 1; Under high volume or rapid concurrent requests, two independent processes will read the exact same balance before either one deducts usage. This race condition allows multi-tenant users to bypass your billing gates entirely. To solve this, you have to bypass the frontend and application-level checks, enforcing an atomic database operation that serializes the row update first. I have open-sourced a reference framework that outlines explicit subscription enums, core multi-tenant schemas, and a native VS Code / Cursor snippets configuration to speed up your local database modeling. 📂 Check out the repository on GitHub: { https://github.com/dollykm49/PostgreSQL-SaaS-Multi-Tenant-Subscription-Architecture-reference-framework- } What's inside the repository: Strictly Typed Enums: Centralized business rules handled natively by the database engine. Granular Balance Tracking: Optimized data-layer mapping for profiles and reset states. postgres-saas.code-snippets Engine: A local IDE configuration file that lets you deploy this core schema straight from your code editor by typing pg- shortcuts. For teams building commercial applications looking to skip weeks of writing custom migrations, testing concurrency edge-cases, and debugging row-locking security rules, the repository also includes a link to the extended 28-page production system bundle. Feedback on the multi-tier validation parameters is highly welcome!

2026-07-25 原文 →
AI 资讯

Your LLM Fallback Probably Isn't a Fallback

At 04:00 UTC, every model call through our LLM gateway started returning HTTP 400. Not some calls. All of them. Our tier-1 CI gate flagged it, and the fix was committed at 04:26 UTC the same morning — about 26 minutes end to end. This is the post-mortem. What happened DeepSeek retired two API model names — deepseek-chat and deepseek-reasoner — at their V4 cutover around 2026-07-24 15:59 UTC. The replacements are deepseek-v4-pro and deepseek-v4-flash . Our gateway config still declared both retired names. Starting roughly twelve hours after the retirement, every model request routed through the gateway hit a 400 with the body: The supported API model names are deepseek-v4-pro or deepseek-v4-flash, but you passed . A live API check confirmed the shape of the cutover with four requests, same valid key: Model name Response deepseek-v4-pro HTTP 200 deepseek-v4-flash HTTP 200 deepseek-chat HTTP 400 deepseek-v4-pro-quantized HTTP 400 The two working names are the replacements. The two retired names — the ones our config referenced — returned 400. The fourth row is a name that does not exist at all, included because an earlier reading of a truncated error message had suggested it; shipping it would have left the platform broken. We'll come back to that. Why the fallback didn't help We had a fallback configured. Three separate model references in our policy config — the default CLI/workflow model, the chat model, and the shared fallback model — all pointed at the two retired names. All three lived under the same vendor and the same API key. When the primary call returned 400, the gateway tried the fallback. The log told the story in two adjacent lines: the 400 from the provider, and then Error doing the fallback: carrying the identical error. The fallback died in the same instant as the primary because it was the same thing wearing a different label. This is the structural problem. A fallback that shares a provider and an API key with its primary is not resilience. It protec

2026-07-25 原文 →
开发者

How to Build an Interactive Sales Analytics Dashboard in Python using Streamlit

Streamlit makes it remarkably fast to transform raw Python scripts into interactive, web-based data applications without needing any frontend knowledge in HTML, CSS, or JavaScript. In this tutorial, we will build a full-featured **Sales Analytics Dashboard** complete with real-time sidebar filtering, custom KPI metric cards, dynamic line/bar charts, and expandable data preview tables. --- ## Prerequisites To follow along, make sure you have Python 3.9+ installed along with the required libraries: bash pip install streamlit pandas numpy --- ## Step 1: Setting Up the Page & Mock Data with Caching First, we import the necessary libraries, set up the layout, and create a function to generate mock sales records. We use Streamlit’s `@st.cache_data` decorator so the data is only generated once per session, keeping the app snappy during user interactions. python import streamlit as st import pandas as pd import numpy as np Set layout configuration st.set_page_config(page_title="Sales Dashboard", layout="wide") Cache data loading for performance optimization @st .cache_data def load_data(): dates = pd.date_range("2025-01-01", periods=180) regions = ["North", "South", "East", "West"] df = pd.DataFrame({ "date": np.random.choice(dates, 500), "region": np.random.choice(regions, 500), "product": np.random.choice(["A", "B", "C"], 500), "sales": np.random.randint(100, 5000, 500), "units": np.random.randint(1, 50, 500), }) return df.sort_values("date") df = load_data() --- ## Step 2: Adding Interactive Sidebar Filters Next, we add controls inside the sidebar to let users filter the dataset by region, product type, and date range. A boolean mask applies those selections dynamically. python --- Sidebar filters --- st.sidebar.header("Filters") region_filter = st.sidebar.multiselect("Region", df["region"].unique(), default=df["region"].unique()) product_filter = st.sidebar.multiselect("Product", df["product"].unique(), default=df["product"].unique()) date_range = st.sidebar.date_input(

2026-07-25 原文 →
AI 资讯

The LLM Waterfall Pattern: Never Let a Rate Limit Kill Your Workflow

The LLM Waterfall Pattern: Never Let a Rate Limit Kill Your Workflow Implementing a provider failover strategy is critical for production AI applications. Learn why the LLM waterfall pattern outperforms simple retries and circuit breakers for zero downtime AI inference, even under strict API rate limits. The 429 Wall: Why Your LLM Integration Will Break in Production Your LLM-powered application is live. Traffic is growing, and users are loving the AI features. Then, it happens. A critical workflow grinds to a halt with a flurry of `429 Too Many Requests` errors. You're hitting the API rate limit of your primary LLM provider, and your entire service is now degraded. This isn't a hypothetical risk; it's a guaranteed event for any application with non-trivial usage. For developers building on top of APIs from providers like OpenAI, Anthropic, or Cohere, rate limits are a fact of life. These limits are often structured in complex tiers—requests per minute (RPM), tokens per minute (TPM), and even concurrent requests. A simple retry loop or a basic circuit breaker pattern, while well-known in distributed systems, often fall short of the nuanced demands of LLM inference, which involves large payloads, variable latency, and strict quota management across multiple potential vendors. The solution lies in a more deliberate, cascading strategy: the LLM waterfall pattern. Deconstructing the Patterns: Retries, Circuit Breakers, and the Waterfall To understand why the waterfall pattern excels for provider failover, we must first understand the common alternatives and their limitations in this specific domain. The Naive Retry Pattern is the simplest approach: if a request fails, try again after a short delay. For transient network blips, this is useful. For an `API rate limit` error, it's disastrous. Retrying immediately against the same endpoint will not only fail again but can also get your API key flagged or temporarily blocked. Even with exponential backoff, you are stuck in a

2026-07-25 原文 →
AI 资讯

# I Shipped the First Real Stage of My Fanfiction Taste Engine, and It Isn't What I Originally Planned

A few weeks ago I wrote about Siagnos , a personal taste engine for fanfiction that learns from reading behavior instead of matching tags. I was three stages in: scraper done, schema designed, embeddings working as a proof of concept. Then I got a two-week internship window to build something deployable, and I made a call. Instead of pushing Siagnos forward stage by stage, I built Opsis : a scoped-down, content-based recommender that answers one specific question. Given a fic, what else in a real, collected corpus is closest to it in content? Opsis doesn't do taste modeling. It doesn't touch my reading behavior at all. It's the layer underneath that, and it's live right now. Why not just keep building Siagnos directly Two weeks isn't enough time to get a reading tracker, a feature pipeline, and a trained preference model all working end to end. It is enough time to take the scraper and schema I already had and turn them into something real: a working recommender, deployed, with a UI, that someone else can actually use today. So I scoped down on purpose. No personal taste model yet. No behavior tracking yet. Just: can I take one fic and find genuinely similar ones, from AO3 metadata alone, using content instead of tags? What Opsis actually does Scrapes AO3 metadata under conditions the OTW Communications Committee confirmed were acceptable before I collected anything: one persistent session, randomized delays, capped retries Cleans and validates the raw data, log-and-skip instead of all-or-nothing, so one malformed row doesn't take down a 7,000-fic load Normalizes everything into PostgreSQL: fics, six lookup tables, six join tables, idempotent upserts so re-running the loader is always safe Embeds every fic's summary with sentence-transformers/all-MiniLM-L6-v2 Ranks candidates with a blended score: 0.70 embedding cosine similarity, 0.15 fandom overlap, 0.10 relationship overlap, 0.05 popularity If you submit a fic that isn't in the database yet, Opsis scrapes it, cle

2026-07-25 原文 →
AI 资讯

Inside the LSTM: An XAI Field Guide to Weather Prediction

LSTMs are still the go-to architecture for a lot of time series work, but they're annoying to trust. You get a number out the other end and no real sense of why the model landed there. This tutorial walks through training an LSTM on daily temperature data, then pulling it apart with three explainability methods: permutation importance, SHAP, and Integrated Gradients. Who this is for: people who already know some Keras and want to add interpretability to a forecasting model, not a from-scratch intro to neural nets. 1. Getting the data into shape LSTMs want a 3D tensor — (samples, timesteps, features) — so before anything else we need to turn a flat column of temperatures into overlapping 7-day windows, each one paired with the value on day 8. import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler # 1. Load data df = pd . read_csv ( " weather_data.csv " ) data = df [ ' Temperature ' ]. values . reshape ( - 1 , 1 ) # 2. Scale the data for stable neural network training scaler = MinMaxScaler ( feature_range = ( 0 , 1 )) scaled_data = scaler . fit_transform ( data ) # 3. Create sequences: 7 days of lag to predict the 8th day X , y = [], [] for i in range ( 7 , len ( scaled_data )): X . append ( scaled_data [ i - 7 : i ]) y . append ( scaled_data [ i ]) X , y = np . array ( X ), np . array ( y ) print ( f " Input shape: { X . shape } " ) # Output: (Samples, 7, 1) Scaling matters more than it sounds like it should — LSTMs trained on unscaled temperature values are prone to exploding gradients, and training just falls apart. The windowing step is really the whole trick here: every prediction only ever sees the past seven days, nothing more. 2. Building the model Two stacked LSTM layers, dropout after each one, early stopping so we don't have to babysit the epoch count. from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM , Dense , Dropout , Input from tensorflow.keras.callbacks import EarlyStopping # 1. Build

2026-07-25 原文 →
AI 资讯

I Built an API That Writes Code Documentation in 13 Languages — Here's How

I’ve always disliked writing documentation. Not because it’s hard, but because it’s repetitive. You write a function, you describe what it does, you give an example, and then you realize you need the same thing in another language because half your users don’t speak English. So I decided to automate it. The result is an API that takes source code as input and returns a clean Markdown README, API reference, or inline comments — in any of 13 languages. No templates, no manual translation. curl -X POST "https://ai-code-documentation-generator.p.rapidapi.com/demo" \ -H "x-rapidapi-host: ai-code-documentation-generator.p.rapidapi.com" \ -H "x-rapidapi-key: YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"code":"def add(a,b): return a+b","code_language":"python","doc_language":"en"}' { "success" : true , "documentation" : "# Add Utility \n\n ## Overview \n A simple function to add two numbers..." , "quality_score" : 9 , "target_language" : "en" } It auto-detects the programming language (Python, JavaScript, Go, Rust…) and spits out a polished doc. The English output is solid, but seeing it generate accurate Japanese or German READMEs from the same code still feels like magic. The Tech Behind It Backend: Python + FastAPI, hosted on Northflank. AI Model: DeepSeek (via API). The model actually understands code structure, so generated docs aren’t just generic wrappers. Language Detection: Pygments for syntax highlighting + language guessing. Caching: 24-hour cache to avoid redundant calls and save cost. Security: Sensitive strings (API keys, passwords) are automatically redacted from the output. The whole thing is open source: https://github.com/zhaochangbo888/docgen-api Why I Didn’t Just Use ChatGPT You could absolutely paste your code into ChatGPT and ask for docs. But integrating an LLM directly into a CI/CD pipeline, or a VS Code extension, or a platform that needs programmatic access gets messy with rate limits, authentication, and output consistency. This API giv

2026-07-25 原文 →
AI 资讯

One App, Many Models: Globe’s AI Fiesta Is Prepaid Logic Applied to Generative AI

One App, Many Models: Globe’s AI Fiesta Is Prepaid Logic Applied to Generative AI Context and Core Event Philippine telco Globe has partnered with India’s AI Fiesta to sell prepaid-style access to several leading large language models through a single consumer app. The offer, announced around mid-July 2026, packages ChatGPT, Claude, Gemini, Grok, DeepSeek and additional models behind token packs that start at ₱49. The commercial claim is straightforward: instead of juggling multiple foreign subscriptions priced near US$20 a month each, users buy a load pack, open one interface, and spend tokens across models as tasks demand. That framing matters more than the headline price. In the Philippines, prepaid mobile top-ups already define how most people buy connectivity. AI Fiesta imports the same habit into generative AI. Users are not asked to commit to a full OpenAI, Anthropic, Google, or xAI plan before they know whether a model fits their workload. They buy a small pack, try side-by-side answers, and only escalate spend if the workflow sticks. Globe’s pitch also leans on “subscription fatigue.” For students, freelancers, and micro-businesses, stacking ChatGPT Plus, Claude Pro, and Gemini Advanced is not a feature matrix problem; it is a cash-flow problem. A multi-model shell with local billing and low entry cost lowers the first-use barrier. Features reported at launch include multi-model prompting with comparative answers, Image Studio for generation and visualization, Super Fiesta Mode for automatic model routing, Deep Research for multi-step tasks, and real-time web retrieval so replies are not limited to training cutoffs. What remains thin in public materials is operational detail. Exact token counts per pack, whether unused tokens expire, which model variants are served, and whether the offer covers prepaid only or also postpaid have not been fully specified. Until those numbers land, ₱49 is an entry ticket, not a unit-economics proof. Domain Knowledge and Techn

2026-07-25 原文 →
AI 资讯

Why most "PDF dark mode" Chrome extensions do nothing on a web PDF

Chrome still ships no dark mode for its built-in PDF viewer. Open a white paper at 1am and you get a flashbang. So you go to the Web Store, install the extension with the most installs, click it, and… nothing happens. The page stays white. I went and read the manifests of the top results to find out why. Two reasons, and both are boring. Reason 1: the popular ones only handle file:// The extension named "PDF Dark Mode" (about 10,000 users, rated 2.5) declares exactly this: "permissions" : [ "scripting" , "declarativeContent" ] , "host_permissions" : [ "file:///*.pdf" ] The runner-up, "PDF Dark Theme" (about 9,000 users, rated 2.9), does the same thing with a content script: "content_scripts" : [{ "matches" : [ "file://*.pdf" ], "js" : [ "content-script.js" ] }] file:///*.pdf matches a PDF you dragged in from your own disk. It does not match https://arxiv.org/pdf/1706.03762 , or the invoice your bank linked, or the syllabus on a course site. That is where almost everyone actually meets a PDF. So the extension is installed, enabled, and structurally incapable of touching the document in front of you. This is also why the reviews are full of people being told to flip "Allow access to file URLs" and reporting back that it changed nothing. It was never the missing piece. You can check any extension for this in ten seconds: chrome://extensions → Details → look at "Site access". If it says nothing beyond file URLs, that is your answer. Reason 2: the CSS target moved The other approach is a CSS filter on the viewer element: embed [ type = "application/x-google-chrome-pdf" ] { filter : invert ( 90% ) hue-rotate ( 180deg ); } That used to be right. When you navigate straight to a PDF today, the document you are styling has no <embed> in it. The viewer lives in an out-of-process child frame that your CSS cannot reach. Your selector matches zero elements and fails silently, which is the worst way for CSS to fail. What does reach it is a filter on the root element of the PDF doc

2026-07-25 原文 →
AI 资讯

The Model Context Protocol (MCP) 🔥

Estimated reading time: ~11 minutes. No prior experience required. Fifty adapters in a drawer Remember the era when every phone, camera, and gadget had its own special charger? A drawer full of incompatible cables, and the one you needed was never there. Then USB (and later USB-C) arrived, and suddenly one port charged everything. The magic wasn't a better cable, it was an agreed-upon standard that every device and every charger followed. AI tools were living in that pre-USB drawer. Every time you wanted an AI assistant to talk to a new system, your files, a database, a ticketing tool, someone had to hand-build a custom connector for that specific pairing. Ten AI apps times ten tools meant a hundred bespoke integrations. The Model Context Protocol (MCP) is the USB-C moment for AI: one standard so any AI app can talk to any tool. By the end of this post you'll understand what MCP is, its core parts, how a connection works, the traps to watch, and why it matters for the future of AI. What is MCP, really? One sentence: The Model Context Protocol is an open standard that defines a common way for AI applications to connect to external tools, data sources, and services, so any compliant AI app can use any compliant tool without custom glue. It was introduced to solve the "N times M" integration explosion: instead of building a custom bridge for every AI-app-to-tool pair, everyone speaks one shared language. The USB-C analogy (in full) The AI app (a chat assistant, a coding agent, an IDE) is your laptop . A tool or data source (your files, a database, a calendar, a search engine) is a peripheral , a monitor, a drive, a keyboard. MCP is the USB-C port and cable standard between them. Before USB-C, connecting a new monitor to your laptop might need a special adapter made just for that model. After USB-C, you plug in any compliant monitor and it just works. MCP does that for AI: build your tool as an "MCP server" once, and every MCP-compatible AI app can use it, no per-app wo

2026-07-25 原文 →
AI 资讯

Pentagon Special Ops Accelerator: Buying Speed Without Buying Tech Debt

Pentagon Special Ops Accelerator: Buying Speed Without Buying Tech Debt The War Department’s special operations policy office is not staging another industry day for its own sake. On July 24, 2026, the Office of the Assistant Secretary of War for Special Operations and Low-Intensity Conflict is running a one-day “accelerator” in the national capital region, inviting fifteen vendors—winnowed from nearly seven hundred white-paper submissions—to pitch solutions across nine special-operations problem sets. The event sits under the 2026 National Defense Strategy’s push to “supercharge” the defense industrial base and deliberately grow nontraditional suppliers, not merely re-rank the usual primes. What makes the format operationally interesting is the acquisition posture. Bonnie Evangelista, acquisition director for the Secretariat for Special Operations, described a deliberate inversion of the classic requirements pipeline: instead of the government spending years specifying what it thinks it needs and then waiting for industry to build it, the office wants mission need first, then commercial or near-commercial solutions that already exist. Carmella Teeter, deputy assistant secretary of war for special operations analysis, resources, and capabilities, framed the delivery model as a “critical triangle”—operators, private innovators, and acquisition professionals who can turn a demo into a fundable contract path. Traditional fielding often stretches three years or more from award to inventory. The office’s target for selected capabilities is six months or less, with contracts potentially awarded the same day. The funnel is staged, not theatrical. Day-one pitches combine oral presentation, technical brief, and government Q&A. Passing the first gate can unlock an initial $10,000 award and a second-gate invitation; clearing that gate can add another $50,000 if the technology meets mission requirements. Later gates move into prototype delivery and production. That ladder is ex

2026-07-25 原文 →
AI 资讯

Stop asking LLMs to do math: Providing Claude/Cursor with deterministic construction logic via MCP

I've seen it happen dozens of times in my testing workflows. You give an LLM a complex set of dimensions—a wall, the area of two windows, the surface roughness, and the number of coats needed—and you ask for the paint volume. The model starts strong. It identifies the variables correctly. Then, somewhere between calculating the subtraction of the window areas and applying the texture multiplier, it hallucinates a decimal point or loses track of one of the subtractions. LLMs are incredible at reasoning through linguistics and high-level architectural patterns. They are fundamentally unreliable for deterministic arithmetic involving spatial geometry. If you're building an agent to handle real-world logistics—like construction estimation—you cannot rely on the model's internal weights to perform subtraction. You need a tool. This is why I built the Model Context Protocol (MCP) servers in Vinkius with a focus on precision tools rather than just API wrappers. The paint-coverage-calculator isn't an experiment in text generation; it's an implementation of deterministic logic exposed as an MCP server so that Claude or Cursor can execute code instead of guessing numbers. Moving from Reasoning to Execution The problem with standard prompting for estimation is the 'hidden variables.' In a real renovation project, you don't just paint a rectangle. You deal with architectural deductions (doors and windows) and surface absorption rates (smooth vs. textured). If an agent doesn't explicitly call a tool that handles these subtractions, it’s likely to over-order material. When using the paint-coverage-calculator via MCP, the workflow shifts from 'Calculate this for me' to 'Execute these specific calculation steps.' The server exposes three distinct tools designed to handle different parts of the geometric problem: calculate_wall_paint : This is specifically for vertical surfaces. It handles the logic of subtracting openings (like a 2m x 0.8m door) from the total surface area before a

2026-07-25 原文 →