Commit 542d2ed
fix(knowledge): require explicit Azure deployment per OpenAI embedding model
Greptile P1: when AZURE_OPENAI_* was set, every OpenAI embedding model was
routed to the single KB_OPENAI_MODEL_NAME deployment. A KB created with
text-embedding-3-large would be embedded by whatever model that deployment
serves while billing tracked 3-large pricing — and chunks ingested via Azure
versus queried via real OpenAI would land in mismatched vector spaces.
Now require AZURE_OPENAI_DEPLOYMENT_TEXT_EMBEDDING_3_(SMALL|LARGE) per model.
Falls back to KB_OPENAI_MODEL_NAME only for text-embedding-3-small (legacy).
If no deployment is configured for the chosen model, route to direct OpenAI
instead of silently routing to the wrong deployment.
Also fix type predicate in search/route.ts to use KnowledgeBaseAccessResult
so the build passes.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 553021a commit 542d2ed
3 files changed
Lines changed: 27 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 246 | + | |
258 | 247 | | |
259 | 248 | | |
260 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
176 | 192 | | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
183 | | - | |
184 | | - | |
185 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
186 | 202 | | |
187 | | - | |
188 | | - | |
| 203 | + | |
189 | 204 | | |
190 | | - | |
| 205 | + | |
191 | 206 | | |
192 | 207 | | |
193 | 208 | | |
194 | | - | |
| 209 | + | |
195 | 210 | | |
196 | 211 | | |
197 | 212 | | |
| |||
0 commit comments