added anthropic tool support i think
This commit is contained in:
@@ -98,6 +98,29 @@ func (o Object) GoogleParameters() *genai.Schema {
|
||||
return res
|
||||
}
|
||||
|
||||
func (o Object) AnthropicInputSchema() map[string]any {
|
||||
var properties = map[string]any{}
|
||||
var required []string
|
||||
for k, v := range o.fields {
|
||||
properties[k] = v.AnthropicInputSchema()
|
||||
if v.Required() {
|
||||
required = append(required, k)
|
||||
}
|
||||
}
|
||||
|
||||
var res = map[string]any{
|
||||
"type": "object",
|
||||
"description": o.Description(),
|
||||
"properties": properties,
|
||||
}
|
||||
|
||||
if len(required) > 0 {
|
||||
res["required"] = required
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// FromAny converts the value from any to the correct type, returning the value, and an error if any
|
||||
func (o Object) FromAny(val any) (reflect.Value, error) {
|
||||
// if the value is nil, we can't do anything
|
||||
|
||||
Reference in New Issue
Block a user