type Author = "user" | "bot"; type SendMessageOptions = { conversationId?: string; clientId?: string; conversationSignature?: string; invocationId?: string; messageType?: string; variant?: string; locale?: string; market?: string; region?: string; location?: { lat: number | string; lng: number | string; re?: string; }; onProgress?: (partialResponse: ChatMessage) => void; }; interface ChatMessage { id: string; text: string; author: Author; conversationId: string; clientId: string; conversationSignature: string; conversationExpiryTime?: string; invocationId?: string; messageType?: string; variant?: string; detail?: ChatMessageFull | ChatMessagePartial; } interface ConversationResult { conversationId: string; clientId: string; conversationSignature: string; result: APIResult; } interface APIResult { value: string; message: null; } interface ChatUpdate { type: 1; target: string; arguments: ChatUpdateArgument[]; } interface ChatUpdateArgument { messages: ChatMessagePartial[]; requestId: string; result: null; } interface ChatMessagePartial { text: string; author: Author; createdAt: string; timestamp: string; messageId: string; offense: string; adaptiveCards: AdaptiveCard[]; sourceAttributions: any[]; feedback: ChatMessageFeedback; contentOrigin: string; privacy?: null; messageType?: string; } interface AdaptiveCard { type: string; version: string; body: AdaptiveCardBody[]; } interface AdaptiveCardBody { type: string; text: string; wrap: boolean; } interface ChatMessageFeedback { tag: null; updatedOn: null; type: string; } interface ChatUpdateCompleteResponse { type: 2; invocationId: string; item: ChatResponseItem; } interface ChatResponseItem { messages: ChatMessageFull[]; firstNewMessageIndex: number; suggestedResponses: null; conversationId: string; requestId: string; conversationExpiryTime: string; telemetry: Telemetry; result: ChatRequestResult; } interface ChatMessageFull { text: string; author: Author; from?: ChatMessageFrom; createdAt: string; timestamp: string; locale?: string; market?: string; region?: string; location?: string; locationHints?: LocationHint[]; messageId: string; requestId: string; offense: string; feedback: ChatMessageFeedback; contentOrigin: string; privacy?: null; inputMethod?: string; adaptiveCards?: AdaptiveCard[]; sourceAttributions?: any[]; suggestedResponses?: SuggestedResponse[]; messageType?: string; } interface ChatMessageFrom { id: string; name: null; } interface LocationHint { country: string; countryConfidence: number; state: string; city: string; cityConfidence: number; zipCode: string; timeZoneOffset: number; dma: number; sourceType: number; center: Coords; regionType: number; } interface Coords { latitude: number; longitude: number; height: null; } interface SuggestedResponse { text: string; messageId: string; messageType: string; contentOrigin: string; author?: Author; createdAt?: string; timestamp?: string; offense?: string; feedback?: ChatMessageFeedback; privacy?: null; } interface ChatRequestResult { value: string; serviceVersion: string; } interface Telemetry { metrics?: null; startTime: string; } interface ChatRequest { arguments: ChatRequestArgument[]; invocationId: string; target: string; type: number; } interface ChatRequestArgument { source: string; optionsSets: string[]; allowedMessageTypes: string[]; sliceIds: any[]; traceId: string; isStartOfSession: boolean; message: ChatRequestMessage; conversationSignature: string; participant: Participant; conversationId: string; previousMessages: PreviousMessage[]; } interface ChatRequestMessage { locale: string; market: string; region?: string; location?: string; locationHints?: LocationHintChatRequestMessage[]; timestamp: string; author: Author; inputMethod: string; text: string; messageType: string; } interface LocationHintChatRequestMessage { country: string; state: string; city: string; zipcode: string; timezoneoffset: number; dma: number; countryConfidence: number; cityConfidence: number; Center: Center; RegionType: number; SourceType: number; } interface Center { Latitude: number; Longitude: number; } interface Participant { id: string; } interface PreviousMessage { text: string; author: Author; adaptiveCards: any[]; suggestedResponses: SuggestedResponse[]; messageId: string; messageType: string; } declare class BingChat { protected _cookie: string; protected _debug: boolean; constructor(opts: { cookie: string | undefined; /** @defaultValue `false` **/ debug?: boolean; }); /** * Sends a message to Bing Chat, waits for the response to resolve, and returns * the response. * * If you want to receive a stream of partial responses, use `opts.onProgress`. * * @param message - The prompt message to send * @param opts.conversationId - Optional ID of a conversation to continue (defaults to a random UUID) * @param opts.onProgress - Optional callback which will be invoked every time the partial response is updated * * @returns The response from Bing Chat */ sendMessage(text: string, opts?: SendMessageOptions): Promise; createConversation(): Promise; } export { APIResult, AdaptiveCard, AdaptiveCardBody, Author, BingChat, Center, ChatMessage, ChatMessageFeedback, ChatMessageFrom, ChatMessageFull, ChatMessagePartial, ChatRequest, ChatRequestArgument, ChatRequestMessage, ChatRequestResult, ChatResponseItem, ChatUpdate, ChatUpdateArgument, ChatUpdateCompleteResponse, ConversationResult, Coords, LocationHint, LocationHintChatRequestMessage, Participant, PreviousMessage, SendMessageOptions, SuggestedResponse, Telemetry, };