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

标签:#Python

找到 732 篇相关文章

AI 资讯

Free Live Webinar: Testing AI Agents in Python for Real-World Reliability

AI agents are getting smarter fast. They can reason through tasks, manage workflows, call tools, and automate decisions across applications. But as these systems become more capable, one challenge becomes impossible to ignore: reliability. How do you know your AI agent is making the right decisions consistently? How do you test workflows that involve memory, reasoning, and multiple execution steps? And how do you debug failures when outputs become unpredictable? That’s exactly what this free live webinar, “ Testing AI Agents in Python: Building Reliable Evals with LangGraph & LangSmith ,” is focused on. The session includes a “ Live demo of the AI agent evaluation pipeline ,” where you’ll see how developers are building structured evaluation workflows using LangGraph and LangSmith to test, trace, and improve AI agent performance in real-world scenarios. Here is the link to register .. Who Should Join This Session? This webinar is designed for developers and technical teams working with AI systems, especially: Python developers building AI agents or LLM workflows AI engineers exploring evaluation and observability Architects designing production-ready AI systems Product teams experimenting with AI automation Founders building intelligent applications faster Whether you’re actively deploying AI agents or still evaluating the ecosystem, this session will give you a clearer understanding of how reliable AI systems are actually built. What You’ll Learn During the Webinar This isn’t a high-level AI trends session. The focus is practical implementation, testing workflows, and evaluation strategies developers can actually use. In this webinar, you’ll learn: Why evaluation matters for modern AI agents How LangGraph helps manage complex agent workflows How LangSmith can trace and monitor agent execution Ways to create repeatable and scalable evaluation pipelines Practical approaches for debugging and improving AI agent behavior See the AI Evaluation Pipeline Live One of the b

2026-06-01 原文 →
AI 资讯

Why I Stopped Organizing AI Agents by Role (and Built a Document Exchange Center Instead)

