mirror of
https://github.com/coaidev/coai.git
synced 2025-05-22 22:40:14 +09:00
fix: fix skylark function calling format error
This commit is contained in:
parent
b067d63012
commit
4f4bc1561b
@ -19,10 +19,26 @@ func getFunctionCall(calls *globals.ToolCalls) *api.FunctionCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getType(p globals.ToolProperty) string {
|
||||||
|
if p.Type == nil {
|
||||||
|
return "string"
|
||||||
|
}
|
||||||
|
|
||||||
|
return *p.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
func getDescription(p globals.ToolProperty) string {
|
||||||
|
if p.Description == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return *p.Description
|
||||||
|
}
|
||||||
|
|
||||||
func getValue(p globals.ToolProperty) *structpb.Value {
|
func getValue(p globals.ToolProperty) *structpb.Value {
|
||||||
switch p.Type {
|
switch getType(p) {
|
||||||
case "string", "enum":
|
case "string", "enum":
|
||||||
return &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: p.Description}}
|
return &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: getDescription(p)}}
|
||||||
case "number":
|
case "number":
|
||||||
return &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: 0}}
|
return &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: 0}}
|
||||||
case "boolean":
|
case "boolean":
|
||||||
|
@ -26,7 +26,7 @@ type ToolProperties map[string]ToolProperty
|
|||||||
type JsonSchemaType any
|
type JsonSchemaType any
|
||||||
type JSONSchemaDefinition any
|
type JSONSchemaDefinition any
|
||||||
type ToolProperty struct {
|
type ToolProperty struct {
|
||||||
Type *JsonSchemaType `json:"type,omitempty"`
|
Type *string `json:"type,omitempty"`
|
||||||
Enum *[]JsonSchemaType `json:"enum,omitempty"`
|
Enum *[]JsonSchemaType `json:"enum,omitempty"`
|
||||||
Const *JsonSchemaType `json:"const,omitempty"`
|
Const *JsonSchemaType `json:"const,omitempty"`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user