(t *testing.T)
| 286 | } |
| 287 | |
| 288 | func TestInfer_RAG_EmptyQuery400(t *testing.T) { |
| 289 | cfg := testConfigWithFileKB(t) |
| 290 | srv := New(cfg) |
| 291 | ts := httptest.NewServer(srv.Routes()) |
| 292 | defer ts.Close() |
| 293 | |
| 294 | status, body := postInfer(t, ts.URL, map[string]any{ |
| 295 | "request_type": "rag", |
| 296 | "tenant_id": "team-a", |
| 297 | "task_type": "simple", |
| 298 | "priority": "high", |
| 299 | "context": map[string]any{ |
| 300 | "knowledge_base": "kb1", |
| 301 | }, |
| 302 | "input": map[string]any{"text": ""}, |
| 303 | "options": map[string]any{"stream": false, "max_tokens": 128}, |
| 304 | }) |
| 305 | if status != http.StatusBadRequest { |
| 306 | t.Fatalf("expected 400, got %d body=%s", status, string(body)) |
| 307 | } |
| 308 | assertStructuredError(t, body, errCodeInvalidRequest) |
| 309 | } |
| 310 | |
| 311 | func testConfigOpenAIEndpoint(t *testing.T, endpoint string) *config.Config { |
| 312 | t.Helper() |
nothing calls this directly
no test coverage detected