//native
type Vectara = {
apiKey: string
}
/**
* Get a chat
* Get a chat summary to view what started the chat, but not subsequent turns.
*/
export async function main(auth: Vectara, chat_id: string) {
const url = new URL(`https://api.vectara.io/v2/chats/${chat_id}`)
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