Skip to content

Commit b93034c

Browse files
authored
Merge pull request #801 from Aktsvigun/main
Nebius AI Studio Integration added
2 parents ef30a37 + 800d728 commit b93034c

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

src/globals.ts

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const LAMBDA: string = 'lambda';
7676
export const DASHSCOPE: string = 'dashscope';
7777
export const X_AI: string = 'x-ai';
7878
export const SAGEMAKER: string = 'sagemaker';
79+
export const NEBIUS: string = 'nebius';
7980

8081
export const VALID_PROVIDERS = [
8182
ANTHROPIC,
@@ -125,6 +126,7 @@ export const VALID_PROVIDERS = [
125126
DASHSCOPE,
126127
X_AI,
127128
SAGEMAKER,
129+
NEBIUS,
128130
];
129131

130132
export const CONTENT_TYPES = {

src/providers/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { DashScopeConfig } from './dashscope';
5050
import XAIConfig from './x-ai';
5151
import QdrantConfig from './qdrant';
5252
import SagemakerConfig from './sagemaker';
53+
import NebiusConfig from './nebius';
5354

5455
const Providers: { [key: string]: ProviderConfigs } = {
5556
openai: OpenAIConfig,
@@ -100,6 +101,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
100101
'x-ai': XAIConfig,
101102
qdrant: QdrantConfig,
102103
sagemaker: SagemakerConfig,
104+
nebius: NebiusConfig,
103105
};
104106

105107
export default Providers;

src/providers/nebius/api.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ProviderAPIConfig } from '../types';
2+
3+
export const nebiusAPIConfig: ProviderAPIConfig = {
4+
getBaseURL: () => 'https://api.studio.nebius.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 'embed':
14+
return `/embeddings`;
15+
case 'complete':
16+
return '/completions';
17+
default:
18+
return '';
19+
}
20+
},
21+
};

src/providers/nebius/index.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { NEBIUS } from '../../globals';
2+
import {
3+
chatCompleteParams,
4+
embedParams,
5+
completeParams,
6+
responseTransformers,
7+
} from '../open-ai-base';
8+
import { ProviderConfigs } from '../types';
9+
import { nebiusAPIConfig } from './api';
10+
11+
export const NebiusConfig: ProviderConfigs = {
12+
chatComplete: chatCompleteParams([], {
13+
model: 'Qwen/Qwen2.5-72B-Instruct-fast',
14+
}),
15+
embed: embedParams([], { model: 'BAAI/bge-en-icl' }),
16+
complete: completeParams([], { model: 'Qwen/Qwen2.5-72B-Instruct-fast' }),
17+
api: nebiusAPIConfig,
18+
responseTransforms: responseTransformers(NEBIUS, {
19+
chatComplete: true,
20+
embed: true,
21+
complete: true,
22+
}),
23+
};

0 commit comments

Comments
 (0)