Fix unmarshalling issues and adjust logging for debugging
Modify `FunctionCall` struct to handle arguments as strings. Add debugging logs to facilitate error tracing and improve JSON unmarshalling in various functions.
This commit is contained in:
@@ -2,6 +2,7 @@ package go_llm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/google/generative-ai-go/genai"
|
||||
"google.golang.org/api/option"
|
||||
@@ -63,11 +64,17 @@ func (g google) responseToLLMResponse(in *genai.GenerateContentResponse) (Respon
|
||||
choice := ResponseChoice{}
|
||||
|
||||
choice.Content = v.Name
|
||||
b, e := json.Marshal(v.Args)
|
||||
|
||||
if e != nil {
|
||||
return Response{}, fmt.Errorf("error marshalling args: %w", e)
|
||||
}
|
||||
|
||||
call := ToolCall{
|
||||
ID: v.Name,
|
||||
FunctionCall: FunctionCall{
|
||||
Name: v.Name,
|
||||
Arguments: v.Args,
|
||||
Arguments: string(b),
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user