srcnalt / OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
MIT License
672 stars 150 forks source link

Readme is invalid #51

Closed Morgan-6Freedom closed 1 year ago

Morgan-6Freedom commented 1 year ago
var req = new CreateCompletionRequest{
    Model = "text-davinci-003",
    Prompt = "Say this is a test.",
    MaxTokens = 7,
    Temperature = 0
};

openai.CreateCompletionAsync(req, 
    (responses) => {
        var result = string.Join("", responses.Select(response => response.Choices[0].Delta.Content));
        Debug.Log(result);
    }, 
    () => {
        Debug.Log("completed");
    }, 
    new CancellationTokenSource());
}

Should be

var req = new CreateCompletionRequest{
    Model = "text-davinci-003",
    Prompt = "Say this is a test.",
    MaxTokens = 7,
    Temperature = 0
};

openai.CreateCompletionAsync(req, 
    (responses) => {
        var result = string.Join("", responses.Select(response => response.Choices[0].Text));
        Debug.Log(result);
    }, 
    () => {
        Debug.Log("completed");
    }, 
    new CancellationTokenSource());
}
srcnalt commented 1 year ago

Updated.