<commit_before>package rpc

import (
	"encoding/json"
	"errors"
	"reflect"
)

func (p OutValue) Interface() (ret []interface{}, err error) {
	ret = make([]interface{}, len(p))
	for i := 0; i < len(ret); i++ {
		ret[i] = p[i].Interface()
	}
	err = IsError{p[len(p) - 1].Interface()}.Check()
	ret = ret[:len(ret) - 1]
	return
}

type OutValue []reflect.Value

func (p InValue) Make(fn reflect.Value) (in []reflect.Value, err error) {
	ajust := fn.Type().NumIn() - len(p)
	in = make([]reflect.Value, len(p))
	for i, arg := range p {
		typ := fn.Type().In(i + ajust)
		val := reflect.New(typ)
		err = json.Unmarshal(arg, val.Interface())
		if err != nil {
			return
		}
		in[i] = val.Elem()
	}
	return
}

type InValue [][]byte

func (p ApiFunc) Valid() (err error) {<commit_msg>Added err detail<commit_after>package rpc

import (
	"encoding/json"
	"errors"
	"fmt"
	"reflect"
)

func (p OutValue) Interface() (ret []interface{}, err error) {
	ret = make([]interface{}, len(p))
	for i := 0; i < len(ret); i++ {
		ret[i] = p[i].Interface()
	}
	err = IsError{p[len(p) - 1].Interface()}.Check()
	ret = ret[:len(ret) - 1]
	return
}

type OutValue []reflect.Value

func (p InValue) Make(fn reflect.Value) (in []reflect.Value, err error) {
	ajust := fn.Type().NumIn() - len(p)
	in = make([]reflect.Value, len(p))
	for i, arg := range p {
		typ := fn.Type().In(i + ajust)
		val := reflect.New(typ)
		err = json.Unmarshal(arg, val.Interface())
		if err != nil {
			err = fmt.Errorf(
				"arg #%v(%v) marshal failed: '%v' => %v",
				i, typ.Kind().String(), string(arg), err.Error())
			return
		}
		in[i] = val.Elem()
	}
	return
}

type InValue [][]byte

func (p ApiFunc) Valid() (err error) {
{'fraction_non_alphanumeric': 0.21024419297200714, 'fraction_numerical': 0.00357355568790947, 'mean_word_length': 3.6153846153846154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3489573', 'n_tokens_mistral': 703, 'n_tokens_neox': 668, 'n_words': 173}