//native
type Vectara = {
apiKey: string
}
/**
* List turns in a chat
* List all turns in a chat to see all message and response pairs that make up the dialog.
*/
export async function main(auth: Vectara, chat_id: string) {
const url = new URL(`https://api.vectara.io/v2/chats/${chat_id}/turns`)
const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 581 days ago