Skip to content

Commit 3e0f0a2

Browse files
committed
fixes huggingface test cases
1 parent 85172bf commit 3e0f0a2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

core/providers/huggingface/huggingface_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestHuggingface(t *testing.T) {
2323

2424
testConfig := llmtests.ComprehensiveTestConfig{
2525
Provider: schemas.HuggingFace,
26-
ChatModel: "sambanova/meta-llama/Llama-3.1-8B-Instruct",
26+
ChatModel: "groq/meta-llama/Llama-3.3-70B-Instruct",
2727
VisionModel: "cohere/CohereLabs/aya-vision-32b",
2828
EmbeddingModel: "sambanova/intfloat/e5-mistral-7b-instruct",
2929
TranscriptionModel: "fal-ai/openai/whisper-large-v3",

core/providers/utils/utils.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,20 @@ func CheckOperationAllowed(defaultProvider schemas.ModelProvider, config *schema
727727
}
728728

729729
// CheckAndDecodeBody checks the content encoding and decodes the body accordingly.
730+
// It returns a copy of the body to avoid race conditions when the response is released
731+
// back to fasthttp's buffer pool.
730732
func CheckAndDecodeBody(resp *fasthttp.Response) ([]byte, error) {
731733
contentEncoding := strings.ToLower(strings.TrimSpace(string(resp.Header.Peek("Content-Encoding"))))
732734
switch contentEncoding {
733735
case "gzip":
736+
// BodyGunzip already returns a new slice, so it's safe
734737
return resp.BodyGunzip()
735738
default:
736-
return resp.Body(), nil
739+
// Copy the body to avoid race conditions when response is released back to pool
740+
body := resp.Body()
741+
result := make([]byte, len(body))
742+
copy(result, body)
743+
return result, nil
737744
}
738745
}
739746

0 commit comments

Comments
 (0)