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:
|
### Configuration:
|
||||||
|
|
||||||
Edit chat.conf and change variables. Example configuration for IRCNet:
|
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]
|
[openai]
|
||||||
api_key = sk-XXXXXXXXXXXXXXX
|
api_key = sk-XXXXXXXXXXXXXXX
|
||||||
|
@ -27,6 +31,7 @@ api_key = sk-XXXXXXXXXXXXXXX
|
||||||
[chatcompletion]
|
[chatcompletion]
|
||||||
model = gpt-3.5-turbo
|
model = gpt-3.5-turbo
|
||||||
role = user
|
role = user
|
||||||
|
context = You are a helpful and friendly bot on IRC channel #linux.
|
||||||
temperature = 0.8
|
temperature = 0.8
|
||||||
max_tokens = 1000
|
max_tokens = 1000
|
||||||
top_p = 1
|
top_p = 1
|
||||||
|
|
|
@ -22,6 +22,7 @@ top_p = config.getint('chatcompletion', 'top_p')
|
||||||
frequency_penalty = config.getint('chatcompletion', 'frequency_penalty')
|
frequency_penalty = config.getint('chatcompletion', 'frequency_penalty')
|
||||||
presence_penalty = config.getint('chatcompletion', 'presence_penalty')
|
presence_penalty = config.getint('chatcompletion', 'presence_penalty')
|
||||||
request_timeout = config.getint('chatcompletion', 'request_timeout')
|
request_timeout = config.getint('chatcompletion', 'request_timeout')
|
||||||
|
context = config.get('chatcompletion', 'context')
|
||||||
|
|
||||||
# Set up IRC connection settings
|
# Set up IRC connection settings
|
||||||
server = config.get('irc', 'server')
|
server = config.get('irc', 'server')
|
||||||
|
@ -102,7 +103,7 @@ while True:
|
||||||
try:
|
try:
|
||||||
response = openai.ChatCompletion.create(
|
response = openai.ChatCompletion.create(
|
||||||
model=model,
|
model=model,
|
||||||
messages=[{"role": role, "content": question}],
|
messages=[{"role": "system", "content": context}, {"role": "user", "content": question}],
|
||||||
temperature=temperature,
|
temperature=temperature,
|
||||||
max_tokens=max_tokens,
|
max_tokens=max_tokens,
|
||||||
top_p=top_p,
|
top_p=top_p,
|
||||||
|
|
|
@ -4,6 +4,7 @@ api_key = sk-XXXXXXXXXXXXXXX
|
||||||
[chatcompletion]
|
[chatcompletion]
|
||||||
model = gpt-3.5-turbo
|
model = gpt-3.5-turbo
|
||||||
role = user
|
role = user
|
||||||
|
context = You are helpful and friendly bot on IRC channel #linux.
|
||||||
temperature = 0.8
|
temperature = 0.8
|
||||||
max_tokens = 1000
|
max_tokens = 1000
|
||||||
top_p = 1
|
top_p = 1
|
||||||
|
@ -15,7 +16,7 @@ request_timeout = 60
|
||||||
server = open.ircnet.net
|
server = open.ircnet.net
|
||||||
port = 6667
|
port = 6667
|
||||||
ssl = false
|
ssl = false
|
||||||
channels = #knrd1,#github
|
channels = #linux,#github
|
||||||
nickname = MyBot
|
nickname = MyBot
|
||||||
ident = mybot
|
ident = mybot
|
||||||
realname = My Bot
|
realname = My Bot
|
||||||
|
|
Loading…
Reference in New Issue