Most multi-agent frameworks for software development organize agents around roles : a product manager agent, a developer agent, a tester agent. ChatDev and MetaGPT pioneered this approach, and it works well for monolithic tasks. But I ran into a wall when I tried to apply it to a real system with multiple independently-deployed services. The Problem with Role-Based Coordination Imagine you have a backend search service and a frontend management console. The backend team implements a new API endpoint. The frontend needs to adapt. In a role-based framework, there's no natural mechanism for this. Both agents are "developers" in the same simulated organization. There's no concept of service boundaries, no versioned contracts, no way to say "the backend changed, and the frontend needs to know exactly what changed." The coordination problem in multi-service development isn't "which role should handle this task" — it's "which service needs to know about this change, and what exactly changed." That reframing led me to build something different. AgentNexus: Coordinating Agents at the Service Granularity AgentNexus is a document exchange center that treats each service as a first-class citizen. Instead of roles, it uses service boundaries as the coordination primitive. Here's how it works: Each service registers as a sub-project with its own document namespace Services publish versioned Markdown documents: requirements, design specs, API docs, config Services subscribe to documents from other services they depend on When a subscribed document changes, the subscriber receives a diff-aware notification containing both the structured diff and the full latest content The whole thing is exposed as an MCP (Model Context Protocol) server running in streamable-HTTP mode, so multiple agents can connect simultaneously from different machines. The Diff-Aware Update Protocol This is the part I'm most proud of. When an agent calls get_my_updates_with_context , it gets back: { "update_id"

2026-06-01 原文 →
开发者

Python Programming for Beginners – Day 9

Tuples, Sets, and Dictionaries in Python In the previous lesson, we learned about Lists and how they are used to store multiple items in a single variable. Today, we will learn about three important Python data structures: Tuples Sets Dictionaries These data structures help programmers organize and manage data efficiently in different situations. 1. Tuples in Python A Tuple is a collection of items stored in a single variable. Tuples are: Ordered Unchangeable (Immutable) Allow duplicate values Tuples are created using parentheses "()". Example languages = ( " Python " , " Java " , " C++ " ) print ( languages ) Output ( ' Python ' , ' Java ' , ' C++ ' ) Accessing Tuple Items Tuple items are accessed using indexes. Example languages = ( " Python " , " Java " , " C++ " ) print ( languages [ 0 ]) print ( languages [ 1 ]) Output Python Java Negative Indexing in Tuples Example languages = ( " Python " , " Java " , " C++ " ) print ( languages [ - 1 ]) Output C ++ Tuple Length The "len()" function returns the number of items in a tuple. Example numbers = ( 10 , 20 , 30 ) print ( len ( numbers )) Output 3 Why Tuples are Important Tuples are useful when data should not be modified accidentally. They are commonly used for: Fixed data Coordinates Database records Returning multiple values from functions 2. Sets in Python A Set is a collection of unique items. Sets are: Unordered Unchangeable items Do not allow duplicates Sets are created using curly brackets "{}". Example numbers = { 1 , 2 , 3 , 4 } print ( numbers ) Output {1, 2, 3, 4} Duplicate Values in Sets Sets automatically remove duplicate values. Example numbers = { 1 , 2 , 2 , 3 , 4 } print ( numbers ) Output {1, 2, 3, 4} Adding Items to a Set The "add()" method inserts a new item into a set. Example numbers = { 1 , 2 , 3 } numbers . add ( 4 ) print ( numbers ) Output {1, 2, 3, 4} Removing Items from a Set The "remove()" method removes an item from a set. Example numbers = { 1 , 2 , 3 , 4 } numbers . remove ( 2 ) print

2026-06-01 原文 →
AI 资讯

Your Scraper Returned a Clean Row. It Was Wrong.

The row looked perfect. rating: 7 . Valid JSON, right type, no nulls, no missing keys. My schema check waved it through. The page had returned HTTP 200. The selectors hadn't moved. Everything green. A rating of 7 on a 5-star site is impossible. The model invented it, formatted it correctly, and handed it to me with total confidence. That's the failure I want to talk about. Not the scraper that breaks loudly. The one that hands you a clean-looking row that is quietly, plausibly false — and sails past every check you have, because your checks are all looking at the shape of the data, and the lie is in the value . TL;DR HTTP 200, intact selectors, and valid JSON tell you the form is fine. They say nothing about whether the value is true. When an LLM extracts from messy free-text, structured-output mode guarantees you get valid JSON. It does not guarantee the content is real. The model fills uncertain fields rather than leaving them empty — because the schema demands a complete row. A ~60-line value-level sanity gate (ranges, dates, cross-field, reference, language) catches the obvious lies before they hit your database. Real code and real output below. The honest catch: this gate catches rule violations , not plausible lies inside the allowed range . A rating: 4 where the truth is 2 slides right through. I'll be specific about where the gate stops. Two different ways a scraper lies to you I wrote about source drift last week — the case where the page changes underneath you and a 30-line schema check catches the structure shifting. That's an input problem. The source mutated; your agreement with the page broke; you detect it by watching the shape. This is the other end of the pipe. The source is fine. The page is intact, the selectors are correct, the structure is exactly what you expected. The thing that lied to you is the model , on the extraction step, when you asked it to pull structured fields out of a paragraph of human prose. Those two failures feel similar and t

2026-06-01 原文 →
开发者

How I Made My First Dollar with Python Automation - A Practical Guide

This isn't a tutorial. It's real experience. Most articles about making money with Python are vague: "Learn Python to make money" (then what?) "Do data analysis freelancing" (how to get clients?) "Write web scrapers" (legal gray area) I'll share my actual path: building an Excel template generator with Python, listing it for sale, and earning my first dollar. Why This Direction My background: Know Python, but not expert Made some automation scripts No product design experience Want products (scalable) not services (time-for-money) The opportunity: Huge Excel template market (many 10k+ sales on Gumroad) Templates are static, hard to customize I can make a "template generator" for customization Technical feasibility: Python's openpyxl generates Excel programmatically JSON config is user-friendly ~300 lines of code The Product Not an Excel file. A Python script that generates Excel files . Users get: generator.py - generator code config.json - configuration README.md - documentation Workflow: Edit config.json → Run python generator.py → Get customized Excel Technical Implementation Core code is simple: from openpyxl import Workbook from openpyxl.styles import Font , PatternFill wb = Workbook () ws = wb . active # Header style header_fill = PatternFill ( start_color = ' 6366F1 ' , fill_type = ' solid ' ) header_font = Font ( bold = True , color = ' FFFFFF ' ) # Write header ws [ ' A1 ' ] = ' Project Name ' ws [ ' A1 ' ]. fill = header_fill ws [ ' A1 ' ]. font = header_font # Add dropdown from openpyxl.worksheet.datavalidation import DataValidation dv = DataValidation ( type = ' list ' , formula1 = '" In Progress,Completed,Paused "' ) ws . add_data_validation ( dv ) dv . add ( ' B2:B100 ' ) wb . save ( ' output.xlsx ' ) Loop to create sheets, set styles, add validation. Productization Process Step 1: MVP One module only (knowledge base) Test generation Use myself for a week Step 2: Expand Add 6 modules Add JavaScript version (using exceljs ) Improve docs Step 3: Package

2026-06-01 原文 →
开发者

How to Find a Prime Number in Python — A Thinking Journey

Introduction Understanding how to find prime numbers is one of the best ways to develop logical thinking in programming. It looks simple on the surface, but it teaches you how to break a problem into smaller steps, build a solution gradually, and then improve it into a clean and reusable structure. In this blog, we will not jump directly into code. Instead, we will start from basic thinking, slowly convert that thinking into logic, and finally refine it into a proper Python program using functions and loops. The goal is not just to find prime numbers, but to understand how programming logic is actually built in real development. 1. Understanding the Problem First Before writing anything in Python, we need to understand what a prime number actually means. A prime number is a number that: is greater than 1 has exactly two divisors: 1 and itself So the real question becomes: How do we check whether a number has any divisors other than 1 and itself? That is the core problem we are trying to solve. 2. Thinking Like a Human Before Coding Let’s take a number, for example 13. To check if 13 is prime, we naturally try dividing it by smaller numbers: 2 → does not divide 13 3 → does not divide 13 4 → does not divide 13 5 → does not divide 13 and so on If none of these numbers divide 13 completely, then 13 is prime. So the logic is simple: Try dividing the number by possible candidates and see if any divide it perfectly. 3. Turning Thinking into a Basic Algorithm From the above idea, we can form a basic structure: We need: a number to test a variable that moves through possible divisors a way to detect whether a divisor exists We start checking from 2 because every number is divisible by 1 anyway. We also do not need to check beyond half of the number, because a number cannot have a divisor greater than half (except itself). So the idea becomes: Start divisor from 2 Go up to number // 2 If any number divides it evenly, it is not prime 4. First Working Logic (Direct Implementati

2026-06-01 原文 →
AI 资讯

I read a multi-agent reasoning paper, built the Claude-native version, and measured everything

RecursiveMAS (arXiv 2604.25917) showed that agents sharing internal reasoning state outperform agents that share only final outputs. The average accuracy gain across benchmarks was 8.3 points. The mechanism: each agent passes not just its answer but the latent embeddings from its own reasoning process, and the next agent conditions on both. The paper is a good result. The catch is access. RecursiveMAS requires open-weight models with hidden states exposed at inference time. That rules out Claude, GPT-4o, and Gemini. I built a Claude-native version using the Anthropic extended thinking API. The core idea transfers: instead of passing latent vectors, pass the full thinking text. The paper calls it internal state sharing; the Claude version calls it thinking-block relay. The architecture problem Claude's extended thinking blocks carry an encrypted signature tied to the originating conversation. You cannot pass a signed thinking block into a different agent's messages array. The API rejects it. The workaround: extract the text from the thinking block and inject it as a regular user message. # Extract thinking text from Agent 1 thinking_text = next ( ( b . thinking for b in response . content if b . type == " thinking " ), "" ) # Inject into Agent 2 as regular context, not as a thinking block context = f " Prior agent reasoning: \n { thinking_text } " The signature does not transfer. The reasoning does. relay-structured: what I built first The first architecture was a Planner > Critic > Solver loop where each agent emits a compact mental model JSON instead of raw thinking text. Raw thinking at a 1024-token budget is often compressed and fragmented. The hypothesis was that 150 tokens of structured signal carries more information per token than 1024 tokens of compressed prose. The schema each agent emits: { "interpretation" : "how the agent read the problem" , "key_steps" : [ "step 1" , "step 2" ], "rejected_approaches" : [ "approach tried and discarded" ], "confidence" :

2026-06-01 原文 →
AI 资讯

SDXL Turbo for Pinterest at Scale: How I Cut NSFW False-Positives by 73% and Dodged Style-Copyright Strikes (Python + diffusers)

⚠️ この記事はアフィリエイト広告(プロモーション)を含みます。リンク先で発生した収益の一部が運営者に支払われますが、読者の購入価格には一切影響ありません。 By the end of this article you'll have two runnable Python scripts: a CLIP-based pre-filter that re-checks SDXL Turbo output before it ever hits Pinterest, and a prompt sanitizer that strips artist names + trademarked characters so you don't eat a DMCA. I ran this pipeline for 41 days, generated 6,180 images, and went from a 9.7% Pinterest rejection rate down to 2.6%. Here's exactly what broke and what fixed it. Why SDXL Turbo (1-step, ~0.3s on a 4090) beats SD 1.5 for Pinterest volume First, the conclusion: if you're mass-producing pins, SDXL Turbo's single-step guidance_scale=0.0 generation is the only thing that makes the unit economics work. On my RTX 4090 I clock 0.31s per 512x512 image with Turbo vs 4.8s for a 30-step SDXL base run. That's 15x. Over 6,180 images that's the difference between 32 minutes and 8.2 hours of GPU time. But Turbo has a nasty side effect nobody warns you about: because it's distilled and runs at low resolution by default, its built-in StableDiffusionXLPipeline safety checker (when enabled) throws far more false positives on perfectly benign images — beaches, lingerie-free fashion flatlays, even close-up food. In my first 600-image batch, 58 images came back as black squares from the NSFW checker. 51 of them were photos of latte art and knitted sweaters . So I ripped out the default checker and built my own two-stage gate. Stage 1: Replacing the diffusers safety_checker with a tunable CLIP gate in Python The default safety_checker in diffusers is a binary black box — you get a black image and zero signal about why . For a production loop you need a confidence score so you can set your own threshold. I use OpenCLIP's ViT-B-32 to score each output against a small set of NSFW concept prompts, then compare to a safe-concept baseline. This code actually runs (tested on diffusers==0.27.2 , open_clip_torch==2.24.0 ): import torch import open_clip from PIL import Ima

2026-06-01 原文 →
AI 资讯

Building Hermes Financial Agent: An Explainable AI Copilot for EGX Investors

Overview I built Hermes Financial Agent — an AI-powered financial assistant for investors in the Egyptian Exchange (EGX). The goal: not just calculate portfolio value, but explain risks in a transparent, auditable way. Features Real EGX market data via Yahoo Finance Portfolio tracking and valuation Daily financial reports Telegram-user portfolio isolation Cached quote fallback for resilience Explainable risk insights Explainable Risk Intelligence Unlike traditional trackers, Hermes surfaces: Portfolio concentration risk Stale market data exposure Quote coverage percentage Valuation gaps from unavailable data Users understand confidence level behind their valuation — not just the number. Technical Stack Hermes Agent framework Python GitHub Actions (automated smoke testing) Offline-safe quote fallback architecture Repository 🔗 GitHub Repository Future Roadmap News sentiment analysis Investment thesis tracking Market briefing generation Advanced financial reasoning agents hermeschallenge

2026-06-01 原文 →
AI 资讯

Notes on Federated Learning and Differential Privacy

Notes on Federated Learning and Differential Privacy 2026-05-31 · privacy-preserving ML Working notes on building federated learning (FL) from scratch, what actually breaks under Non-IID data, and how differential privacy (DP) and secure aggregation fit on top — including the honest negative results that the marketing slides leave out. They follow the implementation in federated-learning-lab (FedAvg / FedProx / SCAFFOLD, DP-SGD, secure aggregation; 33/33 tests, literature cross-validated). 1. What federated learning actually is The data never moves. Instead of pooling everyone's data on one server, each client trains locally and sends model updates to a server that aggregates them. The canonical loop ( FedAvg ) is: Server broadcasts the global model. Each client does a few local SGD epochs on its own data. Each client sends back its updated weights. Server averages the weights (weighted by client data size) → new global model. That's it. The elegance is that raw data stays on-device; the difficulty is that the clients' data distributions are not identical. 2. The Non-IID problem (where FedAvg starts to hurt) FedAvg implicitly assumes every client sees roughly the same distribution. Real clients don't — one hospital sees different cases than another, one phone's keyboard sees different language. Under Non-IID data, each client's local optimum pulls in a different direction, so averaging their updates produces client drift : the global model lands somewhere none of them wanted. Two well-known fixes, both implemented and measured in the lab: FedProx — add a proximal term that penalises drifting too far from the global model. Stabilises training when clients are heterogeneous. SCAFFOLD — track control variates (correction terms) that estimate and subtract the drift direction. More state to communicate, but corrects the bias FedProx only damps. The honest finding worth repeating: on a strongly Non-IID split (e.g. label-skewed MNIST), the fancy methods don't always beat p

2026-05-31 原文 →
AI 资讯

Google Ads Transparency Scraper: pull any competitor's ads for $1.20/1K

Quick answer: The Google Ads Transparency Center is a public registry of every ad Google runs — but it ships no API and no bulk export . To get the data programmatically you scrape it. A Google Ads Transparency scraper sends the same RPC call the website uses and returns every ad creative for an advertiser as structured JSON. The Apify Actor below does it for $0.0012 per ad (~$1.20 per 1,000), with the TLS fingerprinting, proxy rotation, and pagination handled for you. Google's Ads Transparency Center is one of the most underused datasets in marketing. Launched in 2023 under the EU Digital Services Act and parallel US pressure, it indexes every ad campaign currently running on Search, YouTube, Display, Shopping, Maps, and Play — keyed by advertiser. Google's own counter lists 300,000+ active creatives for a brand like Nike . For your nearest competitor, it's usually 50–500. The catch: there's no download button. Just an interactive UI that paginates 40 creatives at a time. If you want this as a CSV — for a competitor sweep, a trademark audit, or a RAG corpus — you have to extract it yourself. Here's what that actually takes, and how I shortened it to one API call. What is the Google Ads Transparency Center? 🔎 The Google Ads Transparency Center is a public, Google-operated registry that shows the ad creatives any verified advertiser is running, the date range each ad was shown, and roughly where. Google built it to comply with ad-disclosure regulation, so the data is public by design — you're reading the same registry a regulator would. What it gives you per advertiser: Every ad creative currently or recently live (text, image, video) The landing domain each ad clicks through to First-shown / last-shown timestamps and a rough impression count A deep link to each creative inside the Transparency Center What it does not give you: a search-by-keyword mode, region-filtered results from the server, or — crucially — an API. Does the Google Ads Transparency Center have an A

2026-05-31 原文 →