Skip to content

Wrap completions API #5

Open
1 of 4 issues completed
Open
Batch
1 of 4 issues completed
@alexisabril

Description

@alexisabril

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
}'

Sub-issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions