createChatModelConfigWithTitleFailure provisions a model whose streaming chat responses succeed, while non-streaming requests fail. The non-streaming path is how quick title generation requests structured output, so tests can fail title generation without breaking the main assistant response.
(t testing.TB, client *codersdk.ExperimentalClient)
| 10669 | // is how quick title generation requests structured output, so tests can fail |
| 10670 | // title generation without breaking the main assistant response. |
| 10671 | func createChatModelConfigWithTitleFailure(t testing.TB, client *codersdk.ExperimentalClient) codersdk.ChatModelConfig { |
| 10672 | t.Helper() |
| 10673 | baseURL := chattest.NewOpenAI(t, func(req *chattest.OpenAIRequest) chattest.OpenAIResponse { |
| 10674 | if req.Stream { |
| 10675 | return chattest.OpenAIStreamingResponse(chattest.OpenAITextChunks("Hello from test server.")...) |
| 10676 | } |
| 10677 | return chattest.OpenAIErrorResponse(http.StatusUnauthorized, "invalid_api_key", "test title failure") |
| 10678 | }) |
| 10679 | return createChatModelConfigWithBaseURL(t, client, baseURL) |
| 10680 | } |
| 10681 | |
| 10682 | func createAdditionalChatModelConfig( |
| 10683 | t *testing.T, |
no test coverage detected