Skip to content

Commit

Permalink
Merge pull request #801 from Aktsvigun/main
Browse files Browse the repository at this point in the history
Nebius AI Studio Integration added
  • Loading branch information
VisargD authored Dec 11, 2024
2 parents ef30a37 + 800d728 commit b93034c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const LAMBDA: string = 'lambda';
export const DASHSCOPE: string = 'dashscope';
export const X_AI: string = 'x-ai';
export const SAGEMAKER: string = 'sagemaker';
export const NEBIUS: string = 'nebius';

export const VALID_PROVIDERS = [
ANTHROPIC,
Expand Down Expand Up @@ -125,6 +126,7 @@ export const VALID_PROVIDERS = [
DASHSCOPE,
X_AI,
SAGEMAKER,
NEBIUS,
];

export const CONTENT_TYPES = {
Expand Down
2 changes: 2 additions & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { DashScopeConfig } from './dashscope';
import XAIConfig from './x-ai';
import QdrantConfig from './qdrant';
import SagemakerConfig from './sagemaker';
import NebiusConfig from './nebius';

const Providers: { [key: string]: ProviderConfigs } = {
openai: OpenAIConfig,
Expand Down Expand Up @@ -100,6 +101,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
'x-ai': XAIConfig,
qdrant: QdrantConfig,
sagemaker: SagemakerConfig,
nebius: NebiusConfig,
};

export default Providers;
21 changes: 21 additions & 0 deletions src/providers/nebius/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ProviderAPIConfig } from '../types';

export const nebiusAPIConfig: ProviderAPIConfig = {
getBaseURL: () => 'https://api.studio.nebius.ai/v1',
headers({ providerOptions }) {
const { apiKey } = providerOptions;
return { Authorization: `Bearer ${apiKey}` };
},
getEndpoint({ fn }) {
switch (fn) {
case 'chatComplete':
return `/chat/completions`;
case 'embed':
return `/embeddings`;
case 'complete':
return '/completions';
default:
return '';
}
},
};
23 changes: 23 additions & 0 deletions src/providers/nebius/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { NEBIUS } from '../../globals';
import {
chatCompleteParams,
embedParams,
completeParams,
responseTransformers,
} from '../open-ai-base';
import { ProviderConfigs } from '../types';
import { nebiusAPIConfig } from './api';

export const NebiusConfig: ProviderConfigs = {
chatComplete: chatCompleteParams([], {
model: 'Qwen/Qwen2.5-72B-Instruct-fast',
}),
embed: embedParams([], { model: 'BAAI/bge-en-icl' }),
complete: completeParams([], { model: 'Qwen/Qwen2.5-72B-Instruct-fast' }),
api: nebiusAPIConfig,
responseTransforms: responseTransformers(NEBIUS, {
chatComplete: true,
embed: true,
complete: true,
}),
};

0 comments on commit b93034c

Please sign in to comment.