modelsFromContext returns (requested, served) using context-set values when present, falling back to the response-reported model for both. The router middleware (subsystem 2 of the routing plan) populates these; until it lands they are equal.
(c echo.Context, fallback string)
| 242 | // The router middleware (subsystem 2 of the routing plan) populates |
| 243 | // these; until it lands they are equal. |
| 244 | func modelsFromContext(c echo.Context, fallback string) (string, string) { |
| 245 | requested := fallback |
| 246 | served := fallback |
| 247 | if v, ok := c.Get(ContextKeyRequestedModel).(string); ok && v != "" { |
| 248 | requested = v |
| 249 | } |
| 250 | if v, ok := c.Get(ContextKeyServedModel).(string); ok && v != "" { |
| 251 | served = v |
| 252 | } |
| 253 | return requested, served |
| 254 | } |
| 255 | |
| 256 | func promptTokensFromContext(c echo.Context, fallback int64) (int64, int64) { |
| 257 | pre := fallback |