Skip to content

v0.9.0 - answer() & Template Samples

Choose a tag to compare

@ilchemla ilchemla released this 04 Nov 10:38
c76f2d6

Ask a question and get a written answer with its source links, in one call. Also: sample runs for templates, and one fix.

🚀 What's New

answer(): a written answer with its sources (#53, #65, #66)

  • Six answer services, each with your own key: Perplexity, Exa, You.com, Linkup, Parallel and Brave (Brave reads BRAVE_ANSWER_API_KEY, not the search key). Install the answer extra and set one key; the README lists each one
  • By default, WebRouter tries the services you hold a key for, cheapest list price first, and moves on when one fails or has no answer. Each one it tries bills
  • Agents can call it too: the MCP server has an answer tool, and the Claude, OpenAI and LangChain tools offer it when you switch it on (#64)
from web_router import WebRouter

with WebRouter() as router:
    response = router.answer("who won the 2022 world cup final")

print(response.answer)
for citation in response.citations:
    print(citation.field or "-", citation.url)

For adapter authors: AnswerProvider, HttpAnswerProvider and register_answer_provider() add an answer service (#53).

Template samples (#38)

  • template.samples holds the runs the vendor recorded: an input the template took and the record it returned, so you can see what it needs before you pay for a run
  • On Nimble, a template listing now includes each template's inputs and samples, in Python and in the MCP server, so one call is enough

🐛 Fixes

  • Errors with no message, such as timeouts, now show their type: search failed: ReadTimeout (#53)

🔄 Behaviour Change

  • auto now also moves to the next service when one returns nothing (no results, or only blank pages), not only on an error. Each extra service it tries bills. To stop at the first result, set provider_config={"auto": {"fallback_on_empty": False}}; the MCP server has no such switch (#41)
  • Template samples moved from template.extra["samples"] to template.samples (#38)
  • The max_results description now suggests 5 to 10 results to an agent (#54)
  • The evals extra now allows openai 3 (#67)

Full Changelog: v0.8.0...v0.9.0