Skip to content

Instantly share code, notes, and snippets.

View wylswz's full-sized avatar

Yunlu Wen wylswz

View GitHub Profile
@wylswz
wylswz / jev_needle_vs_llm.py
Last active September 21, 2026 01:55
Flat Agent Loop vs Intent-Route-Execute with Jev and Needle
"""Cost *and quality* of two agent architectures on the same trip-planning task.
Both arms use the same frontier LLM (DeepSeek-V4.1-Flash) and the same 22
tools — crowd levels, weather, tickets, transit, food, hotels — and both must
end with a written itinerary. What differs is who sees the tools.
Arm A — flat agent. The LLM is bound to all 22 tool schemas and drives a
LangGraph ReAct loop: every turn re-sends every schema plus the whole growing
transcript of tool results, and the LLM emits the calls itself.
@wylswz
wylswz / py_cancel.py
Last active September 11, 2026 07:29
Cancel that god damn request
"""Compare three ways to cancel an SSE read on a time-to-first-token (TTFT) timeout.
1. Native threads: shut down the underlying socket to interrupt a blocking read.
2. gevent-patched threading: close the response from another greenlet.
3. gevent.Timeout: interrupt the consumer greenlet and unwind its context managers.
4. async io: use asyncio.timeout to cancel the read operation.
For this demo, "first token" means the first line yielded by iter_lines(), not a
complete SSE event or an actual model token. The thread-based timers start after
response headers arrive; gevent.Timeout also covers request setup.
@wylswz
wylswz / 1.17.1.md
Last active September 10, 2026 09:26
Release v1.17.1

Warning

Self-hosted deployments using the bundled Weaviate must complete a manual, staged upgrade before starting 1.17.1. The bundled Weaviate server moves from 1.27.0 to 1.39.2 — 12 minor versions — and skipping minors is unsupported. Pulling and restarting can silently and permanently break vector search. See Bundled Weaviate Server Upgrade in the Upgrade Guide. Fresh deployments, external Weaviate, and other vector stores are unaffected.

What's Changed

New Features

Dataset-Scoped Knowledge Base API Keys

  • Knowledge base service-API keys were scoped to the whole workspace: one key could read and write every knowledge base in the tenant, so giving an integration access to a single knowledge base meant giving it access to all of them. Keys can now be bound to specific knowledge bases from the knowledge base's API access panel, with a workspace / this-knowledge-base scope selector at creation time. A bound key returns 403 for any other
@wylswz
wylswz / DFANode.java
Last active July 12, 2022 11:41 — forked from edokeh/index.js
佛祖保佑,永无 BUG
package com.xmbsmdsj.regex;
import javax.xml.soap.Node;
import java.nio.file.NotDirectoryException;
import java.util.*;
public class DFANode implements Matcher{
private static final DFANode EMPTY = new DFANode(Collections.emptySet());