Skip to content

Commit 3a4fe92

Browse files
authored
Merge branch 'main' into fix/vertex-zod
2 parents b33243f + e5031ec commit 3a4fe92

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed
Lines changed: 0 additions & 1 deletion
This file was deleted.

src/handlers/handlerUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ export async function tryPost(
642642

643643
// Prerequest validator (For virtual key budgets)
644644
const preRequestValidator = c.get('preRequestValidator');
645-
let preRequestValidatorResponse = preRequestValidator
646-
? await preRequestValidator(env(c), providerOption, requestHeaders)
645+
const preRequestValidatorResponse = preRequestValidator
646+
? await preRequestValidator(c, providerOption, requestHeaders, params)
647647
: undefined;
648648
if (!!preRequestValidatorResponse) {
649649
return createResponse(preRequestValidatorResponse, undefined, false);

src/providers/azure-openai/chatComplete.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ export const AzureOpenAIChatCompleteConfig: ProviderConfig = {
8787
response_format: {
8888
param: 'response_format',
8989
},
90+
store: {
91+
param: 'store',
92+
},
93+
metadata: {
94+
param: 'metadata',
95+
},
96+
modalities: {
97+
param: 'modalities',
98+
},
99+
audio: {
100+
param: 'audio',
101+
},
102+
seed: {
103+
param: 'seed',
104+
},
90105
};
91106

92107
interface AzureOpenAIChatCompleteResponse extends ChatCompletionResponse {}

src/providers/google/chatComplete.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export const GoogleChatCompleteResponseTransform: (
440440
model: 'Unknown',
441441
provider: 'google',
442442
choices:
443-
response.candidates?.map((generation) => {
443+
response.candidates?.map((generation, idx) => {
444444
let message: Message = { role: 'assistant', content: '' };
445445
if (generation.content?.parts[0]?.text) {
446446
message = {
@@ -466,7 +466,7 @@ export const GoogleChatCompleteResponseTransform: (
466466
}
467467
return {
468468
message: message,
469-
index: generation.index,
469+
index: generation.index ?? idx,
470470
finish_reason: generation.finishReason,
471471
};
472472
}) ?? [],
@@ -512,7 +512,7 @@ export const GoogleChatCompleteStreamChunkTransform: (
512512
model: '',
513513
provider: 'google',
514514
choices:
515-
parsedChunk.candidates?.map((generation) => {
515+
parsedChunk.candidates?.map((generation, index) => {
516516
let message: Message = { role: 'assistant', content: '' };
517517
if (generation.content.parts[0]?.text) {
518518
message = {
@@ -539,7 +539,7 @@ export const GoogleChatCompleteStreamChunkTransform: (
539539
}
540540
return {
541541
delta: message,
542-
index: generation.index,
542+
index: generation.index ?? index,
543543
finish_reason: generation.finishReason,
544544
};
545545
}) ?? [],

src/providers/openai/chatComplete.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ export const OpenAIChatCompleteConfig: ProviderConfig = {
9999
max_completion_tokens: {
100100
param: 'max_completion_tokens',
101101
},
102+
store: {
103+
param: 'store',
104+
},
105+
metadata: {
106+
param: 'metadata',
107+
},
108+
modalities: {
109+
param: 'modalities',
110+
},
111+
audio: {
112+
param: 'audio',
113+
},
102114
};
103115

104116
export interface OpenAIChatCompleteResponse extends ChatCompletionResponse {

src/types/requestBody.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export interface Params {
310310
n?: number;
311311
stream?: boolean;
312312
logprobs?: number;
313+
top_logprobs?: boolean;
313314
echo?: boolean;
314315
stop?: string | string[];
315316
presence_penalty?: number;
@@ -326,6 +327,15 @@ export interface Params {
326327
type: 'json_object' | 'text' | 'json_schema';
327328
json_schema?: any;
328329
};
330+
seed?: number;
331+
store?: boolean;
332+
metadata?: object;
333+
modalities?: string[];
334+
audio?: {
335+
voice: string;
336+
format: string;
337+
};
338+
service_tier?: string;
329339
// Google Vertex AI specific
330340
safety_settings?: any;
331341
// Anthropic specific

0 commit comments

Comments
 (0)