redhat-et / copilot-ops

copilot-ops is a CLI tool that boosts up any DevOps repo to a ninja level of Artificially Intelligent Ops Repo
Apache License 2.0
34 stars 13 forks source link

Rework the OpenAI client #72

Closed RobotSail closed 2 years ago

RobotSail commented 2 years ago

It looks like the OpenAI API has been reworked so that endpoints are now simply /v1/completions or /v1/edits, and models are specified as a "model" parameter in the body.

For example, the /edits endpoint:

curl https://api.openai.com/v1/edits \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
  "model": "text-davinci-edit-001",
  "input": "What day of the wek is it?",
  "instruction": "Fix the spelling mistakes"
}'

The /completions endpoint:

curl https://api.openai.com/v1/completions \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
  "model": "code-davinci-002",
  "prompt": "Say this is a test",
  "max_tokens": 5
}'

See: OpenAI Documentation

RobotSail commented 2 years ago

/assign @djach7

djach7 commented 2 years ago

/assign