-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
首先要函数式调用,使用ChatErnieRequest类
public class ChatErnieRequest extends ChatBaseRequest {
private static final Logger log = LoggerFactory.getLogger(ChatErnieRequest.class);
private Float temperature;
private Float topP;
private Float penaltyScore;
private List<FunctionInfo> functions;
......
}
FunctionInfo结构如下:
public class FunctionInfo {
private String name;
private String description;
private FunctionParameters parameters;
private FunctionResponses responses;
private List<Example> examples;
}
官网的结构如下:
{
"messages":[
{
"role":"user",
"content":"上海市今天的天气"
}
],
"functions":[
{
"name":"get_current_weather",
"description":"获得指定地点的天气",
"parameters":{
"type":"object",
"properties":Object{...},
"required":["location"]
}
},
Object{...}
],
"stream":true,
"tool_choice":Object{...}
}
对应到parameters字段的FunctionParameters类,结构是:
public class FunctionParameters {
private String name;
private String description;
private Map<String, Map<String, String>> properties;
}
官网上的parameters参数中有一个type字段,值是object,首先是type字段,应该是默认给了object,那required字段怎么填写呢?
请问是遗漏了还是有其他的调用方式?谢谢
另外能否在示例中写一下函数式调用的demo,多谢大佬。