Open alexisabril opened 2 weeks ago
I figured we could add a prompt
API as specced in the link above (WIP) to the context of the copilot extension SDK's event handlers, see https://github.com/copilot-extensions/preview-sdk.js/blob/main/dreamcode.md#api
Relevant part as of now (dreamcode.md
will likely change soon):
// https://github.com/github/copilot-partners/blob/6d1cde3a1abb147da53f1a39864661dc824d40b5/docs/confirmations.md
copilotExtension.on(
"confirmation",
async ({ confirmation, octokit, prompt, respond, log }) => {
if (confirmation.id === "joke") {
if (confirmation.state === "dismissed") {
await respond.text("Okay, maybe next time!");
return;
}
await respond.text(
prompt.stream("Please tell me a joke about Mona Lisa, Github's mascot.")
);
return;
}
log.warn("Received an unknown confirmation:", confirmation.id);
await respond.text("Hmm, something went wrong. Please try again later.");
}
);
Not sure what the best way will be yet, but I want the prompt and response APIs to work together nicely.
Similar to the Octokit REST APIs, a method could exist to invoke the
completions
API for 3P integrators.For potential consistency, here an OpenAI-inspired version:
curl for completions: