Path: blob/main/extensions/copilot/src/platform/openai/node/fetch.ts
13401 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { RequestId } from '../../networking/common/fetch';6import { ChatCompletion } from '../../networking/common/openai';78export enum FetchResponseKind {9Success = 'success',10Failed = 'failed',11Canceled = 'canceled',12}1314export interface ChatResults {15type: FetchResponseKind.Success;16chatCompletions: AsyncIterable<ChatCompletion>;17}1819export interface ChatRequestFailed {20type: FetchResponseKind.Failed;21modelRequestId: RequestId | undefined;22failKind: ChatFailKind;23reason: string;24data?: Record<string, any>;25}2627export interface ChatRequestCanceled {28type: FetchResponseKind.Canceled;29reason: string;30}3132export enum ChatFailKind {33OffTopic = 'offTopic',34TokenExpiredOrInvalid = 'tokenExpiredOrInvalid',35ServerCanceled = 'serverCanceled',36ClientNotSupported = 'clientNotSupported',37RateLimited = 'rateLimited',38QuotaExceeded = 'quotaExceeded',39ExtensionBlocked = 'extensionBlocked',40ServerError = 'serverError',41ContentFilter = 'contentFilter',42AgentUnauthorized = 'unauthorized',43AgentFailedDependency = 'failedDependency',44ValidationFailed = 'validationFailed',45InvalidPreviousResponseId = 'invalidPreviousResponseId',46NotFound = 'notFound',47Unknown = 'unknown',48}495051