相关问题
Magisterium AI API 还可以通过 related_questions 字段在响应对象中返回相关问题。该字段是可选的。为了返回相关问题,您必须在请求中将 return_related_questions 参数设置为 true。
python
url = "https://www.magisterium.com/api/v1/chat/completions"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
data = {
"model": "magisterium-1",
"messages": [
{
"role": "user",
"content": "What is the Magisterium?",
}
],
"stream": False,
"return_related_questions": True
}相关问题将作为字符串数组包含在响应对象中。
json
{
"object": "chat.completion",
"related_questions": [
"What is the Magisterium's teaching on faith and morals?",
"What is the Magisterium's teaching on Scripture?",
"What is the Magisterium's teaching on tradition?",
],
// other fields ...
}流式传输
与引用一样,相关问题也仅包含在最后一个数据块中。