Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
henomis committed Sep 10, 2023
1 parent 29f6a9b commit a46764c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions embeddings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ func TestEmbeddingEndpoint(t *testing.T) {
_ = json.NewDecoder(r.Body).Decode(&req)

var resBytes []byte
if req.User == "invalid" {
switch {
case req.User == "invalid":

w.WriteHeader(http.StatusBadRequest)
return
} else if req.EncodingFormat == EmbeddingEncodingFormatBase64 {
case req.EncodingFormat == EmbeddingEncodingFormatBase64:
resBytes, _ = json.Marshal(EmbeddingResponseBase64{Data: sampleBase64Embeddings})
} else {
default:
resBytes, _ = json.Marshal(EmbeddingResponse{Data: sampleEmbeddings})
}
fmt.Fprintln(w, string(resBytes))
Expand Down Expand Up @@ -164,7 +166,7 @@ func TestEmbeddingEndpoint(t *testing.T) {
}

// test failed sendRequest
res, err = client.CreateEmbeddings(context.Background(), EmbeddingRequest{
_, err = client.CreateEmbeddings(context.Background(), EmbeddingRequest{
User: "invalid",
EncodingFormat: EmbeddingEncodingFormatBase64,
})
Expand Down

0 comments on commit a46764c

Please sign in to comment.