#API for modifying code

4 messages · Page 1 of 1 (latest)

spice escarp
#

I'm having trouble using the API to modify code. Could anyone please help? Here is a sample case that I made for it:

openai.createEdit({
    model: "code-davinci-edit-001",
    input: `className={classNames + "dfasdfas test-comp"}`,
    instruction: `remove the class "test-comp-2" if it exists`,
    temperature: 0
  }

Returns:

choices: [
    {
      text: 'className={classNames + "dfasdfas test-comp test-comp-2"}\n',
      index: 0
    }
  ],

Am I using the right API/model?

dark sequoia
#

Have you tried with different prompts? It seems that it is returning correctly. ~code-davincin-edit-001 is not too powerful, so you may want to check out the different models on playground to see what works the best for you~

spice escarp
#

What are the other code models that I should potentially use for code editing? It seems that's the only one I could find for code specifically

dark sequoia