Description
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:
const stream = await octokit.copilot.completions.create({...});
for await (const chunk of stream) {
process.stdout.write(chunk?...);
}
curl for completions:
curl --request POST \
--url https://api.githubcopilot.com/chat/completions \
--header 'Authorization: Bearer SUPERSECRET' \
--header 'Content-Type: application/json' \
--header 'Copilot-Integration-Id: dev' \
--data '{
"messages": [{ "role": "user", "content": "What'\''s the weather like today?" }],
"max_tokens": 50,
"temperature": 0.5
}'