Add support for integers and tool configuration in schema handling
This update introduces support for `jsonschema.Integer` types and updates the logic to handle nested items in schemas. Added a new default error log for unknown types using `slog.Error`. Also, integrated tool configuration with a `FunctionCallingConfig` when `dontRequireTool` is false.
This commit is contained in:
@@ -2,6 +2,7 @@ package schema
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/openai/openai-go"
|
||||
"reflect"
|
||||
|
||||
"github.com/sashabaranov/go-openai/jsonschema"
|
||||
@@ -18,6 +19,14 @@ func (a array) SchemaType() jsonschema.DataType {
|
||||
return jsonschema.Array
|
||||
}
|
||||
|
||||
func (a array) FunctionParameters() openai.FunctionParameters {
|
||||
return openai.FunctionParameters{
|
||||
"type": "array",
|
||||
"description": a.Description(),
|
||||
"items": a.items.FunctionParameters(),
|
||||
}
|
||||
}
|
||||
|
||||
func (a array) Definition() jsonschema.Definition {
|
||||
def := a.basic.Definition()
|
||||
def.Type = jsonschema.Array
|
||||
|
Reference in New Issue
Block a user