Skip to content

Commit aa7bc42

Browse files
authored
Merge pull request #1138 from DarinVerheijke/featherless-provider
add featherless provider (access to 7900+ open source models)
2 parents 015c82b + a96a985 commit aa7bc42

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

src/globals.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export const LEPTON: string = 'lepton';
9595
export const KLUSTER_AI: string = 'kluster-ai';
9696
export const NSCALE: string = 'nscale';
9797
export const HYPERBOLIC: string = 'hyperbolic';
98+
export const FEATHERLESS_AI: string = 'featherless-ai';
9899

99100
export const VALID_PROVIDERS = [
100101
ANTHROPIC,
@@ -155,6 +156,7 @@ export const VALID_PROVIDERS = [
155156
KLUSTER_AI,
156157
NSCALE,
157158
HYPERBOLIC,
159+
FEATHERLESS_AI,
158160
];
159161

160162
export const CONTENT_TYPES = {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ProviderAPIConfig } from '../types';
2+
3+
export const featherlessAIAPIConfig: ProviderAPIConfig = {
4+
getBaseURL: () => 'https://api.featherless.ai/v1',
5+
headers({ providerOptions }) {
6+
const { apiKey } = providerOptions;
7+
return { Authorization: `Bearer ${apiKey}` };
8+
},
9+
getEndpoint({ fn }) {
10+
switch (fn) {
11+
case 'chatComplete':
12+
return `/chat/completions`;
13+
case 'complete':
14+
return '/completions';
15+
default:
16+
return '';
17+
}
18+
},
19+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { FEATHERLESS_AI } from '../../globals';
2+
import {
3+
chatCompleteParams,
4+
completeParams,
5+
responseTransformers,
6+
} from '../open-ai-base';
7+
import { ProviderConfigs } from '../types';
8+
import { featherlessAIAPIConfig } from './api';
9+
10+
export const FeatherlessAIConfig: ProviderConfigs = {
11+
chatComplete: chatCompleteParams([], {
12+
model: 'mistralai/Magistral-Small-2506',
13+
}),
14+
complete: completeParams([], { model: 'mistralai/Magistral-Small-2506' }),
15+
api: featherlessAIAPIConfig,
16+
responseTransforms: responseTransformers(FEATHERLESS_AI, {
17+
chatComplete: true,
18+
complete: true,
19+
}),
20+
};

src/providers/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import LeptonConfig from './lepton';
5959
import KlusterAIConfig from './kluster-ai';
6060
import NscaleConfig from './nscale';
6161
import HyperbolicConfig from './hyperbolic';
62+
import { FeatherlessAIConfig } from './featherless-ai';
6263

6364
const Providers: { [key: string]: ProviderConfigs } = {
6465
openai: OpenAIConfig,
@@ -118,6 +119,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
118119
'kluster-ai': KlusterAIConfig,
119120
nscale: NscaleConfig,
120121
hyperbolic: HyperbolicConfig,
122+
'featherless-ai': FeatherlessAIConfig,
121123
};
122124

123125
export default Providers;

0 commit comments

Comments
 (0)