Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const SILICONFLOW: string = 'siliconflow';
export const CEREBRAS: string = 'cerebras';
export const INFERENCENET: string = 'inference-net';
export const SAMBANOVA: string = 'sambanova';
export const UPSTAGE: string = 'upstage';

export const VALID_PROVIDERS = [
ANTHROPIC,
Expand Down Expand Up @@ -112,6 +113,7 @@ export const VALID_PROVIDERS = [
CEREBRAS,
INFERENCENET,
SAMBANOVA,
UPSTAGE,
];

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 @@ -42,6 +42,7 @@ import HuggingfaceConfig from './huggingface';
import { cerebrasProviderAPIConfig } from './cerebras';
import { InferenceNetProviderConfigs } from './inference-net';
import SambaNovaConfig from './sambanova';
import { UpstageProviderConfig } from './upstage';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this to UpstageConfig to keep with the convention we've been following above (I can see InferenceNet and cerebras are also named this way, but those have to be changed as well)


const Providers: { [key: string]: ProviderConfigs } = {
openai: OpenAIConfig,
Expand Down Expand Up @@ -85,6 +86,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
cerebras: cerebrasProviderAPIConfig,
'inference-net': InferenceNetProviderConfigs,
sambanova: SambaNovaConfig,
upstage: UpstageProviderConfig,
};

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

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

export const UpstageProviderConfig: ProviderConfigs = {
chatComplete: chatCompleteParams([], { model: 'solar-pro' }),
embed: embedParams([], { model: 'solar-embedding-1-large-query' }),
api: upstageAPIConfig,
responseTransforms: responseTransformers(UPSTAGE, {
chatComplete: true,
embed: true,
}),
};
Loading