LLMProviderFeatures.astro•2.47 kB
---
import LLMS from "../../../packages/core/src/llms.json"
interface Props {
provider: string
}
const { provider } = Astro.props
const info: Record<string, boolean> & {
openaiCompatibility?: string
limitations?: boolean
aliases?: Record<string, string>
} = LLMS.providers.find(({ id }) => id === provider) as any
if (!info) {
throw new Error(`Provider ${provider} not found`)
}
const features: Record<string, { name?: string; url?: string }> = {
seed: {
name: "Seed ignored",
},
topP: {
name: "top_p ignored",
},
logitBias: {
name: "logit_bias ignored",
},
logprobs: {
name: "logprobs (and top logprobs) ignored",
},
topLogrobs: {
name: "Top logprobs ignored",
},
tools: {
name: "Tools implemented as fallback tools automatically.",
},
prediction: {
name: "Ignore prediction of output tokens",
},
}
const { openaiCompatibility, limitations, aliases, bearerToken, ...rest } = info
const unsupported = Object.keys(rest)
.sort()
.map((id) => ({ id, supported: info[id] }))
.filter(({ supported }) => supported === false)
---
{
aliases && (
<>
<h3 id={provider + "-aliases"}>Aliases</h3>
<p>
The following model aliases are attempted by default in
GenAIScript.
</p>
<table>
<tr>
<th>Alias</th>
<th>Model identifier</th>
</tr>
{Object.entries(aliases).map(([key, value]) => (
<tr>
<td>{key}</td>
<td>{value}</td>
</tr>
))}
</table>
</>
)
}
{
openaiCompatibility || limitations || unsupported?.length > 0 ? (
<>
<h3 id={provider + "-limitations"}>Limitations</h3>
<ul>
{!!limitations && <li>{limitations}</li>}
{!!openaiCompatibility && (
<li>
Uses{" "}
<a href={openaiCompatibility}>
OpenAI compatibility layer
</a>
</li>
)}
{unsupported.map(({ id }) => (
<li>{features[id]?.name || id}</li>
))}
</ul>
</>
) : null
}