Sanity: the legacy Predict() (string, error) signature still works — it delegates to PredictRich and extracts Message.
(t *testing.T)
| 219 | // Sanity: the legacy Predict() (string, error) signature still works |
| 220 | // — it delegates to PredictRich and extracts Message. |
| 221 | func 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 | } |
nothing calls this directly
no test coverage detected