Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 27 28 | 1x 1x 1x 1x 1x 1x | import type { InternalProviderAPIConfig } from '@shared/types/ai-providers/config';
import { FunctionName } from '@shared/types/api/request';
import type { ChatCompletionRequestBody } from '@shared/types/api/routes/chat-completions-api/request';
export const palmApiConfig: InternalProviderAPIConfig = {
getBaseURL: () => 'https://generativelanguage.googleapis.com/v1beta3',
headers: () => {
return { 'Content-Type': 'application/json' };
},
getEndpoint: ({ saTarget, saRequestData }) => {
const { api_key } = saTarget;
const { model } = saRequestData.requestBody as ChatCompletionRequestBody;
switch (saRequestData.functionName) {
case FunctionName.COMPLETE: {
return `/models/${model}:generateText?key=${api_key}`;
}
case FunctionName.CHAT_COMPLETE: {
return `/models/${model}:generateMessage?key=${api_key}`;
}
case FunctionName.EMBED: {
return `/models/${model}:embedText?key=${api_key}`;
}
default:
return '';
}
},
};
|