shipwithjev

Catalog / Tools & apps

0265GitHub

hono-jev-router

Routes Hono HTTP requests by meaning.

yusukebe/hono-jev-routerREADME ↗
# hono-jev-router

Route HTTP requests by meaning.

`hono-jev-router` is an experimental router for [Hono](https://hono.dev). Instead of a method and a path, you describe a request in plain words, and [Jev](https://typesafe.ai) by TypeSafe AI decides which description fits the incoming request.

```ts
import { Hono } from 'hono'
import { JevRouter } from 'hono-jev-router'

const app = new Hono({
  router: new JevRouter({ apiKey: process.env.TYPESAFE_API_KEY }),
})

app.on('jev', 'a request from an AI agent', (c) => {
  return c.text('# Documentation', 200, { 'Content-Type': 'text/markdown' })
})

app.on('jev', 'a request from a human browser', (c) => {
  return c.html('<h1>Documentation</h1>')
})

app.on('jev', 'suspicious automated traffic', (c) => {
  return c.text('Forbidden', 403)
})

export default app
```

> [!WARNING]
> This is an experiment. Every semantically routed request calls a model, so it adds latency and cost, and the answer is a probability, not a guarantee.

## Before you use it

- **Do not use it for authentication or authorization.** The request is the input of the model, so whoever sends the request can try to steer the answer. `'suspicious automated traffic'` is a heuristic, not a security boundary.
- **Requests are sent to a third party.** The method, URL, headers and the first `maxBodyLength` bytes of a textual body go to Jev. The values of `Authorization`, `Cookie`, `Proxy-Authorization`, `X-API-Key` and `X-Auth-Token` are replaced with `[redacted]`. Change the list with `redactHeaders`.
- **Every semantically routed request is a model call you pay for.** Put a rate limit in front of it.

## Install

```bash
npm i hono-jev-router
```

## How it works

```
HTTP Request → JevRouter → Jev: "does the request match this description?" → first match → 

Also filed under Tools & apps

  1. 0616

    Jevstiller: distill Jev calls into a local model

    A self-hosted proxy that trains a local model on Jev's answers. It served 72% of Banking77 locally at 15 ms, with a 2% audit and a bound on disagreement.

    tomerglick57 · Tools & apps · 15 ms local

  2. 0611

    Scruple: code checks for what linters miss

    Semantic-aware linting with System One models: rules you can state in a sentence, checked against your code by Jev.

    @nalexpeae · Tools & apps

  3. 0606

    Algolia-style Postgres search with a Jev reranker

    Typo tolerance, typeahead, barcodes and facet counts in plain Postgres SQL, plus an optional Jev step that asks one question per top-10 result.

    @alex_forman1 · Tools & apps

  4. 0604

    Virtual Closet: outfits from closet videos

    built a virtual closet & outfit generator from raw closet videos. classification + semantic search thanks to jev 🥰. clueless closet dreams finally coming to life

    @maitreemervana · Tools & apps