#replying with completely irrelevant text.

51 messages · Page 1 of 1 (latest)

tacit dust
#

set up a bot to reply through discord, That's not a greeting I've heard before 😂

really though I have no idea what's going on, I'm in way over my head here coding wise and chatgpt itself has written most of it if I'm honest 😅

#

I can send the code here if needed :)

misty agate
#

Can you send the code for the completion request? Print out what the prompt is beforehand for one of these messages in the chat as well and show me, also, what are the model settings set to?

tacit dust
#

is this the completion request code?
@client.event
async def on_message(message):
try:
# Ignore messages from the bot itself or messages without the prefix
if message.author == client.user:
return

    else:
        prompt = message.content
    response = openai.Completion.create(
        engine="davinci",
        prompt=prompt,
        max_tokens=50
    )
    print(prompt)

    # Send GPT response back to the user
    await message.channel.send(response.choices[0].text)
    print(f"Sent response: {response.choices[0].text}")
except Exception as e:
    print(f"Error: {e}")
#

I dont quite know how to get it to print the prompt out, i've tried in all the ways that I know but it wont work, and I cant ask chatgpt like I usually would because its at capacity :(

#

I also dont know what you mean by the model settings 🥲

#

i'm sorry, I really dont know what i'm doing

#

but any help you can give i'll take and highly appreciate

#

btw, if you dont want to take all the time to explain difficult coding stuff to a noob like me I totally get it, there are people with more important and easier to solve issues out there

misty agate
#

That completion request takes in a model parameter

#

here's some documentation

#

actually sorry, there is an engine parameter but it's buggy

#

try replacing engine="davinci" with model="text-davinci-003"

misty agate
tacit dust
#

prompt = message.content right? its taking the discord message and putting it in the prompt variable, which then gets used as the prompt for gpt

#

thats my understanding of it anyway

#

also I swapped 'engine=davinci' with model="text-davinci-003" but it seemed to have no effect

misty agate
tacit dust
#

all good :)

misty agate
tacit dust
#

is 100 good?

misty agate
#

Try 1024

tacit dust
#

alright, also where do I add the parameters? 😅

#

nvm got it

misty agate
#

inside openai.Completion.create(

#

yeah

tacit dust
#

same thing but a lot longer lol, I said 'test' and got some company's privacy policy, and I said 'hello, how are you' and got some javascript

#

have I done it right?
@client.event
async def on_message(message):
try:
if message.author == client.user:
return

    else:
        prompt = message.content
        print(prompt)
    response = openai.Completion.create(
        model="text-davinci-003",
        prompt=prompt,
        max_tokens=1024,
        temperature=1,
        top_p=1
    )

    await message.channel.send(response.choices[0].text)
    print(f"Sent response: {response.choices[0].text}")
except Exception as e:
    print(f"Error: {e}")
#

pycharm says there's no errors or warnings but maybe its something else

tacit dust
#

do you think its a me thing or not a me thing

tacit dust
#

Is there anyone around who can help?

hard bluff
#

It contains the source code files for a discord bot using the openai api and using flask to serve responses.

#

result:

hard bluff
#

press show files button.

#

that will show the source code.

tacit dust
#

ahhhh there we go

#

thank you so much

hard bluff
#

the code is a bit messy,

#

but it serves me well.

#

maybe i'll improve that when i have time

tacit dust
#

yea i'm not well versed enough in coding to know how this works, I really appreciate your help though :)

misty agate
tacit dust
#

more javascript :(

#

just realised no matter what i set the settings to its not only spitting out one bit of javascript

#

package com.example.demo.controller;

import com.example.demo.model.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

@Autowired
private UserService userService;

@GetMapping("/all")
public List<User> getAllUsers(){
    return userService.getAllUsers();
}

@PostMapping("/add")
public void addUser(@RequestBody User user){
    userService.addUser(user);
}

@PutMapping("/update")
public void updateUser(@RequestBody User user){
    userService.updateUser(user);
}

@DeleteMapping("/delete/{id}")
public void deleteUser(@PathVariable int id){
    userService.deleteUser(id);
}

}

#

idk if it has anything to do with anything but eh

hard bluff