Repository navigation
Commit fe3df5a
SCA-365: route remaining HTTP LLM surfaces through the gateway (BasedHardware#12337)
* fix(backend): replace sunset Assistants file-chat with Chat Completions
OpenAI retired Assistants on 2026-08-26, so every /v1/threads create 404s
and non-vision file chat is down. Stream PDFs as Chat Completions file
parts on gpt-4.1 (documented file-input contract) and keep images on the
verified gpt-5.6-luna vision lane.
Failure-Class: FC-pinned-vendor-request-contract-retired
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
* fix(backend): satisfy Chat Completions typecheck without kwargs spread
Unpacking a token-budget dict into create() is untyped and fails pyright.
Failure-Class: FC-pinned-vendor-request-contract-retired
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
* test(backend): make isolated file-chat CI unit stubs non-flaky
CI ran each unit file in its own process; incomplete BYOK/LLM stubs and a
duration-guard race on desktop transcribe failed the backend suite.
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
* fix(stt): mark Soniox re-exports for strict pyright
Upstream 7c900a9 moved the Soniox client into utils.stt.soniox but left
SafeSonioxSocket / process_audio_soniox imported in streaming.py without a
re-export marker; receiver.py and test_soniox_streaming.py import them through
utils.stt.streaming, so strict pyright fails main and every PR merge ref.
Carry the one-line marker so this backend CI lane can go green; matches the
existing SafeDeepgramSocket compat re-export convention on the previous line.
Co-authored-by: multica-agent <[email protected]>
* feat(backend): route remaining LLM HTTP through gateway
File-chat completions, company-paid desktop Vertex traffic (text + single
embed), and both embedding surfaces now hop backend/llm_gateway so
accounting (build_accounting_event / gateway metrics) is the single
spend ledger when OMI_LLM_GATEWAY_FEATURE_MODE=gateway:
- gateway: OpenAI-shaped /v1/embeddings surface (omi:auto:openai-embeddings,
omi:auto:gemini-embeddings) with accounting; desktop-vertex-* chat lanes
generated from vertex_pt_routing; VertexGeminiProvider owns the PT policy
(pin, promotion latch, overflow ladder, reachability, capacity header,
regional vs multi-region host split) and gains tools/toolConfig translation
plus :predict embeddings; validator accepts file parts, json_object, and
the extra_body-style google options field.
- backend: chat_file streams/sync completions through the file-chat lanes
(OpenAI Files upload/download stays direct by design); the OpenAI
embeddings proxy and gemini_embed_query hop the gateway lanes with BYOK
kept on documented thin direct paths; desktop_proxy stays the BFF
(auth/metering/limits) and translates Gemini JSON via
utils/llm/desktop_gemini_gateway.py, keeping BYOK and batchEmbedContents
direct.
- FEATURE_MODE=off keeps every legacy direct path (kill switch unchanged);
inventory + guardrails updated; omni WS stays blocked.
* refactor(backend): split vertex wire/policy and desktop gateway hop out of the ratcheted files
providers.py and desktop_proxy.py grew past the product line-count ratchet;
the vertex adapter's pure wire translation (vertex_wire.py), the PT policy
mixin (vertex_pt_policy.py), shared provider types (provider_types.py), and
the desktop BFF's gateway hop + Gemini body sanitization
(utils/llm/desktop_gemini_gateway.py) move into focused modules with the
original call sites and test seams preserved via re-exports.
* fix(backend): keep Vertex token refresh on wall clock and attribute file-chat spend
The gateway Vertex provider was sharing the PT monotonic clock with ADC
token expiry, so tokens never refreshed after the first fetch. File-chat
hops also omitted the user uid, leaving ledger rows unattributed, and the
desktop tool-loop minted a new tool_call_id after the ordinal advanced.
Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
* fix(backend): restore embeddings BYOK async fallback and temporal test stubs
Direct-path aembed_query/aembed_documents now notify and fall back to the
Omi key on BYOK 401 like the sync methods. Hermetic app-integration
harnesses stub utils.llm.temporal so collection survives the main merge
that imports current_date_for_uid.
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
* fix(backend): pin file-chat documents to gpt-5.6-luna
Live probe confirmed Luna accepts the Chat Completions file-part
contract, so the documents lane leaves gpt-4.1. Keep the separate
file-chat-documents lane because the request shape still differs.
Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>
---------
Co-authored-by: David Zhang <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: multica-agent <[email protected]>1 parent 82a67a6 commit fe3df5a
49 files changed
Lines changed: 4598 additions & 1008 deletions
File tree
- backend
- database
- docs
- llm
- llm_gateway
- gateway
- routers
- models
- routers
- tests
- unit
- utils
- llm
- other
- retrieval
- stt
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | 807 | | |
820 | 808 | | |
821 | 809 | | |
| |||
877 | 865 | | |
878 | 866 | | |
879 | 867 | | |
880 | | - | |
| 868 | + | |
881 | 869 | | |
882 | 870 | | |
883 | 871 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
16 | 6 | | |
17 | 7 | | |
18 | 8 | | |
| |||
72 | 62 | | |
73 | 63 | | |
74 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
75 | 68 | | |
76 | 69 | | |
77 | 70 | | |
78 | 71 | | |
79 | | - | |
| 72 | + | |
80 | 73 | | |
81 | 74 | | |
82 | 75 | | |
| |||
125 | 118 | | |
126 | 119 | | |
127 | 120 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
135 | 128 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
41 | 60 | | |
42 | 61 | | |
43 | 62 | | |
| |||
0 commit comments