MCPcopy Index your code
hub / github.com/coder/coder / createChatModelConfigWithTitleFailure

Function createChatModelConfigWithTitleFailure

coderd/exp_chats_test.go:10671–10680  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

10669// is how quick title generation requests structured output, so tests can fail
10670// title generation without breaking the main assistant response.
10671func 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
10682func createAdditionalChatModelConfig(
10683 t *testing.T,

Callers 2

TestRegenerateChatTitleFunction · 0.85
TestProposeChatTitleFunction · 0.85

Calls 6

NewOpenAIFunction · 0.92
OpenAIStreamingResponseFunction · 0.92
OpenAITextChunksFunction · 0.92
OpenAIErrorResponseFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected