File size: 604 Bytes
c7052c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { ProviderAPIConfig } from '../types';

const DEFAULT_COMETAPI_BASE_URL = 'https://api.cometapi.com/v1';

const CometAPIAPIConfig: ProviderAPIConfig = {
  getBaseURL: () => DEFAULT_COMETAPI_BASE_URL,
  headers: ({ providerOptions }) => {
    return {
      Authorization: `Bearer ${providerOptions.apiKey}`,
    };
  },
  getEndpoint: ({ fn }) => {
    switch (fn) {
      case 'chatComplete':
      case 'stream-chatComplete':
        return '/chat/completions';
      case 'embed':
        return '/embeddings';
      default:
        return '';
    }
  },
};

export default CometAPIAPIConfig;