Download internal/util/render_test.go from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 537 Bytes
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/util/render_test.go
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/util/render_test.go
-
curl -L -o render_test.go https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/util/render_test.go
537 Bytes
| package util | |
| import "testing" | |
| func TestBuildOpenAIResponseObjectWithText(t *testing.T) { | |
| out := BuildOpenAIResponseObject( | |
| "resp_1", | |
| "gpt-4o", | |
| "prompt", | |
| "reasoning", | |
| "text", | |
| nil, | |
| ) | |
| if out["object"] != "response" { | |
| t.Fatalf("unexpected object: %#v", out["object"]) | |
| } | |
| output, _ := out["output"].([]any) | |
| if len(output) == 0 { | |
| t.Fatalf("expected output entries") | |
| } | |
| first, _ := output[0].(map[string]any) | |
| if first["type"] != "message" { | |
| t.Fatalf("expected first output type message, got %#v", first["type"]) | |
| } | |
| } | |