Skip to content

Commit

Permalink
feat: ✨ add aliases and logit_bias support to providers
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 21, 2024
1 parent fd17d69 commit aa7f334
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
55 changes: 44 additions & 11 deletions docs/src/components/LLMProviderFeatures.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ interface Props {
provider: string
}
const { provider } = Astro.props
const info: Record<string, boolean> & { openaiCompatibility?: string, limitations?: boolean } =
LLMS.providers.find(({ id }) => id === provider) as any
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`)
}
Expand All @@ -17,6 +20,9 @@ const features: Record<string, { name?: string; url?: string }> = {
topP: {
name: "top_p ignored",
},
logitBias: {
name: "logit_bias ignored",
},
logprobs: {
name: "logprobs (and top logprobs) ignored",
},
Expand All @@ -26,31 +32,58 @@ const features: Record<string, { name?: string; url?: string }> = {
tools: {
name: "Tools implemented as fallback tools automatically.",
},
prediction: {
name: "Ignore prediction of output tokens",
},
}
const { openaiCompatibility, limitations, ...rest } = info
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>Limitations</h3>
<h3 id={provider + "-limitations"}>Limitations</h3>
<ul>
{!!limitations && <li>{limitations}</li>}
{!!openaiCompatibility && (
<li>
Uses <a href={openaiCompatibility}>OpenAI compatibility layer</a>
Uses{" "}
<a href={openaiCompatibility}>
OpenAI compatibility layer
</a>
</li>
)}
{Object.keys(features)
.map((id) => ({ id, supported: info[id] }))
.filter(({ supported }) => supported === false)
.map(({ id }) => (
<li>{features[id]?.name || id}</li>
))}
{unsupported.map(({ id }) => (
<li>{features[id]?.name || id}</li>
))}
</ul>
</>
) : null
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/getting-started/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ script({

Check warning on line 984 in docs/src/content/docs/getting-started/configuration.mdx

View workflow job for this annotation

GitHub Actions / build

The tag `<LLMProviderFeatures provider="mistral" />` is repeated. Consider removing the duplicate.
</Steps>

<LLMProviderFeatures provider="mistal" />
<LLMProviderFeatures provider="mistral" />

## Alibaba Cloud <a href="" id="alibaba" />

Expand Down

0 comments on commit aa7f334

Please sign in to comment.