Пример #1
0
        private async Task <string> ProvideLie(string fibPrompt)
        {
            var prompt = $@"Here are some prompts from the game Fibbage, in which players attempt to write convincing lies to trick others.

Q: In the mid-1800s, Queen Victoria employed a man named Jack Black, whose official job title was Royal _______.
A: Flute player

Q: In 2016, KFC announced it created a _______ that smells like fried chicken.
A: Scratch 'n' sniff menu

Q: Due to a habit he had while roaming the halls of the White House, President Lyndon B. Johnson earned the nickname ""_______ Johnson.""
A: Desk Butt

Q: {fibPrompt}
A:";

            var result = await CompletionService.CompletePrompt(prompt, new CompletionParameters
            {
                Temperature      = 0.8,
                MaxTokens        = 16,
                TopP             = 1,
                FrequencyPenalty = 0.2,
                StopSequences    = new[] { "\n" }
            }, completion => !completion.Text.Contains("___") && completion.Text.Length <= 45,
                                                                defaultResponse : "Default Response!");

            return(result.Text.Trim());
        }
Пример #2
0
        private async Task <int> ProvideTruth(string fibPrompt, IReadOnlyList <LieChoice> lies)
        {
            var options = "";

            for (var i = 0; i < lies.Count; i++)
            {
                options += $"{i + 1}. {lies[i].Text}\n";
            }

            var prompt = $@"I was given a list of lies and one truth for the prompt ""${fibPrompt}"". These were my options:

${options}
I think the truth is answer number";

            var result = await CompletionService.CompletePrompt(prompt, new CompletionParameters
            {
                Temperature   = 1,
                MaxTokens     = 1,
                TopP          = 1,
                StopSequences = new[] { "\n" }
            }, completion =>
            {
                try
                {
                    var answer = int.Parse(completion.Text.Trim());
                    return(answer <= lies.Count && answer > 0);
                }
                catch (FormatException)
                {
                    return(false);
                }
            }, defaultResponse : "0");

            return(int.Parse(result.Text.Trim()) - 1);
        }
        private async Task <string> ProvideResponse(string stiPrompt, int maxLength)
        {
            var prompt = $@"In the first part of the game Survive the Internet, players are asked questions which they should answer short and concisely. For example:

Q: How's your retirement fund doing?
A: It's nonexistant.

Q: What are your thoughts on professional wrestling?
A: It's all so fake.

Q: Describe an attitude you admire.
A: I love positive people.

Q: {stiPrompt}
A:";

            LogDebug($"GPT-3 Prompt: {prompt}");

            var result = await CompletionService.CompletePrompt(prompt, new ICompletionService.CompletionParameters
            {
                Temperature      = 0.7,
                MaxTokens        = 32,
                TopP             = 1,
                FrequencyPenalty = 0.3,
                PresencePenalty  = 0.2,
                StopSequences    = new[] { "\n" }
            }, completion => completion.Text.Length <= maxLength,
                                                                defaultResponse : "I dunno");

            return(result.Text.Trim().TrimQuotes().TrimEnd('.'));
        }
        private async Task <string> ProvideImageTwist(TextPrompt stiPrompt, int maxLength)
        {
            var isInstruct  = _configuration.OpenAIEngine.EndsWith("-instruct-beta");
            var description = _descriptionProvider.ProvideDescriptionForImageId(GetImageId(stiPrompt));

            // TODO rewrite, it is ugly :(
            var prompt = isInstruct ?
                         $@"Write an absurd, weird, funny, ridiculous Instagram caption for a photo of {description}." :
                         $@"Below are some responses from the party game Survive the Internet. In the final round, each player takes an image and tries to come up with a caption that would make the other players look crazy or ridiculous.

An absurd and ridiculous Instagram caption for a photo of a group of mailboxes, with one open: Learned how to lock pick earlier. Score!
An absurd and ridiculous Instagram caption for a photo of people's legs through bathroom stalls: Just asked these guys how they were doing. They didn't respond.
An absurd and ridiculous Instagram caption for a photo of a group of people posing for a photo at a funeral: Funeral? I thought this was a party.
An absurd and ridiculous Instagram caption for a photo of {description}:";

            LogDebug($"GPT-3 Prompt: {prompt}");

            var result = await CompletionService.CompletePrompt(prompt, new ICompletionService.CompletionParameters
            {
                Temperature      = 0.7,
                MaxTokens        = 32,
                TopP             = 1,
                FrequencyPenalty = 0.3,
                PresencePenalty  = 0.2,
                StopSequences    = isInstruct ? Array.Empty <string>() : new[] { "\n" }
            }, completion => completion.Text.Length <= maxLength,
                                                                defaultResponse : "I dunno");

            return(result.Text.Trim().TrimQuotes().TrimEnd('.'));
        }
        private async Task <string> ProvideTwist(TextPrompt stiPrompt, int maxLength)
        {
            var prompt = $@"Below are some responses from the party game Survive the Internet. The goal of this game is to take another player's words and twist them to make the other player look ridiculous.

""I'm skeptical"" would be a ridiculous response to this comment: She said yes!
""Too much nudity"" would be a ridiculous comment to a video titled: How to Play Guitar
""Yawn"" would be a terrible comment in response to this news headline: Bank Robber on the Loose
""The bathroom"" would be a ridiculous answer to this question: Where do you cry the most?
""Let's hunt him down"" would be a terrible comment in response to this news headline: Local Man Wins Lottery
""Not that impressive tbh"" would be a ridiculous comment to a video titled: Johnny Learns How to Ride a Bike!
""It's not the most comfortable thing to sit on"" would be a ridiculous review for a product called: 18-inch Wooden Spoon
""{stiPrompt.BlackBox}"" {stiPrompt.BelowBlackBox.ToLower().Trim()}";

            LogDebug($"GPT-3 Prompt: {prompt}");

            var result = await CompletionService.CompletePrompt(prompt, new ICompletionService.CompletionParameters
            {
                Temperature      = 0.7,
                MaxTokens        = 32,
                TopP             = 1,
                FrequencyPenalty = 0.3,
                PresencePenalty  = 0.2,
                StopSequences    = new[] { "\n" }
            }, completion => completion.Text.Length <= maxLength,
                                                                defaultResponse : "I dunno");

            return(result.Text.Trim().TrimQuotes().TrimEnd('.'));
        }
