mirror of
https://github.com/coaidev/coai.git
synced 2025-05-22 14:30: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 {
|
||||
switch p.Type {
|
||||
switch getType(p) {
|
||||
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":
|
||||
return &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: 0}}
|
||||
case "boolean":
|
||||
|
@ -26,7 +26,7 @@ type ToolProperties map[string]ToolProperty
|
||||
type JsonSchemaType any
|
||||
type JSONSchemaDefinition any
|
||||
type ToolProperty struct {
|
||||
Type *JsonSchemaType `json:"type,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Enum *[]JsonSchemaType `json:"enum,omitempty"`
|
||||
Const *JsonSchemaType `json:"const,omitempty"`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user