相關問題
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 ...
}流式傳輸
像引用一樣,相關問題也僅包含在最後一個區塊中。