Пример #6
0
        private async Task <string> ProvideSpud(string currentWord)
        {
            var prompt = $@"The game Word Spud is played by continuing a word or phrase with a funny related word or phrase. For example:

- jellyfish
- deal with it
- fishsticks
- beat saber
- tailor-made
- real life
- how do you do
- {currentWord}";

            LogDebug($"GPT-3 Prompt: {prompt}");

            var result = await CompletionService.CompletePrompt(prompt, new CompletionParameters
            {
                Temperature      = 0.8,
                MaxTokens        = 16,
                TopP             = 1,
                FrequencyPenalty = 0.3,
                PresencePenalty  = 0.3,
                StopSequences    = new[] { "\n" }
            }, completion => completion.Text.Trim() != "" && completion.Text.Length <= 32,
                                                                defaultResponse : ".");

            return(result.Text.TrimEnd());
        }
Пример #7
0
        private async Task <string> ProvideDoubleLie(string fibPrompt, string delim, int maxLength)
        {
            var prompt = $@"Here are some prompts from the game Fibbage, in which players attempt to write convincing lies to trick others. These prompts require two responses, separated by the | character.

Q: Researchers at Aalto and Oxfort universities studied the phone records of over 3.2 million Europeans and found that people have the most _______ when they _______.
A: friends|are 25 years old

Q: The controversial Supreme Court case Nix v. Hedden upset more than a few people when the court ruled that _______ are _______.
A: tomatoes|vegetables

Q: In an attempt to teach kids an important lesson, Bernie Karl of Alaska wants to put a _______ of _______ in every public school.
A: box|handguns

Q: {fibPrompt}
A:";

            var result = await CompletionService.CompletePrompt(prompt, new CompletionParameters
            {
                Temperature      = 0.8,
                MaxTokens        = 16,
                TopP             = 1,
                FrequencyPenalty = 0.2,
                StopSequences    = new[] { "\n" }
            }, completion =>
            {
                try
                {
                    var lies = completion.Text.Trim().Split('|');
                    return(lies.Length == 2 && !lies.Any(lie => lie.Length > maxLength));
                }
                catch
                {
                    return(false);
                }
            },
                                                                defaultResponse : "default|response");

            return(string.Join(delim, result.Text.Trim().Split('|')));
        }