Navigation X

[.NET] OpenAI Wrapper + Easy + No Fuss

  • USE "RATE LEAK" TO HELP THE STAFF DELETING THREADS WITH NOT WORKING LINKS
 319 Luke

[.NET] OpenAI Wrapper + Easy + No Fuss

by Luke Ghost -
Content locked
This content has been locked. Please login or register in order to unlock it.

Advanced example:

Code:
using System;

namespace OpenAIExample
{
class Program
{
static void Main(string[] args)
{
string apiKey = "your_api_key_here";
string engine = "text-davinci-002";

var openAI = new OpenAIWrapper.OpenAI(apiKey, engine);

var prompt = "What is your favorite movie?";
var maxTokens = 50;
var temperature = 0.5f;
var n = 3;
var stop = ".";
var stream = true;
var presencePenalty = 0.5f;
var bestOf = 2;
var echo = false;

var result = openAI.GenerateText(prompt, maxTokens, temperature, n, stop, stream, presencePenalty, bestOf, echo).Result;

Console.WriteLine(result);
}
}
}
prompt: A string that provides the starting point for the generated text.

maxTokens: An integer that specifies the maximum number of tokens (words or punctuation) to generate.

temperature: A float that controls the randomness of the generated text. A value of 0 generates text that is very deterministic, while a value of 1 generates text that is very random.

n: An integer that specifies the number of text samples to generate.

stop: A string that defines a sequence of characters that will stop the generation if encountered.

stream: A boolean that specifies whether to generate text one token at a time (streaming) or all at once.

presencePenalty: A float that specifies a penalty for generating tokens that are already present in the prompt.

bestOf: An integer that specifies the number of generated samples to keep. The best samples, as determined by the API, are kept.

echo: A boolean that specifies whether to include the prompt in the generated text
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar Threads

  [Source Code VB.Net/C#] Convert Byte() to Bitmap or Image
Luke Ghost
0
Replies
201
Views
0

Last Post: Luke Ghost


Top Bottom