Middleware routes requests to upstream LLM providers based on the llm.model metadata emitted by llm_request_parser.
| 72 | // Middleware routes requests to upstream LLM providers based on the |
| 73 | // llm.model metadata emitted by llm_request_parser. |
| 74 | type Middleware struct { |
| 75 | cfg Config |
| 76 | // tokenSrc caches one auto-refreshing OAuth2 TokenSource per GCP |
| 77 | // service-account key (keyed by a hash of the key material), so Vertex |
| 78 | // token minting happens once and refreshes are amortised across requests. |
| 79 | tokenMu sync.Mutex |
| 80 | tokenSrc map[string]oauth2.TokenSource |
| 81 | } |
| 82 | |
| 83 | // New constructs a Middleware with the supplied configuration. Empty |
| 84 | // or nil Providers slice yields a router that denies every request as |
nothing calls this directly
no outgoing calls
no test coverage detected