Skip to content

Commit 333a99b

Browse files
authored
Merge branch 'main' into docs
2 parents f7f626f + fdf6722 commit 333a99b

File tree

8 files changed

+63
-9
lines changed

8 files changed

+63
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The AI Gateway's enterprise version offers enterprise-ready capabilities for **o
6767

6868
The enterprise deployment architecture, supported platforms is available here - [**Enterprise Private Cloud Deployments**](https://docs.portkey.ai/docs/product/enterprise-offering/private-cloud-deployments)
6969

70-
<a href="https://app.portkey.ai/signup"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--5-.png" height=50 alt="Book an enterprise AI gateway demo" /></a><br>
70+
<a href="https://portkey.sh/demo-22"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--5-.png" height=50 alt="Book an enterprise AI gateway demo" /></a><br>
7171

7272
<br>
7373

@@ -268,7 +268,7 @@ Make your AI app more <ins>reliable</ins> and <ins>forward compatible</ins>, whi
268268
&nbsp; SOC2, ISO, HIPAA, GDPR Compliances - for best security practices <br>
269269
&nbsp; Professional Support - along with feature prioritization <br>
270270

271-
[Schedule a call to discuss enterprise deployments](https://calendly.com/rohit-portkey/noam)
271+
[Schedule a call to discuss enterprise deployments](https://portkey.sh/demo-22)
272272

273273
<br>
274274

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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ 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+
},
105+
prediction: {
106+
param: 'prediction',
107+
},
90108
};
91109

92110
interface AzureOpenAIChatCompleteResponse extends ChatCompletionResponse {}

src/providers/google-vertex-ai/transformGenerationConfig.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export function transformGenerationConfig(params: Params) {
3535
schema = derefer(schema);
3636
delete schema['$defs'];
3737
}
38+
if (Object.hasOwn(schema, '$schema')) {
39+
delete schema['$schema'];
40+
}
3841
generationConfig['responseSchema'] = schema;
3942
}
4043

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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ 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+
},
114+
prediction: {
115+
param: 'prediction',
116+
},
102117
};
103118

104119
export interface OpenAIChatCompleteResponse extends ChatCompletionResponse {

src/types/requestBody.ts

Lines changed: 19 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,24 @@ 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;
339+
prediction?: {
340+
type: string;
341+
content:
342+
| {
343+
type: string;
344+
text: string;
345+
}[]
346+
| string;
347+
};
329348
// Google Vertex AI specific
330349
safety_settings?: any;
331350
// Anthropic specific

0 commit comments

Comments
 (0)