Skip to content

Add SpecStream web search and access nodes - #135

Open
Specstreamai wants to merge 1 commit into
WeaveMindAI:mainfrom
Specstreamai:feat/specstream-web-search
Open

Specstreamai wants to merge 1 commit into
WeaveMindAI:mainfrom
Specstreamai:feat/specstream-web-search

Conversation

@Specstreamai

Copy link
Copy Markdown

What and why

Adds SpecStream to the web package as another search option beside Exa's Web Search and Keenable's: a SpecStreamSearch node and a SpecStreamAccess node. Each result carries the passage of the page that best matches the query, which SpecStream cuts to maxTextChars itself, so an LLM node downstream reads the relevant part of each page instead of its opening lines. The numbers behind it: 64.0 item F1 on all 200 WideSearch tasks against 57.6 for Parallel and 56.1 for Exa, and 66.7 on Seal-0 (https://specstream.ai/benchmarks).

How

  • The same pair layout as Exa: an access node holding a pasted key, sent as Authorization: Bearer {key}, and a search node whose account input is required.
  • The search posts {"q", "num", "compact": true, "source_max_chars"} to https://api.specstream.ai/v1/web-search. source_max_chars is maxTextChars clamped to the 10,000 the API accepts. The node still runs cap_text on each passage and wire::fit_texts on the list, as WebSearch and KeenableSearch do, so multibyte text cannot push it past a wire.
  • site is appended to the query as site:<domain>. SpecStream holds that operator on every result rather than ranking by it, and the query port's description names the other operators it holds (-site:, quoted phrases, after:, before:).
  • Outputs follow KeenableSearch plus publishedDate, which SpecStream gives as published on each source.
  • The access check is ExaAccess's trick: POST https://api.specstream.ai/v1/web-search with no body and expectStatus: 400. A good key reaches the missing q error (400) and a bad one is refused first with 401, both checked by hand; no search runs, so nothing is charged. verification is reports_validity, free.
  • No meter and no shared door: a search spends the key owner's balance. A standard search of up to 10 results costs $0.005; sign up includes $10 of credit.
  • Nothing outside catalog/web/specstream_* changes. The service count sentence that the Keenable PR updated in declaring-a-service.md is gone from main, so the docs needed nothing.

On the wire: the query, plus site: when the port is set, the result count and the text cap, signed with the key.

Linked issue

None.

What kind of change

  • Bug fix
  • New node
  • New service (an access recipe)
  • Language change: parser, type system, validator, codegen
  • Runtime change: engine, dispatcher, listener, supervisor, broker
  • The graph renderer
  • The VS Code extension
  • Docs
  • Refactor
  • Other:

Checklist

  • cargo test and cargo clippy pass. (cargo test -p weft-catalog, and clippy -D warnings on the emitted web package crate with node-tests on; see below)
  • If you touched the graph renderer, pnpm -C packages/weft-graph test passes.
  • If you touched the VS Code extension, pnpm -C extension-vscode test passes.
  • New code has tests, at the right layer. Three basic and three fake tests, plus one live test.
  • A bug fix has a regression test that fails before the fix.
  • Docs updated, if this changes behavior the docs describe.
  • If you changed SQL, scripts/run-db-tests.sh passes against a real Postgres.
  • A new node holds up against the review list.
  • If you built this with an AI assistant, /flow-4-review and /flow-5-review-check ran as a pair until a pair turned up nothing.

Anything reviewers should look at twice

What I ran, on Linux with toolchain 1.99.1 from rust-toolchain.toml:

  • weft test-node SpecStreamSearch SpecStreamAccess KeenableSearch WebSearch with the CLI built from this branch: all 16 basic and fake tests pass, the 6 new ones and the existing KeenableSearch and WebSearch ones.
  • cargo test -p weft-catalog: 43 and 19 passed, including every_stdlib_node_loads_strict and every_stdlib_node_has_the_error_output.
  • cargo clippy --all-targets --features node-tests -- -D warnings on the emitted pkg_web crate: clean.
  • weft validate on a small program wiring SpecStreamAccess into SpecStreamSearch: no diagnostics, and wiring count into query is refused with the expected type mismatch.
  • The request body the node builds, sent live with a real key: "rust programming language" with one result gave rust-lang.org with a 2,323 character passage, and "tokio select macro cancellation safety" with site: docs.rs gave the tokio::select! page first, then two more docs.rs pages.
  • Not run: the live tier through scripts/run-node-tests.sh, which needs a full install with the broker. The live test declares the specstream service, so it wants a WEFT_NODE_TEST_SPECSTREAM_KEY grant.

The fake tier's client does not apply the recipe's auth header, so the Bearer header is covered by the recipe itself and by the live run, not by a fake test.

Disclosure: I run SpecStream, the company behind this API.

SpecStream: Web Search searches the live web through SpecStream and emits title, url,
published date and the passage of each page closest to the query, cut server side at
maxTextChars and fitted to a wire like the other web nodes. SpecStreamAccess holds the API
key and checks it at connect time the way ExaAccess does: a POST to /v1/web-search with no
body answers 400 to a good key and 401 to a bad one, and runs no search.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant