Spaces:
Running
Running
File size: 1,142 Bytes
9e27976 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import { copilotBaseUrl, copilotHeaders } from "~/lib/api-config"
import { HTTPError } from "~/lib/error"
import { state } from "~/lib/state"
export const getModels = async () => {
const response = await fetch(`${copilotBaseUrl(state)}/models`, {
headers: copilotHeaders(state),
})
if (!response.ok) throw new HTTPError("Failed to get models", response)
return (await response.json()) as ModelsResponse
}
export interface ModelsResponse {
data: Array<Model>
object: string
}
interface ModelLimits {
max_context_window_tokens?: number
max_output_tokens?: number
max_prompt_tokens?: number
max_inputs?: number
}
interface ModelSupports {
tool_calls?: boolean
parallel_tool_calls?: boolean
dimensions?: boolean
}
interface ModelCapabilities {
family: string
limits: ModelLimits
object: string
supports: ModelSupports
tokenizer: string
type: string
}
export interface Model {
capabilities: ModelCapabilities
id: string
model_picker_enabled: boolean
name: string
object: string
preview: boolean
vendor: string
version: string
policy?: {
state: string
terms: string
}
}
|