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:
parent
0d70ec46de
commit
e7b7aab62e
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/generative-ai-go/genai"
|
"github.com/google/generative-ai-go/genai"
|
||||||
"google.golang.org/api/option"
|
"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))
|
res = append(res, genai.Text(c.Text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if in.Toolbox != nil {
|
||||||
for _, tool := range in.Toolbox.funcs {
|
for _, tool := range in.Toolbox.funcs {
|
||||||
panic("google ToolBox is todo" + tool.Name)
|
panic("google ToolBox is todo" + tool.Name)
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ func (g google) requestToGoogleRequest(in Request, model *genai.GenerativeModel)
|
|||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user