//native
type Vectara = {
apiKey: string
}
/**
* List LLMs
* List LLMs that can be used with query and chat endpoints. The LLM is not directly specified in a query,
but instead a `generation_preset_name` is used. The `generation_preset_name` property in generation parameters
can be found as the `name` property on the Generations Presets retrieved from `/v2/generation_presets`.
*/
export async function main(
auth: Vectara,
filter: string | undefined,
limit: string | undefined,
page_key: string | undefined
) {
const url = new URL(`https://api.vectara.io/v2/llms`)
for (const [k, v] of [
['filter', filter],
['limit', limit],
['page_key', page_key]
]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
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