Conversation
Adds Caesar (https://docs.trycaesar.com) alongside Exa, Perplexity, Tavily, and LangSearch. Mirrors the LangSearch provider: raw fetch against a base URL, the shared web_search tool and WEB_SEARCH_DESCRIPTION, formatToolResult mapping, and a required CAESAR_API_KEY sent as a Bearer token. Caesar returns query-selected passages inline with each search result, so the mapper surfaces those rather than the page's meta description, the same way the LangSearch provider prefers `summary` over its short `snippet`. It also carries a publication date, which is surfaced as `published` when the document has one. - src/tools/search/caesar.ts: provider (passage-preferring, tolerant mapping) - src/tools/search/caesar.test.ts: bun tests (Bearer, missing key, passages, fallback, 401) - src/tools/search/index.ts, src/tools/registry.ts: export + register - src/utils/env.ts: SearchProviderId + SEARCH_PROVIDERS entry - src/components/select-list.ts: /search provider menu entry - env.example: document CAESAR_API_KEY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Caesar as a fifth
web_searchbackend alongside Exa, Perplexity, Tavily, and LangSearch.What makes it worth a slot: Caesar returns the passages it selected for your query inline with each search result, so for most questions the agent does not need a second round trip to read the page. The other four providers return a title, a URL, and a snippet; getting the text that actually answers the question is a follow-up fetch.
What that looks like
Caesar's
snippetfield is the page's meta description. Itspassagesfield is query-conditioned. Same document, two different queries, zero overlap in the passages returned:Both from
tokio.rs/blog/2019-10-scheduler. So the provider surfacespassagesand falls back tosnippetwhen a result has none. That is the same preference LangSearch's provider already makes when it takessummaryover its own shortersnippet, so I followed that rather than inventing a new field.Concretely, on
why did tokio avoid the atomic increment in wake_by_refacross 5 results:Each result also carries a publication date, surfaced as
publishedwhen the document has one. For a research agent that reasons over filings and news, knowing a source is from 2019 rather than last week seemed worth keeping.Tradeoff, stated plainly
Passages make each response roughly 4x larger than a snippet-only mapping, so a
web_searchcall costs more context tokens. I think that is the right trade for this agent, because the alternative is spending a fetch plus the whole page. If you would rather keep responses small, the mapper is one function (contentFor) and can prefersnippetinstead.Scope
Additive. The only existing files touched are the ones any new provider touches: the
SearchProviderIdunion andSEARCH_PROVIDERSinsrc/utils/env.ts, registration insrc/tools/registry.ts(guarded byprocess.env.CAESAR_API_KEY, exactly like the other four), the/searchmenu entry, the barrel export, andenv.example. No existing provider is modified and no shared type is widened.CAESAR_API_KEYis required and sent asAuthorization: Bearer <key>. Missing key throws[Caesar API] CAESAR_API_KEY is not set, mirroringsearch_langsearch.Tested
src/tools/search/caesar.test.tscovers the Bearer header, the missing-key throw, passage preference, the snippet fallback when a result has no passages, empty-passage handling, alternate url/snippet field names, and a 401.Beyond the mocked units I ran a real query through the built tool:
That is the answer to the question, returned by the search call itself.
Disclosure: I work on GTM for Caesar. I wrote this to match how
langsearch.tsis built rather than as a vendor drop-in, and I am happy to adjust the mapping, the priority placement, or thepublishedfield to fit your conventions.