From 2b2f4110da53a03742faff89cdec17c55e091a90 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 11 Jun 2026 00:21:50 +0300 Subject: llm: return concrete client types from provider constructors Follow the Go idiom "return concrete types, accept interfaces": the provider constructors newOpenAI, newAnthropic, newOpenRouter, newOllama and their *WithTimeout variants now return their concrete *Client value types instead of the Client interface. The provider factories registered in the registry still return Client, so NewFromConfig and the registry keep working unchanged. Updated comments to explain the reasoning, dropped the now-redundant type assertions in tests, and switched the anthropic Streamer-capability tests to assert via an explicit Client interface value. Co-Authored-By: Claude Opus 4.8 --- internal/llm/openai_sse_negative_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/llm/openai_sse_negative_test.go') diff --git a/internal/llm/openai_sse_negative_test.go b/internal/llm/openai_sse_negative_test.go index 7f4f7db..3ef9320 100644 --- a/internal/llm/openai_sse_negative_test.go +++ b/internal/llm/openai_sse_negative_test.go @@ -20,7 +20,7 @@ func TestOpenAI_ChatStream_SSE_MalformedChunk(t *testing.T) { _, _ = io.WriteString(w, "data: [DONE]\n") })) defer srv.Close() - c := newOpenAI(srv.URL, "g", "KEY", f64p(0.2)).(openAIClient) + c := newOpenAI(srv.URL, "g", "KEY", f64p(0.2)) c.httpClient = srv.Client() var got string if err := c.ChatStream(context.Background(), []Message{{Role: "user", Content: "hi"}}, func(s string) { got += s }); err != nil { -- cgit v1.2.3