Refactor Toolbox handling in Google LLM integration.

Implemented a nil check for Toolbox to prevent potential nil pointer dereferences. Cleaned up and reorganized code for better readability and maintainability while keeping placeholder functionality intact.
This commit is contained in:
Steve Dudenhoeffer 2025-01-22 19:49:37 -05:00
parent 0d70ec46de
commit e7b7aab62e

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/google/generative-ai-go/genai"
"google.golang.org/api/option"
)
@ -31,6 +32,7 @@ func (g google) requestToGoogleRequest(in Request, model *genai.GenerativeModel)
res = append(res, genai.Text(c.Text))
}
if in.Toolbox != nil {
for _, tool := range in.Toolbox.funcs {
panic("google ToolBox is todo" + tool.Name)
@ -43,6 +45,7 @@ func (g google) requestToGoogleRequest(in Request, model *genai.GenerativeModel)
})
*/
}
}
return res
}