Skip to content

Commit

Permalink
fix type warnings during build
Browse files Browse the repository at this point in the history
  • Loading branch information
narengogi committed Jan 17, 2025
1 parent 44fbd01 commit cdea58f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/providers/google-vertex-ai/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Options } from '../../types/requestBody';
import { ProviderAPIConfig } from '../types';
import { endpointStrings, ProviderAPIConfig } from '../types';
import { getModelAndProvider, getAccessToken } from './utils';

const getProjectRoute = (
Expand Down Expand Up @@ -45,7 +45,7 @@ export const GoogleApiConfig: ProviderAPIConfig = {
let mappedFn = fn;
const { model: inputModel, stream } = gatewayRequestBodyJSON;
if (stream) {
mappedFn = `stream-${fn}`;
mappedFn = `stream-${fn}` as endpointStrings;
}

const { provider, model } = getModelAndProvider(inputModel as string);
Expand Down
7 changes: 2 additions & 5 deletions src/providers/google/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ export const GoogleApiConfig: ProviderAPIConfig = {
let mappedFn = fn;
const { model, stream } = gatewayRequestBodyJSON;
const { apiKey } = providerOptions;
if (stream) {
mappedFn = `stream-${fn}`;
if (stream && fn === 'chatComplete') {
return `/models/${model}:streamGenerateContent?key=${apiKey}`;
}
switch (mappedFn) {
case 'chatComplete': {
return `/models/${model}:generateContent?key=${apiKey}`;
}
case 'stream-chatComplete': {
return `/models/${model}:streamGenerateContent?key=${apiKey}`;
}
case 'embed': {
return `/models/${model}:embedContent?key=${apiKey}`;
}
Expand Down
4 changes: 1 addition & 3 deletions src/providers/mistral-ai/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ const MistralAIAPIConfig: ProviderAPIConfig = {
getEndpoint: ({ fn, providerOptions }) => {
let mappedfn = fn;
if (providerOptions.mistralFimCompletion === 'true') {
mappedfn = 'fimComplete';
return '/fim/completions';
}
switch (mappedfn) {
case 'chatComplete':
return '/chat/completions';
case 'embed':
return '/embeddings';
case 'fimComplete':
return '/fim/completions';
default:
return '';
}
Expand Down

0 comments on commit cdea58f

Please sign in to comment.