repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
gateway | github_2023 | typescript | 415 | Portkey-AI | narengogi | @@ -16,23 +15,39 @@ export const CohereChatCompleteConfig: ProviderConfig = {
default: 'command',
required: true,
},
- messages: {
- param: 'prompt',
- required: true,
- transform: (params: Params) => {
- let prompt: string = '';
- // Transform the chat messages into a simple prompt
- ... | also need to handle messages of object type
```
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "is it me?"
}
]
}
```
You can refer https://platform.openai.com/docs/api-reference/chat/create for openai reques... |
gateway | github_2023 | typescript | 445 | Portkey-AI | narengogi | @@ -109,10 +109,19 @@ export const retryRequest = async (
}
);
} catch (error: any) {
- lastResponse = new Response(error.message, {
- status: error.status,
- headers: error.headers,
- });
+ if (error instanceof TypeError && error.message?.includes('fetch failed')) { | This check should not be present in the retryHandler, the string is generic and this might get caught unintentionally |
gateway | github_2023 | typescript | 533 | Portkey-AI | VisargD | @@ -0,0 +1,47 @@
+import { SILICONFLOW } from '../../globals';
+import { ErrorResponse, ImageGenerateResponse, ProviderConfig } from '../types';
+import { SiliconFlowErrorResponseTransform } from './chatComplete';
+
+export const SiliconFlowImageGenerateConfig: ProviderConfig = {
+ prompt: {
+ param: 'prompt',
+ ... | We take the input in OpenAI format. So this should take size as input and map it to image_size |
gateway | github_2023 | typescript | 519 | Portkey-AI | VisargD | @@ -222,6 +230,11 @@ export interface Tool {
type: string;
/** A description of the function. */
function?: Function;
+
+ /**
+ * Only specific to anthropic
+ */
+ cache_control?: any; | Should we use `AnthropicPromptCache` instead of `any` here? |
gateway | github_2023 | typescript | 519 | Portkey-AI | VisargD | @@ -5,11 +5,15 @@ const AnthropicAPIConfig: ProviderAPIConfig = {
headers: ({ providerOptions, fn }) => {
const headers: Record<string, string> = {
'X-API-Key': `${providerOptions.apiKey}`,
- 'anthropic-version': '2023-06-01',
};
+
+ const betas = providerOptions?.['anthropicBeta'] ?? 'messa... | Is this a typo? |
gateway | github_2023 | typescript | 519 | Portkey-AI | VisargD | @@ -433,7 +480,7 @@ export const AnthropicChatCompleteStreamChunkTransform: (
chunk = chunk.trim();
const parsedChunk: AnthropicChatCompleteStreamResponse = JSON.parse(chunk);
-
+ console.log(parsedChunk, 'chunk'); | Please remove this console log |
gateway | github_2023 | typescript | 519 | Portkey-AI | VisargD | @@ -118,6 +123,9 @@ export const AnthropicChatCompleteConfig: ProviderConfig = {
const transformedMessage: Record<string, any> = {
role: msg.role,
content: [],
+ ...(msg.cache_control && { | cache_control is only allowed inside the content array objects. So this mapping will not work as expected. It should be mapped inside individual objects |
gateway | github_2023 | typescript | 538 | Portkey-AI | VisargD | @@ -513,7 +540,11 @@ export async function tryPost(
requestHeaders
);
- fetchOptions.body = JSON.stringify(transformedRequestBody);
+ fetchOptions.body = MULTIPART_FORM_DATA_ENDPOINTS.includes(fn)
+ ? (transformedRequestBody as FormData)
+ : JSON.stringify(transformedRequestBody);
+
+ console.log('fe... | Please remove this log |
gateway | github_2023 | typescript | 538 | Portkey-AI | VisargD | @@ -67,9 +69,13 @@ export function constructRequest(
method,
headers,
};
+ const contentType = headers['content-type'];
+ const isGetMethod = method === 'GET'; | The code will never reach here if it is a GET method. So we can remove it |
gateway | github_2023 | typescript | 500 | Portkey-AI | VisargD | @@ -0,0 +1,46 @@
+import {
+ constructConfigFromRequestHeaders,
+ tryTargetsRecursively,
+} from './handlerUtils';
+import { Context } from 'hono';
+
+/**
+ * Handles the '/chat/completions' API request by selecting the appropriate provider(s) and making the request to them.
+ *
+ * @param {Context} c - The Cloudflar... | Please fix this log |
gateway | github_2023 | typescript | 494 | Portkey-AI | sk-portkey | @@ -0,0 +1,130 @@
+import Providers from '../../providers';
+
+const providersConfig: Record<keyof typeof Providers, any> = { | Lets strictly define type here.
ProviderTestConfig
Type ProviderTestConfig
name : keyof typeof Providers,
provider/ApiKey,
operations: LlmOperation (defined below)
skip?: boolean (if they want to skip this call)
type LlmOperation
type: 'completions' | 'chatCompletions' | 'proxy'
operation: object |
gateway | github_2023 | typescript | 494 | Portkey-AI | sk-portkey | @@ -0,0 +1,50 @@
+import {
+ getChatCompleteWithMessageContentArraysRequest,
+ getChatCompleteWithMessageStringRequest,
+} from './resources/requestTemplates';
+import transformToProviderRequest from '../services/transformToProviderRequest';
+import Providers from '../providers';
+import { Context, Hono, HonoRequest ... | Instead of operation level, we can go by Provider Level. As we are aware of what each provider supports. |
gateway | github_2023 | typescript | 494 | Portkey-AI | sk-portkey | @@ -0,0 +1,2 @@
+const baseURL = 'http://localhost'; | provide an option to fetch the details from env |
gateway | github_2023 | typescript | 484 | Portkey-AI | VisargD | @@ -922,3 +965,49 @@ export const VertexAnthropicChatCompleteStreamChunkTransform: (
})}` + '\n\n'
);
};
+
+export const VertexLlamaChatCompleteResponseTransform: (
+ response: VertexLLamaChatCompleteResponse | GoogleErrorResponse,
+ responseStatus: number
+) => ChatCompletionResponse | ErrorResponse = (resp... | Please remove console logs from the PR |
gateway | github_2023 | typescript | 484 | Portkey-AI | VisargD | @@ -922,3 +965,49 @@ export const VertexAnthropicChatCompleteStreamChunkTransform: (
})}` + '\n\n'
);
};
+
+export const VertexLlamaChatCompleteResponseTransform: (
+ response: VertexLLamaChatCompleteResponse | GoogleErrorResponse,
+ responseStatus: number
+) => ChatCompletionResponse | ErrorResponse = (resp... | Gateway currently sends a `provider` field in the response for all providers. Can we add it here as well? |
gateway | github_2023 | typescript | 484 | Portkey-AI | VisargD | @@ -292,15 +294,15 @@ export async function handleStreamingMode(
}
// Convert GEMINI/COHERE json stream to text/event-stream for non-proxy calls
- if (
- [
- //
- GOOGLE,
- COHERE,
- BEDROCK,
- ].includes(proxyProvider) &&
- responseTransformer
- ) {
+ const isGoogleCohereOrBedro... | Sorry for the nitpick: Can we please make this check more strict? Currently, this will allow many other strings which are not vertex-ai. Can cause issues in future. |
gateway | github_2023 | typescript | 402 | Portkey-AI | VisargD | @@ -0,0 +1,16 @@
+import { ProviderConfigs } from '../types';
+import {
+ ZeroOneAIChatCompleteConfig,
+ ZeroOneChatCompleteResponseTransform,
+} from './chatComplete';
+import ZeroOneAIAPIConfig from './api';
+
+const ZeroOneAIConfig: ProviderConfigs = { | Hey. Mapping for stream transformer is missing here. Can you please check? |
gateway | github_2023 | typescript | 464 | Portkey-AI | VisargD | @@ -198,6 +198,8 @@ export const fetchProviderOptionsFromConfig = (
providerOptions[0].deploymentId = camelCaseConfig.deploymentId;
if (camelCaseConfig.apiVersion)
providerOptions[0].apiVersion = camelCaseConfig.apiVersion;
+ if (camelCaseConfig.modelName) | Can we please make this `azureModelName` instead of `modelName`. For the new providers, we have started adding provider name prefix to params to make them more readable. |
gateway | github_2023 | typescript | 453 | Portkey-AI | VisargD | @@ -206,13 +209,19 @@ export async function proxyHandler(c: Context): Promise<Response> {
) as Config | ShortConfig;
}
+ let body;
+ if (requestContentType.startsWith(CONTENT_TYPES.GENERIC_AUDIO_PATTERN)) {
+ body = requestBinary;
+ } else if (requestContentType === CONTENT_TYPES.APPLICATION... | Hey! This condition is incorrect. Can you please fix it?
The condition checks for application/json content type but the value being set for `body` is `store.requestFormData`. |
gateway | github_2023 | typescript | 453 | Portkey-AI | VisargD | @@ -5,12 +5,16 @@ import { configSchema } from './schema/config';
export const requestValidator = (c: Context, next: any) => {
const requestHeaders = Object.fromEntries(c.req.raw.headers);
+ const contentType = requestHeaders['content-type'];
if (
- requestHeaders['content-type'] &&
- ![
+ !!contentT... | This nested OR condition looks incorrect. Its causing issues even when I send a valid content-type header |
gateway | github_2023 | typescript | 363 | Portkey-AI | narengogi | @@ -345,6 +345,22 @@ export const AnthropicErrorResponseTransform: (
return undefined;
};
+// this converts the anthropic stop_reason to an openai finish_reason
+const getFinishReason = (stopReason?: string): string | null => { | Recommend creating a type
```
type AnthropicStopReason = 'max_tokens' | 'stop_sequence' | 'end_turn' | ....
``` |
gateway | github_2023 | typescript | 363 | Portkey-AI | narengogi | @@ -394,7 +410,8 @@ export const AnthropicChatCompleteResponseTransform: (
},
index: 0,
logprobs: null,
- finish_reason: response.stop_reason,
+ finish_reason:
+ getFinishReason(response.stop_reason) || response.stop_reason, | This should just be `getFinishReason(response.stop_reason)`, Otherwise it defeats the purpose of strictly typing the response |
gateway | github_2023 | typescript | 363 | Portkey-AI | narengogi | @@ -226,6 +226,28 @@ interface GoogleGenerateContentResponse {
};
}
+// this converts the google stop_reason to an openai finish_reason
+// https://ai.google.dev/api/python/google/ai/generativelanguage/Candidate/FinishReason
+const getFinishReason = (stopReason?: string): string | null => { | Same comments as in the getFinishReason transformer function above.
1. Use switch/case
2. Define types for GoogleStopReason |
gateway | github_2023 | typescript | 363 | Portkey-AI | narengogi | @@ -291,7 +313,9 @@ export const GoogleChatCompleteResponseTransform: (
return {
message: message,
index: generation.index,
- finish_reason: generation.finishReason,
+ finish_reason:
+ getFinishReason(generation.finishReason) ?? | should only be
```
finish_reason:
getFinishReason(generation.finishReason)
```
default case should be handled inside `getFinishReason` |
gateway | github_2023 | typescript | 304 | Portkey-AI | VisargD | @@ -0,0 +1,104 @@
+import { REKA_AI } from '../../globals';
+import { Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const Re... | For all the params which do not have an openai equivalent param, you can add them as it is in the mapping |
gateway | github_2023 | typescript | 304 | Portkey-AI | VisargD | @@ -0,0 +1,16 @@
+import { ProviderConfigs } from '../types';
+import RekaAIApiConfig from './api';
+import {
+ RekaAIChatCompleteConfig,
+ RekaAIChatCompleteResponseTransform,
+} from './chatComplete';
+
+const RekaAIConfig: ProviderConfigs = {
+ chatComplete: RekaAIChatCompleteConfig, | Acknowledged. We have a json to stream function but we can use that in another PR. |
gateway | github_2023 | typescript | 304 | Portkey-AI | VisargD | @@ -0,0 +1,178 @@
+import { REKA_AI } from '../../globals';
+import { Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+interf... | Acknowledged |
gateway | github_2023 | typescript | 304 | Portkey-AI | VisargD | @@ -0,0 +1,178 @@
+import { REKA_AI } from '../../globals';
+import { Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+interf... | Acknowledged |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,16 @@
+import { ProviderConfigs } from '../types';
+import MonsterAPIApiConfig from './api';
+import {
+ MonsterAPIChatCompleteConfig,
+ MonsterAPIChatCompleteResponseTransform,
+} from './generate';
+
+const MonsterAPIConfig: ProviderConfigs = {
+ api: MonsterAPIApiConfig,
+ generate: MonsterAPIChatComp... | Instead of `generate`, the name should be `chatComplete` for this. |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,118 @@
+// generate.ts
+import { MONSTERAPI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const MonsterAPIChatCompleteConfig: Prov... | The `object` value can be `chat.completion` as we are following OpenAI specs |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,118 @@
+// generate.ts
+import { MONSTERAPI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const MonsterAPIChatCompleteConfig: Prov... | For `created`, you can use `Math.floor(Date.now() / 1000)` as value. |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,118 @@
+// generate.ts
+import { MONSTERAPI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const MonsterAPIChatCompleteConfig: Prov... | To have the same response structure across, you can generate a random id and send it in response so that none of the existing SDKs break. We currently use `Date.now().toString()` in some providers as response id. |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,118 @@
+// generate.ts
+import { MONSTERAPI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const MonsterAPIChatCompleteConfig: Prov... | As per the API docs, some of the mappings are missing here. Can you please check this once?
If any param is similar to an existing OpenAI param, you can use the OpenAI param name as input and map it to Monster's param. If there is no OpenAI compatible param, then you can add them as a new mapping as it is. |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,18 @@
+import { ProviderAPIConfig } from '../types';
+
+const MonsterAPIApiConfig: ProviderAPIConfig = {
+ getBaseURL: () => 'https://llm.monsterapi.ai/v1',
+ headers: ({ providerOptions }) => {
+ return { Authorization: `Bearer ${providerOptions.apiKey}` };
+ },
+ getEndpoint: ({ fn }) => {
+ swit... | This case should also use chatComplete instead of generate. And the default should return an empty string. Basically this:
```
switch (fn) {
case 'chatComplete':
return '/generate';
default:
return '';
}
``` |
gateway | github_2023 | typescript | 280 | Portkey-AI | VisargD | @@ -0,0 +1,119 @@
+// chatComplete.ts
+import { MONSTERAPI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const MonsterAPIChatCompleteConfig: ... | The openAI compatible name is temperature and not temp. So the input will be temperature which can then be mapped to MonsterAPI specific param name |
gateway | github_2023 | typescript | 273 | Portkey-AI | VisargD | @@ -0,0 +1,36 @@
+import { ProviderConfigs } from '../types';
+import FireworksAIAPIConfig from './api';
+import {
+ FireworksAIChatCompleteConfig,
+ FireworksAIChatCompleteResponseTransform,
+ FireworksAIChatCompleteStreamChunkTransform,
+} from './chatComplete';
+import {
+ FireworksAICompleteConfig,
+ Fireworks... | stream-complete transformer function is present but it not mapped here. Can you please check once? |
gateway | github_2023 | typescript | 273 | Portkey-AI | VisargD | @@ -0,0 +1,205 @@
+import { FIREWORKS_AI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const FireworksAIChatCompleteConfig: ProviderConfig = ... | As per their docs, fireworks provides token usage in the last stream chunk for streaming mode. Can we also attach usage in our last transformed stream chunk. We already do something similar for bedrock stream transformer. |
gateway | github_2023 | typescript | 273 | Portkey-AI | VisargD | @@ -0,0 +1,104 @@
+import { FIREWORKS_AI } from '../../globals';
+import { ErrorResponse, ImageGenerateResponse, ProviderConfig } from '../types';
+import { generateInvalidProviderResponseError } from '../utils';
+import {
+ FireworksAIValidationErrorResponse,
+ FireworksAIErrorResponseTransform,
+ FireworksAIErrorR... | The OpenAI compatible param name is `prompt` which can then be mapped to `text_prompts` |
gateway | github_2023 | typescript | 273 | Portkey-AI | VisargD | @@ -0,0 +1,104 @@
+import { FIREWORKS_AI } from '../../globals';
+import { ErrorResponse, ImageGenerateResponse, ProviderConfig } from '../types';
+import { generateInvalidProviderResponseError } from '../utils';
+import {
+ FireworksAIValidationErrorResponse,
+ FireworksAIErrorResponseTransform,
+ FireworksAIErrorR... | `height` and `weight` are not directly available in OpenAI specs. You will have to use size and split it by `x`. Please check the OpenAI docs to compare the params |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,20 @@
+import { ProviderAPIConfig } from '../types';
+
+const NovitaAIApiConfig: ProviderAPIConfig = {
+ getBaseURL: () => 'https://api.novita.ai/v3/openai',
+ headers: ({ providerOptions }) => {
+ return { Authorization: `Bearer ${providerOptions.apiKey}` };
+ },
+ getEndpoint: ({ fn }) => {
+ swi... | end point seems to be incorrect.
please refer to https://novita.ai/get-started/llm.html#example-with-curl-client |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,20 @@
+import { ProviderAPIConfig } from '../types';
+
+const NovitaAIApiConfig: ProviderAPIConfig = {
+ getBaseURL: () => 'https://api.novita.ai/v3/openai',
+ headers: ({ providerOptions }) => {
+ return { Authorization: `Bearer ${providerOptions.apiKey}` };
+ },
+ getEndpoint: ({ fn }) => {
+ swi... | end point seems to be incorrect.
please refer to https://novita.ai/get-started/llm.html#example-with-curl-client |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -45,6 +46,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
jina: JinaConfig,
'fireworks-ai': FireworksAIConfig,
'workers-ai': WorkersAiConfig,
+ "novita-ai": NovitaAIConfig, | issue with formatting.
run `npm run format` for formatting |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,211 @@
+import { NOVITA_AI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+// TODOS: this configuration does not enforce the maximum token ... | missing multiple parameters supported as referenced in https://novita.ai/get-started/llm.html#model-parameter
- presence_penalty
- n |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,211 @@
+import { NOVITA_AI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+// TODOS: this configuration does not enforce the maximum token ... | param here should be frequency_penalty. please refer to https://novita.ai/get-started/llm.html#model-parameter |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,131 @@
+import { NOVITA_AI } from '../../globals';
+import { CompletionResponse, ErrorResponse, ProviderConfig } from '../types';
+import { generateInvalidProviderResponseError } from '../utils';
+import {
+ NovitaAIErrorResponse,
+ NovitaAIErrorResponseTransform,
+ NovitaAIOpenAICompatibleErrorResponse,
... | missing additional parameters please refer to https://novita.ai/get-started/llm.html#model-parameter |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,131 @@
+import { NOVITA_AI } from '../../globals';
+import { CompletionResponse, ErrorResponse, ProviderConfig } from '../types';
+import { generateInvalidProviderResponseError } from '../utils';
+import {
+ NovitaAIErrorResponse,
+ NovitaAIErrorResponseTransform,
+ NovitaAIOpenAICompatibleErrorResponse,
... | param should be frequency_penalty here |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,131 @@
+import { NOVITA_AI } from '../../globals';
+import { CompletionResponse, ErrorResponse, ProviderConfig } from '../types';
+import { generateInvalidProviderResponseError } from '../utils';
+import {
+ NovitaAIErrorResponse,
+ NovitaAIErrorResponseTransform,
+ NovitaAIOpenAICompatibleErrorResponse,
... | model is being sent in the stream chunk response. use `parsedChunk.model` here |
gateway | github_2023 | typescript | 303 | Portkey-AI | sk-portkey | @@ -0,0 +1,220 @@
+import { NOVITA_AI } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+// TODOS: this configuration does not enforce the maximum token ... | model is being sent in the stream chunk response. use `parsedChunk.model` here |
gateway | github_2023 | typescript | 303 | Portkey-AI | VisargD | @@ -49,10 +51,14 @@ const Providers: { [key: string]: ProviderConfigs } = {
jina: JinaConfig,
'fireworks-ai': FireworksAIConfig,
'workers-ai': WorkersAiConfig,
+<<<<<<< HEAD | Seems like the merge conflicts were not resolved properly. Can you please check this? |
gateway | github_2023 | others | 150 | Portkey-AI | VisargD | @@ -8,6 +8,41 @@ npx @portkey-ai/gateway
# Deploy to Cloudflare Workers
+Method 1
+
+1. Create an API token in Cloudflare
+Select "My Profile" from the dropdown menu of your user icon on the top right of your dashboard. Select "API Tokens" > "Create Token". Under "Custom Token", select "Get started". Name your API... | This step looks unnecessary in context of docs. We can replace this with something like this:
```
Add github workflow .yml file to your forked version of the repo under .github/workflows directory. Here is a sample cloudflare-deploy.yml file that will deploy to cloudflare on every push to main branch.
```
What do... |
gateway | github_2023 | others | 150 | Portkey-AI | VisargD | @@ -8,6 +8,41 @@ npx @portkey-ai/gateway
# Deploy to Cloudflare Workers
+Method 1 | Should we also add more info to header? Something like:
```Method 1: Using Github Actions``` |
gateway | github_2023 | typescript | 295 | Portkey-AI | VisargD | @@ -0,0 +1,137 @@
+import { LINGYI } from "../../globals";
+
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from "../types";
+
+export const LingYiChatCompleteConfig: ProviderConfig = {
+ model: {
+ param: "model",
+ required: true,
+ default: "yi-34b-chat-0205",
+ },
+ message... | You can use `generateInvalidProviderResponseError` to generate the invalid response error message for any provider. Applicable for all the provider integrated in this PR.
```
return generateInvalidProviderResponseError(response, LINGYI);
```
You can check other providers integrations for example. |
gateway | github_2023 | typescript | 295 | Portkey-AI | VisargD | @@ -0,0 +1,137 @@
+import { LINGYI } from "../../globals";
+
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from "../types";
+
+export const LingYiChatCompleteConfig: ProviderConfig = {
+ model: {
+ param: "model",
+ required: true,
+ default: "yi-34b-chat-0205",
+ },
+ message... | You can use `generateErrorResponse` to generate the provider error response. Applicable for all the provider integrated in this PR.
```
return generateErrorResponse(
{
message: response.error.message,
type: response.error.type,
param: null,
code: response.error.code?.toString() || null,
},
... |
gateway | github_2023 | typescript | 295 | Portkey-AI | VisargD | @@ -0,0 +1,148 @@
+import { OPENROUTER } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const OpenrouterChatCompleteConfig: ProviderConfig = {
+... | openrouter also sends a `:OPENROUTER PROCESSING` event as a part of stream. Can you please add a check just like `[DONE] ` but return `undefined` in that case. Example:
```
if (chunk === ': OPENROUTER PROCESSING') {
return undefined;
}
``` |
gateway | github_2023 | typescript | 295 | Portkey-AI | VisargD | @@ -81,6 +81,7 @@ export const OpenrouterChatCompleteResponseTransform: (
response: OpenrouterChatCompleteResponse | OpenrouterErrorResponse,
responseStatus: number
) => ChatCompletionResponse | ErrorResponse = (response, responseStatus) => {
+ console.log('response:', response); | Sorry for the nitpick: Can you please remove console logs from the PR?
|
gateway | github_2023 | typescript | 295 | Portkey-AI | unsync | @@ -0,0 +1,163 @@
+import { OPENROUTER } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const OpenrouterChatCompleteConfig: ProviderConfig = {
+... | @sternelee according to the OpenAI api signature, the id is a string :
https://platform.openai.com/docs/api-reference/chat/object
Using an integer causes some sdk to throw an error for these chunks, could you set a string value like this ?
```
id: `${Date.now()}`,
```
cc @VisargD |
gateway | github_2023 | typescript | 295 | Portkey-AI | unsync | @@ -0,0 +1,163 @@
+import { OPENROUTER } from '../../globals';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from '../utils';
+
+export const OpenrouterChatCompleteConfig: ProviderConfig = {
+... | @sternelee Similar issue here, the OpenAI signature ask for `chat.completion.chunk` in all chunks :
https://platform.openai.com/docs/api-reference/chat/streaming#chat/streaming-object |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,189 @@
+import { WORKERS_AI } from '../../globals';
+import { Params, Message } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+export const WorkersAiChatCompleteConfig: ProviderConfig = {
+ messages: [
+ {
+ param: 'me... | Cloudflare sends errors as an array of object which has code and message in it. One thing that we can do is to just join the message fields and decorate it with comma.
Example CF errors array:
```
"errors": [
{
"code": 7000,
"message": "No route for that URI"
}
],
... |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,189 @@
+import { WORKERS_AI } from '../../globals';
+import { Params, Message } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+export const WorkersAiChatCompleteConfig: ProviderConfig = {
+ messages: [
+ {
+ param: 'me... | You can use the newly added error generator function instead of writing the whole object. (for this and complete as well)
Example:
```
return generateInvalidProviderResponseError(response, WORKERS_AI);
```
You can also check other providers to get a reference of the latest refactoring that happened for provi... |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,189 @@
+import { WORKERS_AI } from '../../globals';
+import { Params, Message } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+export const WorkersAiChatCompleteConfig: ProviderConfig = {
+ messages: [
+ {
+ param: 'me... | Sorry for the nitpick: But we can remove the comments as we have already added the TODO for usage and model |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -951,6 +954,10 @@ export function constructConfigFromRequestHeaders(
awsRegion: requestHeaders[`x-${POWERED_BY}-aws-region`],
};
+ const workersAiConfig = {
+ accountId: requestHeaders[`x-${POWERED_BY}-workers-ai-account-id`], | Should we change this to workersAIAccountId instead of just accountId to avoid confusion in future. The idea here is to have the same naming for header as well as the config field.
For example: bedrockConfig is
```
const bedrockConfig = {
awsAccessKeyId: requestHeaders[`x-${POWERED_BY}-aws-access-key-id`],
... |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,189 @@
+import { WORKERS_AI } from '../../globals';
+import { Params, Message } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+export const WorkersAiChatCompleteConfig: ProviderConfig = {
+ messages: [
+ {
+ param: 'me... | In one of the recent release, we pushed some refactoring for error handling on provider level. Instead of writing same code for all provider methods, you can now just define a error handler and use it in each transformer. You can check anthropic chatComplete.ts for an example. |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,122 @@
+import { Params } from '../../types/requestBody';
+import { CompletionResponse, ErrorResponse, ProviderConfig } from '../types';
+import { WORKERS_AI } from '../../globals';
+import { generateErrorResponse, generateInvalidProviderResponseError } from '../utils';
+
+export const WorkersAiCompleteConfi... | WorkersAI supports some other params as well which can be mapped here and in chatComplete config as well. The params which do not have a mapping with existing OpenAI param can be added as new params in this config.
Suggesting this addition to the config:
```
raw: {
param: 'raw'
},
max_tokens: {
pa... |
gateway | github_2023 | typescript | 269 | Portkey-AI | VisargD | @@ -0,0 +1,188 @@
+import { WORKERS_AI } from '../../globals';
+import { Params, Message } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import { generateErrorResponse, generateInvalidProviderResponseError } from '../utils';
+
+export cons... | As per their docs, workersAI also supports messages input. So there is ideally no need to make transformation for chat complete calls.
Here is their docs link which has info on this: https://developers.cloudflare.com/workers-ai/models/sqlcoder-7b-2/#scoped-prompts |
gateway | github_2023 | typescript | 265 | Portkey-AI | VisargD | @@ -0,0 +1,380 @@
+import { GOOGLE_VERTEX_AI } from '../../globals';
+import { ContentType, Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+const transformGenerationConfig = (params: Params) => {
+ const generationConfig... | You can replace this with new functions which here released yesterday.
```
return generateInvalidProviderResponseError(response, VERTEX);
```
Please check some other provider integrations to get an idea about this. |
gateway | github_2023 | typescript | 265 | Portkey-AI | VisargD | @@ -0,0 +1,380 @@
+import { GOOGLE_VERTEX_AI } from '../../globals';
+import { ContentType, Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+const transformGenerationConfig = (params: Params) => {
+ const generationConfig... | With the new structural changes, now every provider can have a single error transform function which can be used in all other transformers. Please check some other providers to get an idea about this. |
gateway | github_2023 | typescript | 265 | Portkey-AI | VisargD | @@ -0,0 +1,380 @@
+import { GOOGLE_VERTEX_AI } from '../../globals';
+import { ContentType, Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+
+const transformGenerationConfig = (params: Params) => {
+ const generationConfig... | The last chunk of the stream sends usageMetadata object which has the token usage. We can do the same for transformed stream. The last chunk can have usage object which is in OpenAI format. Checkout bedrock model transformers for reference.
This is the object that vertex sends in last chunk:
```
"usageMetadata": {... |
gateway | github_2023 | typescript | 265 | Portkey-AI | VisargD | @@ -0,0 +1,42 @@
+import { ProviderAPIConfig } from '../types';
+
+// Good reference for using REST: https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal#gemini-beginner-samples-drest
+// Difference versus Studio AI: https://cloud.google.com/vertex-ai/docs/start/ai-platform-user... | Vertex allows to send `?alt=sse` in url to get SSE instead of json stream. I think that will make things easy for us. Should we make that change? |
gateway | github_2023 | typescript | 265 | Portkey-AI | VisargD | @@ -0,0 +1,388 @@
+import { GOOGLE_VERTEX_AI } from '../../globals';
+import { ContentType, Message, Params } from '../../types/requestBody';
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from '../types';
+import {
+ generateErrorResponse,
+ generateInvalidProviderResponseError,
+} from... | Minor: These checks are not required now, correct? Because we have moved to alt=sse mode instead of default json streaming mode.
```
if (chunk.startsWith('[')) {
chunk = chunk.slice(1);
}
if (chunk.endsWith(',')) {
chunk = chunk.slice(0, chunk.length - 1);
}
if (chunk.endsWith(']')) {
c... |
gateway | github_2023 | others | 159 | Portkey-AI | vrushankportkey | @@ -1,9 +1,13 @@
+<p align="right">
+ <strong>English</strong>|<a href="https://github.com/Portkey-AI/gateway/blob/main/CODE_OF_CONDUCT.cn.md">中文</a>
+</p>
+
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
-community a harassment-... | can we retain "body" |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -754,3 +789,124 @@ export const BedrockCohereCompleteStreamChunkTransform: (
],
})}\n\n`;
};
+
+interface BedrocMistralStreamChunkOutput {
+ text: string;
+ stop_reason: string | null;
+}
+
+export interface BedrocMistralStreamChunk {
+ outputs: BedrocMistralStreamChunkOutput[];
+}
+
+export const Bedroc... | You can use `BedrockErrorResponseTransform` function to handle error for bedrock.
https://github.com/Portkey-AI/gateway/blob/48785807bcc19dc13669354ac3bc895b9af58185/src/providers/bedrock/chatComplete.ts#L394-L405
Example usage:
https://github.com/Portkey-AI/gateway/blob/48785807bcc19dc13669354ac3bc895b9af58185/... |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -754,3 +789,124 @@ export const BedrockCohereCompleteStreamChunkTransform: (
],
})}\n\n`;
};
+
+interface BedrocMistralStreamChunkOutput {
+ text: string;
+ stop_reason: string | null;
+}
+
+export interface BedrocMistralStreamChunk {
+ outputs: BedrocMistralStreamChunkOutput[];
+}
+
+export const Bedroc... | Instead of writing the whole object, you can reuse an existing function:
https://github.com/Portkey-AI/gateway/blob/48785807bcc19dc13669354ac3bc895b9af58185/src/providers/bedrock/complete.ts#L370C1-L371C1
|
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -754,3 +789,124 @@ export const BedrockCohereCompleteStreamChunkTransform: (
],
})}\n\n`;
};
+
+interface BedrocMistralStreamChunkOutput {
+ text: string;
+ stop_reason: string | null;
+}
+
+export interface BedrocMistralStreamChunk {
+ outputs: BedrocMistralStreamChunkOutput[];
+}
+
+export const Bedroc... | Bedrock sends token usage in the last chunk of the stream. I am not sure if that is the case for Mistral as well. Can you please check and make the change accordingly. Here is an example: https://github.com/Portkey-AI/gateway/blob/48785807bcc19dc13669354ac3bc895b9af58185/src/providers/bedrock/complete.ts#L604-L612 |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -125,6 +125,41 @@ export const BedrockLLamaCompleteConfig: ProviderConfig = {
},
};
+export const BedrockMistralCompleteConfig: ProviderConfig = {
+ prompt: {
+ param: 'prompt',
+ required: true,
+ },
+ max_tokens: {
+ param: 'max_tokens',
+ default: 20,
+ min: 1,
+ },
+ temperature: {
+ ... | As per their docs, this param is called top_p instead of p for mistral.
```
{
"prompt": string,
"max_tokens" : int,
"stop" : [string],
"temperature": float,
"top_p": float,
"top_k": int
}
```
Docs: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-mistral.htm... |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -125,6 +125,41 @@ export const BedrockLLamaCompleteConfig: ProviderConfig = {
},
};
+export const BedrockMistralCompleteConfig: ProviderConfig = {
+ prompt: {
+ param: 'prompt',
+ required: true,
+ },
+ max_tokens: {
+ param: 'max_tokens',
+ default: 20,
+ min: 1,
+ },
+ temperature: {
+ ... | stream should not be a part of transform config as the request body does not accept it. The `getEndpoint` function will handle considering stream and adding it to url. |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -754,3 +785,115 @@ export const BedrockCohereCompleteStreamChunkTransform: (
],
})}\n\n`;
};
+
+export interface BedrocMistralStreamChunk {
+ outputs: {
+ text: string;
+ stop_reason: string | null;
+ }[];
+ 'amazon-bedrock-invocationMetrics': {
+ inputTokenCount: number;
+ outputTokenCount: ... | Can you please also add the tokens from headers as you did for chatComplete? |
gateway | github_2023 | typescript | 268 | Portkey-AI | VisargD | @@ -125,6 +125,37 @@ export const BedrockLLamaCompleteConfig: ProviderConfig = {
},
};
+export const BedrockMistralCompleteConfig: ProviderConfig = {
+ prompt: {
+ param: 'prompt',
+ required: true,
+ },
+ max_tokens: {
+ param: 'max_tokens',
+ default: 20,
+ min: 1,
+ },
+ temperature: {
+ ... | As mentioned in this comment, stop can be mapped to stop itself.
https://github.com/Portkey-AI/gateway/pull/268/files#r1544562206 |
gateway | github_2023 | others | 198 | Portkey-AI | roh26it | @@ -15,10 +19,11 @@
[Portkey's AI Gateway](https://portkey.ai/features/ai-gateway) is the interface between your app and hosted LLMs. It streamlines API requests to OpenAI, Anthropic, Mistral, LLama2, Anyscale, Google Gemini and more with a unified API.
-✅ Blazing **fast** (9.9x faster) with a **tiny footpr... | It dilutes the message, we should definitely include it in a benchmarks section. Should also talk about how we leverage core tech to make the gateway faster along with launching the perf benchmarks that @VisargD is preparing |
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -0,0 +1,208 @@
+import {
+ ChatCompletionResponse,
+ CompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from "../types";
+import { OLLAMA } from "../../globals";
+
+export const OllamaChatCompleteConfig: ProviderConfig = {
+ model: {
+ param: "model",
+ required: true,
+ default: "llama2",
+ },... | Please remove all the comments which are not necessary
|
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -0,0 +1,28 @@
+import { ProviderAPIConfig } from "../types";
+
+const OllamaAPIConfig: ProviderAPIConfig = {
+ headers: () => {
+ return null;
+ },
+ chatComplete: "/v1/chat/completions",
+ embed:"/api/embeddings",
+ getEndpoint: (fn: string, API_VERSION: string, url?: string) => {
+ let mappedFn = fn;
+ ... | This is not required as /chat/completions will always point to the unified route. |
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -0,0 +1,28 @@
+import { ProviderAPIConfig } from "../types";
+
+const OllamaAPIConfig: ProviderAPIConfig = {
+ headers: () => {
+ return null;
+ },
+ chatComplete: "/v1/chat/completions",
+ embed:"/api/embeddings",
+ getEndpoint: (fn: string, API_VERSION: string, url?: string) => { | Please remove API_VERSION as it is not used |
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -0,0 +1,131 @@
+import {
+ ChatCompletionResponse,
+ CompletionResponse, | nitpick: Please remove unused import |
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -21,6 +21,9 @@ export const getStreamModeSplitPattern = (proxyProvider: string, requestURL: str
{
splitPattern = '\r\n\r\n';
}
+ if(proxyProvider === OLLAMA){ | This can be removed as we already initialize splitPattern with `\n\n` |
gateway | github_2023 | typescript | 194 | Portkey-AI | VisargD | @@ -99,8 +99,8 @@ export async function handleStreamingMode(response: Response, proxyProvider: str
writer.close();
})();
- // Convert GEMINI/COHERE json stream to text/event-stream for non-proxy calls
- if ([GOOGLE, COHERE].includes(proxyProvider) && responseTransformer) {
+ // Convert GEMINI/C... | This can be removed now as we have added support for OpenAI compatible ollama route. So the response from ollama will always be text/event stream |
gateway | github_2023 | typescript | 204 | Portkey-AI | VisargD | @@ -0,0 +1,51 @@
+import { ImageGenerateResponse, ProviderConfig } from "../types";
+
+export const StabilityAIImageGenerateConfig: ProviderConfig = {
+ prompt: {
+ param: "text_prompts",
+ required: true,
+ transform: (params: any) => {
+ return [{
+ "text": params.prompt,
+ "weight": 1
+ ... | Can you please also add `provider: STABILITY_AI` (constant) in the response |
gateway | github_2023 | typescript | 204 | Portkey-AI | VisargD | @@ -61,7 +62,7 @@ export const requestValidator = (c: Context, next: any) => {
}
if (
requestHeaders[`x-${POWERED_BY}-provider`] &&
- ![OPEN_AI, AZURE_OPEN_AI, COHERE, ANTHROPIC, ANYSCALE, PALM, TOGETHER_AI, GOOGLE, MISTRAL_AI, PERPLEXITY_AI, DEEPINFRA].includes(
+ ![OPEN_AI, AZURE_OPEN... | Can you also add the same provider in `src/middlewares/requestValidator/schema/config.ts` . We need to remove repetition but till then we need to add new providers in both the validator files. |
gateway | github_2023 | typescript | 204 | Portkey-AI | VisargD | @@ -0,0 +1,43 @@
+import { constructConfigFromRequestHeaders, tryTargetsRecursively } from "./handlerUtils";
+import { Context } from "hono";
+
+/**
+ * Handles the '/images/generations' API request by selecting the appropriate provider(s) and making the request to them.
+ *
+ * @param {Context} c - The Cloudflare Work... | Nitpick: Please change the error log to `console.log("imageGenerate error", err.message);` |
gateway | github_2023 | typescript | 204 | Portkey-AI | VisargD | @@ -0,0 +1,45 @@
+import { ImageGenerateResponse, ProviderConfig } from "../types";
+
+export const OpenAIImageGenerateConfig: ProviderConfig = {
+ prompt: {
+ param: "prompt",
+ required: true
+ },
+ model: {
+ param: "model",
+ default: "dall-e-2" | `default` without `required: true` will not add the value automatically. |
gateway | github_2023 | typescript | 149 | Portkey-AI | VisargD | @@ -0,0 +1,151 @@
+import { DEEPINFRA } from "../../globals";
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from "../types";
+
+export const DeepInfraChatCompleteConfig: ProviderConfig = { | Can you please set the default, min and max values based on OpenAI docs.
https://platform.openai.com/docs/api-reference/chat/create |
gateway | github_2023 | typescript | 149 | Portkey-AI | VisargD | @@ -0,0 +1,14 @@
+import { ProviderConfigs } from "../types";
+import DeepInfraApiConfig from "./api";
+import {DeepInfraChatCompleteConfig, DeepInfraChatCompleteStreamChunkTransform} from "./chatComplete";
+
+const DeepInfraConfig: ProviderConfigs = {
+ chatComplete: DeepInfraChatCompleteConfig,
+ api: DeepInfra... | Looks like this is incorrect. The transform function needs to be used here instead of the Config object. Can you please fix this. |
gateway | github_2023 | typescript | 149 | Portkey-AI | VisargD | @@ -0,0 +1,176 @@
+import { DEEPINFRA } from "../../globals";
+import {
+ ChatCompletionResponse,
+ ErrorResponse,
+ ProviderConfig,
+} from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If you want to enforce this, you might need to add a custom valida... | Error structure for deepinfra is different than OpenAI. You can replicate the error message by sending invalid fields to deepinfra like max_tokens="abc" or something. It sends an array of failed validation like this
```json
{
"detail": [
{
"loc": [
"body",
... |
gateway | github_2023 | typescript | 149 | Portkey-AI | VisargD | @@ -0,0 +1,14 @@
+import { ProviderAPIConfig } from "../types";
+
+const DeepInfraApiConfig: ProviderAPIConfig = {
+ baseURL: "https://api.deepinfra.com/v1/openai",
+ headers: (API_KEY: string) => {
+ return {
+ Authorization: `Bearer ${API_KEY}`,
+ "Content-Type": "application/json", | We already add content-type header in the below function. So we can remove it from here. Otherwise, this will cause duplicate header
https://github.com/Portkey-AI/gateway/blob/b5dbfadd5bc697c5c212cf44a3bc8bea898f3216/src/handlers/handlerUtils.ts#L20-L23 |
gateway | github_2023 | others | 120 | Portkey-AI | VisargD | @@ -39,7 +39,20 @@ node build/start-server.js
```
# Deploy using Docker
-Docs to be written, please help!
+Run using Docker directly:
+```
+sudo docker run -d -p 8787:8787 portkeyai/gateway | - Can we please remove sudo from the command?
- And we can also add latest tag to make it more explicit `portkeyai/gateway:latest`
- Can you also link the docker image url as a part of comment: https://hub.docker.com/r/portkeyai/gateway |
gateway | github_2023 | others | 120 | Portkey-AI | VisargD | @@ -39,7 +39,20 @@ node build/start-server.js
```
# Deploy using Docker
-Docs to be written, please help!
+Run using Docker directly:
+```
+sudo docker run -d -p 8787:8787 portkeyai/gateway
+```
+
+# Deploy using Docker Compose
+1. Download compose file from the repo:
+```
+wget "https://raw.githubusercontent.com/P... | Nitpicking very small change: Can we also mention the default container port that will be exposed? Default is 8787 |
gateway | github_2023 | others | 101 | Portkey-AI | VisargD | @@ -1,6 +1,5 @@
-<!-- <img src="docs/images/header_new.png" width=2000> -->
<div align="center">
-<img src="https://github.com/roh26it/Rubeus/assets/971978/50b9f1df-ff5b-43d4-91be-b817943a16f7" width=500>
+<img src="https://github.com/vrushankportkey/gateway/assets/134934501/3a0c766a-0388-4fa4-bd7d-dba3a289d81c" width... | Can we change this to gateway github url instead of your forked repo url? |
gateway | github_2023 | typescript | 30 | Portkey-AI | VisargD | @@ -0,0 +1,76 @@
+import { Params } from "../../types/requestBody";
+import { PalmCompleteResponse } from "../../types/responseBody";
+import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If yo... | candidate_count seems like an equivalent to `n` which is there in existing specification. Please reuse that and make the transformation to palm specific key |
gateway | github_2023 | typescript | 30 | Portkey-AI | VisargD | @@ -0,0 +1,81 @@
+import { Params } from "../../types/requestBody";
+import { PalmChatCompleteResponse } from "../../types/responseBody";
+import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. I... | candidate_count seems like an equivalent to n which is there in existing specification. Please reuse that and make the transformation to palm specific key |
gateway | github_2023 | typescript | 30 | Portkey-AI | VisargD | @@ -0,0 +1,81 @@
+import { Params } from "../../types/requestBody";
+import { PalmChatCompleteResponse } from "../../types/responseBody";
+import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. I... | Please fix the default model name |
gateway | github_2023 | typescript | 30 | Portkey-AI | VisargD | @@ -0,0 +1,76 @@
+import { Params } from "../../types/requestBody";
+import { PalmCompleteResponse } from "../../types/responseBody";
+import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If yo... | Please fix the default model name |
gateway | github_2023 | typescript | 30 | Portkey-AI | VisargD | @@ -0,0 +1,76 @@
+import { Params } from "../../types/requestBody";
+import { PalmCompleteResponse } from "../../types/responseBody";
+import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types";
+
+// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If yo... | Please remove console log |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.