diff --git a/chat.go b/chat.go index e2d05e8..5af7f11 100644 --- a/chat.go +++ b/chat.go @@ -404,7 +404,7 @@ func HandleChat(w http.ResponseWriter, r *http.Request) { func RunCompletion(ctx context.Context, response *Stream, request *openrouter.ChatCompletionRequest) (*ToolCall, string, error) { stream, err := OpenRouterStartStream(ctx, *request) if err != nil { - return nil, "", err + return nil, "", fmt.Errorf("stream.start: %v", err) } defer stream.Close() @@ -426,7 +426,7 @@ func RunCompletion(ctx context.Context, response *Stream, request *openrouter.Ch break } - return nil, "", err + return nil, "", fmt.Errorf("stream.receive: %v", err) } if id == "" { diff --git a/search.go b/search.go index 966a25f..623cbaf 100644 --- a/search.go +++ b/search.go @@ -207,7 +207,7 @@ func HandleGitHubRepositoryTool(ctx context.Context, tool *ToolCall) error { func ParseAndUpdateArgs(tool *ToolCall, arguments any) error { err := json.Unmarshal([]byte(tool.Args), arguments) if err != nil { - return err + return fmt.Errorf("json.unmarshal: %v", err) } buf := GetFreeBuffer() @@ -218,7 +218,7 @@ func ParseAndUpdateArgs(tool *ToolCall, arguments any) error { err = enc.Encode(arguments) if err != nil { - return err + return fmt.Errorf("json.marshal: %v", err) } tool.Args = buf.String()