mirror of https://github.com/knrd1/chatgpt.git
system role support
This commit is contained in:
parent
3dd7456696
commit
b8ccf067a7
|
@ -20,6 +20,10 @@ $ cp example-chat.conf chat.conf
|
|||
### Configuration:
|
||||
|
||||
Edit chat.conf and change variables. Example configuration for IRCNet:
|
||||
|
||||
**There is a new variable "context", it's optional: you can leave it blank or enter what you want the bot to know and how you want the bot to behave.**
|
||||
|
||||
**e.g.: You are an ironic and arrogant bot on the #linux channel, James and Mark are on the channel with you. James loves to play guitar and Mark is a footballer. You speak Scottish slang.**
|
||||
```
|
||||
[openai]
|
||||
api_key = sk-XXXXXXXXXXXXXXX
|
||||
|
@ -27,6 +31,7 @@ api_key = sk-XXXXXXXXXXXXXXX
|
|||
[chatcompletion]
|
||||
model = gpt-3.5-turbo
|
||||
role = user
|
||||
context = You are a helpful and friendly bot on IRC channel #linux.
|
||||
temperature = 0.8
|
||||
max_tokens = 1000
|
||||
top_p = 1
|
||||
|
|
|
@ -22,6 +22,7 @@ top_p = config.getint('chatcompletion', 'top_p')
|
|||
frequency_penalty = config.getint('chatcompletion', 'frequency_penalty')
|
||||
presence_penalty = config.getint('chatcompletion', 'presence_penalty')
|
||||
request_timeout = config.getint('chatcompletion', 'request_timeout')
|
||||
context = config.get('chatcompletion', 'context')
|
||||
|
||||
# Set up IRC connection settings
|
||||
server = config.get('irc', 'server')
|
||||
|
@ -102,7 +103,7 @@ while True:
|
|||
try:
|
||||
response = openai.ChatCompletion.create(
|
||||
model=model,
|
||||
messages=[{"role": role, "content": question}],
|
||||
messages=[{"role": "system", "content": context}, {"role": "user", "content": question}],
|
||||
temperature=temperature,
|
||||
max_tokens=max_tokens,
|
||||
top_p=top_p,
|
||||
|
|
|
@ -4,6 +4,7 @@ api_key = sk-XXXXXXXXXXXXXXX
|
|||
[chatcompletion]
|
||||
model = gpt-3.5-turbo
|
||||
role = user
|
||||
context = You are helpful and friendly bot on IRC channel #linux.
|
||||
temperature = 0.8
|
||||
max_tokens = 1000
|
||||
top_p = 1
|
||||
|
@ -15,7 +16,7 @@ request_timeout = 60
|
|||
server = open.ircnet.net
|
||||
port = 6667
|
||||
ssl = false
|
||||
channels = #knrd1,#github
|
||||
channels = #linux,#github
|
||||
nickname = MyBot
|
||||
ident = mybot
|
||||
realname = My Bot
|
||||
|
|
Loading…
Reference in New Issue