#can you show an example of what you re

10 messages ยท Page 1 of 1 (latest)

coarse bough
#
import fs from  'fs'
import { Configuration, OpenAIApi } from "openai"

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);


const inFile = process.argv[2]

console.log("Infile:" , inFile)

const content = fs.readFileSync(inFile)

async function convertByEdit(code) {
    console.log(code)
    const response = await openai.createEdit({
        model: "code-davinci-edit-001",
        instruction: `Convert from enzyme to react testing library\n javascript\n\n`,
        input: `${code}`,
    });
    
    console.log("edit:", response.data.choices.length, response.data.choices[0].finish_reason)
    fs.writeFileSync("/tmp/response.edit.wholefile.ai.json", response.data.choices[0].text)

    return response.data 
}



const promise2 = convertByEdit(content)
await Promise.resolve(promise2)
console.log("done!")
fierce trail
#

what does the enzyme thingy look like @coarse bough

coarse bough
#

sorry ๐Ÿ™‚

#

There you go.

fierce trail
coarse bough
#

Hmm, now it worked ๐Ÿ™‚ Yay!

coarse bough
#

@fierce trail thanks for helping me!

fierce trail