Skip to content

Commit 4016b8b

Browse files
diff 2
1 parent e9df40e commit 4016b8b

File tree

7 files changed

+49
-54
lines changed

7 files changed

+49
-54
lines changed

integrations/llms/vertex-ai/batches.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from portkey_ai import Portkey
1818
# Initialize the Portkey client
1919
portkey = Portkey(
2020
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
21-
provider="@VERTEX_PROVIDER", # Add your Vertex virtual key
21+
provider="@VERTEX_PROVIDER",
2222
vertex_storage_bucket_name="your_bucket_name", # Specify the GCS bucket name
2323
provider_file_name="your_file_name.jsonl", # Specify the file name in GCS
2424
provider_model="gemini-1.5-flash-001" # Specify the model to use
@@ -41,7 +41,7 @@ import * as fs from 'fs';
4141
// Initialize the Portkey client
4242
const portkey = Portkey({
4343
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
44-
provider:"@VERTEX_PROVIDER", // Add your Vertex virtual key
44+
provider:"@VERTEX_PROVIDER",
4545
vertexStorageBucketName: "your_bucket_name", // Specify the GCS bucket name
4646
providerFileName: "your_file_name.jsonl", // Specify the file name in GCS
4747
providerModel: "gemini-1.5-flash-001" // Specify the model to use
@@ -137,7 +137,7 @@ from portkey_ai import Portkey
137137
# Initialize the Portkey client
138138
portkey = Portkey(
139139
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
140-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
140+
provider="@VERTEX_PROVIDER"
141141
)
142142

143143
# Create a batch inference job
@@ -158,7 +158,7 @@ import { Portkey } from "portkey-ai";
158158
// Initialize the Portkey client
159159
const portkey = Portkey({
160160
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
161-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
161+
provider:"@VERTEX_PROVIDER"
162162
});
163163

164164
(async () => {
@@ -248,7 +248,7 @@ from portkey_ai import Portkey
248248
# Initialize the Portkey client
249249
portkey = Portkey(
250250
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
251-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
251+
provider="@VERTEX_PROVIDER"
252252
)
253253

254254
# List all batch jobs
@@ -266,7 +266,7 @@ import { Portkey } from "portkey-ai";
266266
// Initialize the Portkey client
267267
const portkey = Portkey({
268268
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
269-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
269+
provider:"@VERTEX_PROVIDER"
270270
});
271271

272272
(async () => {
@@ -346,7 +346,7 @@ from portkey_ai import Portkey
346346
# Initialize the Portkey client
347347
portkey = Portkey(
348348
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
349-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
349+
provider="@VERTEX_PROVIDER"
350350
)
351351

352352
# Retrieve a specific batch job
@@ -364,7 +364,7 @@ import { Portkey } from "portkey-ai";
364364
// Initialize the Portkey client
365365
const portkey = Portkey({
366366
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
367-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
367+
provider:"@VERTEX_PROVIDER"
368368
});
369369

370370
(async () => {

integrations/llms/vertex-ai/files.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from portkey_ai import Portkey
1515
# Initialize the Portkey client
1616
portkey = Portkey(
1717
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
18-
provider="@VERTEX_PROVIDER", # Add your Vertex virtual key
18+
provider="@VERTEX_PROVIDER",
1919
vertex_storage_bucket_name="your_bucket_name", # Specify the GCS bucket name
2020
provider_file_name="your_file_name.jsonl", # Specify the file name in GCS
2121
provider_model="gemini-1.5-flash-001" # Specify the model to use
@@ -37,7 +37,7 @@ import * as fs from 'fs';
3737
// Initialize the Portkey client
3838
const portkey = Portkey({
3939
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
40-
provider:"@VERTEX_PROVIDER", // Add your Vertex virtual key
40+
provider:"@VERTEX_PROVIDER",
4141
vertexStorageBucketName: "your_bucket_name", // Specify the GCS bucket name
4242
providerFileName: "your_file_name.jsonl", // Specify the file name in GCS
4343
providerModel: "gemini-1.5-flash-001" // Specify the model to use
@@ -135,7 +135,7 @@ from portkey_ai import Portkey
135135
# Initialize the Portkey client
136136
portkey = Portkey(
137137
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
138-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
138+
provider="@VERTEX_PROVIDER"
139139
)
140140

141141
file = portkey.files.retrieve(file_id="file_id")
@@ -150,7 +150,7 @@ import { Portkey } from 'portkey-ai';
150150
// Initialize the Portkey client
151151
const portkey = Portkey({
152152
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
153-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
153+
provider:"@VERTEX_PROVIDER"
154154
});
155155

156156
const getFile = async () => {
@@ -224,7 +224,7 @@ from portkey_ai import Portkey
224224
# Initialize the Portkey client
225225
portkey = Portkey(
226226
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
227-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
227+
provider="@VERTEX_PROVIDER"
228228
)
229229

230230
file_content = portkey.files.content(file_id="file_id")
@@ -239,7 +239,7 @@ import { Portkey } from 'portkey-ai';
239239
// Initialize the Portkey client
240240
const portkey = Portkey({
241241
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
242-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
242+
provider:"@VERTEX_PROVIDER"
243243
});
244244

245245
const getFileContent = async () => {

integrations/llms/vertex-ai/fine-tuning.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ from portkey_ai import Portkey
1313
# Initialize the Portkey client
1414
portkey = Portkey(
1515
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
16-
provider="@VERTEX_PROVIDER", # Add your Vertex virtual key
16+
provider="@VERTEX_PROVIDER",
1717
vertex_storage_bucket_name="your_bucket_name", # Specify the GCS bucket name
1818
provider_file_name="your_file_name.jsonl", # Specify the file name in GCS
1919
provider_model="gemini-1.5-flash-001" # Specify the model to fine-tune
@@ -36,7 +36,7 @@ import * as fs from 'fs';
3636
// Initialize the Portkey client
3737
const portkey = Portkey({
3838
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
39-
provider:"@VERTEX_PROVIDER", // Add your Vertex virtual key
39+
provider:"@VERTEX_PROVIDER",
4040
vertexStorageBucketName: "your_bucket_name", // Specify the GCS bucket name
4141
providerFileName: "your_file_name.jsonl", // Specify the file name in GCS
4242
providerModel: "gemini-1.5-flash-001" // Specify the model to fine-tune
@@ -132,7 +132,7 @@ from portkey_ai import Portkey
132132
# Initialize the Portkey client
133133
portkey = Portkey(
134134
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
135-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
135+
provider="@VERTEX_PROVIDER"
136136
)
137137

138138
# Create a fine-tuning job
@@ -155,7 +155,7 @@ import { Portkey } from "portkey-ai";
155155
// Initialize the Portkey client
156156
const portkey = Portkey({
157157
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
158-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
158+
provider:"@VERTEX_PROVIDER"
159159
});
160160

161161
(async () => {
@@ -251,7 +251,7 @@ from portkey_ai import Portkey
251251
# Initialize the Portkey client
252252
portkey = Portkey(
253253
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
254-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
254+
provider="@VERTEX_PROVIDER"
255255
)
256256

257257
# List all fine-tuning jobs
@@ -269,7 +269,7 @@ import { Portkey } from "portkey-ai";
269269
// Initialize the Portkey client
270270
const portkey = Portkey({
271271
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
272-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
272+
provider:"@VERTEX_PROVIDER"
273273
});
274274

275275
(async () => {
@@ -347,7 +347,7 @@ from portkey_ai import Portkey
347347
# Initialize the Portkey client
348348
portkey = Portkey(
349349
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
350-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
350+
provider="@VERTEX_PROVIDER"
351351
)
352352

353353
# Retrieve a specific fine-tuning job
@@ -365,7 +365,7 @@ import { Portkey } from "portkey-ai";
365365
// Initialize the Portkey client
366366
const portkey = Portkey({
367367
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
368-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
368+
provider:"@VERTEX_PROVIDER"
369369
});
370370

371371
(async () => {
@@ -443,7 +443,7 @@ from portkey_ai import Portkey
443443
# Initialize the Portkey client
444444
portkey = Portkey(
445445
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
446-
provider="@VERTEX_PROVIDER" # Add your Vertex virtual key
446+
provider="@VERTEX_PROVIDER"
447447
)
448448

449449
# Cancel a fine-tuning job
@@ -461,7 +461,7 @@ import { Portkey } from "portkey-ai";
461461
// Initialize the Portkey client
462462
const portkey = Portkey({
463463
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
464-
provider:"@VERTEX_PROVIDER" // Add your Vertex virtual key
464+
provider:"@VERTEX_PROVIDER"
465465
});
466466

467467
(async () => {

product/ai-gateway/request-timeouts.mdx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ Set request timeout while instantiating your Portkey client or if you're using t
2626
```js
2727
import Portkey from 'portkey-ai';
2828

29-
// Construct a client with a virtual key
3029
const portkey = new Portkey({
3130
apiKey: "PORTKEY_API_KEY",
32-
provider:"@PROVIDER",
3331
requestTimeout: 3000
3432
})
3533

3634
const chatCompletion = await portkey.chat.completions.create({
3735
messages: [{ role: 'user', content: 'Say this is a test' }],
38-
model: 'gpt-4o-mini',
36+
model: '@openai/gpt-4o-mini',
3937
});
4038

4139
console.log(chatCompletion.choices);
@@ -46,16 +44,14 @@ console.log(chatCompletion.choices);
4644
```py
4745
from portkey_ai import Portkey
4846

49-
# Construct a client with a virtual key
5047
portkey = Portkey(
5148
api_key="PORTKEY_API_KEY",
52-
provider="@PROVIDER",
5349
request_timeout=3000
5450
)
5551

5652
completion = portkey.chat.completions.create(
5753
messages = [{ "role": 'user', "content": 'Say this is a test' }],
58-
model = 'gpt-4o-mini'
54+
model = '@openai/gpt-4o-mini'
5955
)
6056
```
6157
</Tab>
@@ -65,10 +61,9 @@ completion = portkey.chat.completions.create(
6561
curl "https://api.portkey.ai/v1/chat/completions" \
6662
-H "Content-Type: application/json" \
6763
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
68-
-H "x-portkey-provider: openai-virtual-key" \
6964
-H "x-portkey-request-timeout:5000" \
7065
-d '{
71-
"model": "gpt-4o-mini",
66+
"model": "@openai/gpt-4o-mini",
7267
"messages": [{"role": "user", "content": "Hello!"}]
7368
}'
7469
```
@@ -93,8 +88,8 @@ For a 10-second timeout, it will be:
9388
"strategy": { "mode": "fallback" },
9489
"request_timeout": 10000,
9590
"targets": [
96-
{ "provider":"@open-ai-xxx" },
97-
{ "provider":"@azure-open-ai-xxx" }
91+
{ "provider":"@openai" },
92+
{ "provider":"@azure-openai" }
9893
]
9994
}
10095
```
@@ -107,8 +102,8 @@ Here, the request timeout of 10 seconds will be applied to \* **all**\* the targ
107102
{
108103
"strategy": { "mode": "fallback" },
109104
"targets": [
110-
{ "provider":"@open-ai-xxx", "request_timeout": 10000, },
111-
{ "provider":"@azure-open-ai-xxx", "request_timeout": 2000,}
105+
{ "provider":"@openai", "request_timeout": 10000, },
106+
{ "provider":"@azure-openai", "request_timeout": 2000,}
112107
]
113108
}
114109
```
@@ -132,17 +127,17 @@ Nested target objects inherit the top-level timeout, with the option to override
132127
"request_timeout": 5000,
133128
"targets": [
134129
{
135-
"provider:"@open-ai-1-1"
130+
"provider:"@openai"
136131
},
137132
{
138-
"provider":"@open-ai-1-2",
133+
"provider":"@azure-openai",
139134
"request_timeout": 10000
140135
}
141136
],
142137
"weight": 1
143138
},
144139
{
145-
"provider":"@azure-open-ai-1",
140+
"provider":"@azure-openai",
146141
"weight": 1
147142
}
148143
]
@@ -151,9 +146,9 @@ Nested target objects inherit the top-level timeout, with the option to override
151146

152147
1. We've set a global timeout of **2s** at line #3
153148
2. The first target has a nested fallback strategy, with a top level request timeout of **5s** at line #7
154-
3. The first virtual key (at line #10), the **target-level** timeout of **5s** will be applied
155-
4. For the second virtual key (i.e. `open-ai-1-2`), there is a timeout override, set at **10s**, which will be applied only to this target
156-
5. For the last target (i.e. virtual key `azure-open-ai-1`), the top strategy-level timeout of **2s** will be applied
149+
3. The first provider (at line #10), the **target-level** timeout of **5s** will be applied
150+
4. For the second provider (i.e. `azure-openai`), there is a timeout override, set at **10s**, which will be applied only to this target
151+
5. For the last provider (i.e. provider `azure-openai`), the top strategy-level timeout of **2s** will be applied
157152

158153
## Handling Request Timeouts
159154

@@ -168,8 +163,8 @@ Portkey issues a standard **408 error** for timed-out requests. You can leverage
168163
"on_status_codes": [408]
169164
},
170165
"targets": [
171-
{ "provider":"@open-ai-xxx", "request_timeout": 2000, },
172-
{ "provider":"@azure-open-ai-xxx"}
166+
{ "provider":"@openai", "request_timeout": 2000, },
167+
{ "provider":"@azure-openai"}
173168
]
174169
}
175170
```
@@ -182,7 +177,7 @@ Here, fallback from OpenAI to Azure OpenAI will only be triggered if the first r
182177
{
183178
"request_timeout": 1000,
184179
"retry": { "attempts": 3, "on_status_codes": [ 408 ] },
185-
"provider":"@open-ai-xxx"
180+
"provider":"@openai"
186181
}
187182
```
188183

product/ai-gateway/strict-open-ai-compliance.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ To get those fields in the response, you can do one of the following:
2121
from portkey_ai import Portkey
2222

2323
portkey = Portkey(
24-
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
25-
provider="@PROVIDER", # Replace with your virtual key
24+
api_key="PORTKEY_API_KEY",
25+
provider="@PROVIDER",
2626
strict_open_ai_compliance=False
2727
)
2828
```
@@ -32,8 +32,8 @@ To get those fields in the response, you can do one of the following:
3232
import Portkey from 'portkey-ai'
3333

3434
const portkey = new Portkey({
35-
apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
36-
provider:"@PROVIDER", // Your Virtual Key
35+
apiKey: "PORTKEY_API_KEY",
36+
provider:"@PROVIDER",
3737
strictOpenAiCompliance: false
3838
})
3939
```

product/ai-gateway/virtual-keys/budget-limits.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ And you can set both these limtis for each workspace.
3333
> * Budget limits apply until exhausted or reset
3434
> * Budget limits are applied only to requests made after the limit is set; they do not apply retroactively
3535
> * Once set, budget limits **cannot be edited** by any organization member
36-
> * Budget limits work for **all providers** available on Portkey and apply to **all organization members** who use the virtual key
36+
> * Budget limit feature is available for **all LLMs** available on Portkey and will apply to **all members/workspaces** who have permission to use it.
3737
3838
## Alert Thresholds
3939

@@ -71,7 +71,7 @@ You can track your spending and token usage for any specific provider by navigat
7171

7272
## Pricing Support and Limitations
7373

74-
Budget limits currently apply to all providers and models for which Portkey has pricing support. If a specific request log shows `0 cents` in the COST column, it means that Portkey does not currently track pricing for that model, and it will not count towards the virtual key's budget limit.
74+
Budget limits currently apply to all providers and models for which Portkey has pricing support. If a specific request log shows `0 cents` in the COST column, it means that Portkey does not currently track pricing for that model, and it will not count towards the providers's budget limit.
7575

7676
For token-based budgets, Portkey tracks both input and output tokens across all supported models.
7777

product/ai-gateway/virtual-keys/rate-limits.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Set a maximum number of tokens that can be consumed within a specified time peri
3131
>
3232
> * Rate limits can be set as either request-based or token-based
3333
> * Time intervals can be configured as per minute, per hour, or per day
34-
> * Setting the limit to 0 disables the virtual key
34+
> * Setting the limit to 0 disables the provider
3535
> * Rate limits apply immediately after being set
36-
> * Once set, budget limits **cannot be edited** by any organization member
37-
> * Rate limits work for **all providers** available on Portkey and apply to **all organization members** who use the virtual key
36+
> * Once set, rate limits **cannot be edited** by any organization member
37+
> * Rate limits work for **all providers** available on Portkey and apply to **all organization members** who use the provider
3838
> * After a rate limit is reached, requests will be rejected until the time period resets
3939
4040
## Rate Limit Intervals

0 commit comments

Comments
 (0)