🐛 fix(ChatProcess.py): import missing 'characters' module from src.utils.variousclasses to fix NameError

 feat(ChatProcess.py): add support for custom temperature for each character in the 'characters' module to improve chat responses
🐛 fix(openaiChat.py): add 'temperature' parameter to the 'openaiChat' function to allow custom temperature for generating responses
🐛 fix(request.py): add 'custom_temp' parameter to the 'request' function to pass custom temperature to 'openaiChat' function
🐛 fix(openaicaller.py): reduce sleep time from 10 seconds to 5 seconds for retrying API calls to improve responsiveness
 feat(variousclasses.py): add 'custom_temp' dictionary to store custom temperature values for each character to improve chat responses
This commit is contained in:
2023-09-04 12:19:08 +02:00
parent c434483c22
commit 0c182d82c2
5 changed files with 17 additions and 8 deletions

View File

@@ -2,12 +2,14 @@ import orjson
from src.utils.openaicaller import openai_caller
async def openaiChat(messages, functions, openai_api_key, model="gpt-3.5-turbo"):
async def openaiChat(
messages, functions, openai_api_key, model="gpt-3.5-turbo", temperature=1.2
):
caller = openai_caller()
response = await caller.generate_response(
api_key=openai_api_key,
model=model,
temperature=1.3,
temperature=temperature,
messages=messages,
functions=functions,
function_call="auto",

View File

@@ -14,6 +14,7 @@ async def request(
prompt: list[dict] | str,
openai_api_key: str,
funtcions: list[dict] = None,
custom_temp: float = 1.2,
):
if model == "gpt-3.5-turbo":
return await openaiChat(
@@ -21,6 +22,7 @@ async def request(
openai_api_key=openai_api_key,
functions=funtcions,
model=model,
temperature=custom_temp,
)
elif model == "text-davinci-003":
# return await openaiText(prompt=prompt, openai_api_key=openai_api_key)