MCPcopy
hub / github.com/mudler/LocalAI / TestPredict_LegacyWrapper_OpenAI

Function TestPredict_LegacyWrapper_OpenAI

backend/go/cloud-proxy/toolcalls_test.go:221–232  ·  view source on GitHub ↗

Sanity: the legacy Predict() (string, error) signature still works — it delegates to PredictRich and extracts Message.

(t *testing.T)

Source from the content-addressed store, hash-verified

219// Sanity: the legacy Predict() (string, error) signature still works
220// — it delegates to PredictRich and extracts Message.
221func TestPredict_LegacyWrapper_OpenAI(t *testing.T) {
222 srv, _ := fakeOpenAIUpstream(t, func(_ openAIRequest) (int, string, string) {
223 return 200, `{"choices":[{"message":{"role":"assistant","content":"hello"}}]}`, "application/json"
224 })
225 defer srv.Close()
226 g := NewWithT(t)
227 cp := newTranslateCloudProxy(t, srv.URL)
228
229 got, err := cp.Predict(&pb.PredictOptions{Messages: []*pb.Message{{Role: "user", Content: "hi"}}})
230 g.Expect(err).NotTo(HaveOccurred())
231 g.Expect(got).To(Equal("hello"))
232}

Callers

nothing calls this directly

Calls 4

fakeOpenAIUpstreamFunction · 0.85
newTranslateCloudProxyFunction · 0.85
CloseMethod · 0.65
PredictMethod · 0.65

Tested by

no test coverage detected