@@ -158,6 +158,14 @@ export interface Message {
158158 content : string
159159 copilot_references : MessageCopilotReference [ ]
160160 copilot_confirmations ?: MessageCopilotConfirmation [ ]
161+ tool_calls ?: {
162+ "function" : {
163+ "arguments" : string ,
164+ "name" : string
165+ } ,
166+ "id" : string ,
167+ "type" : "function"
168+ } [ ]
161169 name ?: string
162170}
163171
@@ -244,6 +252,42 @@ export interface GetUserConfirmationInterface {
244252 ( payload : CopilotRequestPayload ) : UserConfirmation | undefined ;
245253}
246254
255+ // prompt
256+
257+ /** model names supported by Copilot API */
258+ export type ModelName =
259+ | "gpt-4"
260+ | "gpt-3.5-turbo"
261+
262+ export interface PromptFunction {
263+ type : "function"
264+ function : {
265+ name : string ;
266+ description ?: string ;
267+ /** @see https://platform.openai.com/docs/guides/structured-outputs/supported-schemas */
268+ parameters ?: Record < string , unknown > ;
269+ strict ?: boolean | null ;
270+ }
271+ }
272+
273+ export type PromptOptions = {
274+ model : ModelName
275+ token : string
276+ tools ?: PromptFunction [ ]
277+ request ?: {
278+ fetch ?: Function
279+ }
280+ }
281+
282+ export type PromptResult = {
283+ requestId : string
284+ message : Message
285+ }
286+
287+ interface PromptInterface {
288+ ( userPrompt : string , options : PromptOptions ) : Promise < PromptResult > ;
289+ }
290+
247291// exported methods
248292
249293export declare const verifyRequest : VerifyRequestInterface ;
@@ -261,4 +305,6 @@ export declare const parseRequestBody: ParseRequestBodyInterface;
261305export declare const transformPayloadForOpenAICompatibility : TransformPayloadForOpenAICompatibilityInterface ;
262306export declare const verifyAndParseRequest : VerifyAndParseRequestInterface ;
263307export declare const getUserMessage : GetUserMessageInterface ;
264- export declare const getUserConfirmation : GetUserConfirmationInterface ;
308+ export declare const getUserConfirmation : GetUserConfirmationInterface ;
309+
310+ export declare const prompt : PromptInterface ;
0 commit comments