From 53e26aab2ca4a02adc78c5d3d03537a85203521d Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Wed, 22 Oct 2025 13:47:36 -0700 Subject: [PATCH] remove slices --- openai/openai.go | 9 --------- openai/openai_test.go | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/openai/openai.go b/openai/openai.go index 8411c1533..ac4775196 100644 --- a/openai/openai.go +++ b/openai/openai.go @@ -225,15 +225,6 @@ func ToUsage(r api.ChatResponse) Usage { } } -// func toolCallId() string { -// const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789" -// b := make([]byte, 8) -// for i := range b { -// b[i] = letterBytes[rand.Intn(len(letterBytes))] -// } -// return "call_" + strings.ToLower(string(b)) -// } - // ToToolCalls converts api.ToolCall to OpenAI ToolCall format func ToToolCalls(tc []api.ToolCall) []ToolCall { toolCalls := make([]ToolCall, len(tc)) diff --git a/openai/openai_test.go b/openai/openai_test.go index b054bdb74..6a42f9154 100644 --- a/openai/openai_test.go +++ b/openai/openai_test.go @@ -7,7 +7,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/ollama/ollama/api" - "golang.org/x/exp/slices" ) const ( @@ -176,7 +175,8 @@ func TestToToolCallsPreservesIDs(t *testing.T) { }, } - toolCalls := slices.Clone(original) + toolCalls := make([]api.ToolCall, len(original)) + copy(toolCalls, original) got := ToToolCalls(toolCalls) if len(got) != len(original) {