From ddc23e7c10bcacb26379922188271129ccb6c583 Mon Sep 17 00:00:00 2001 From: Rene Teigen Date: Tue, 3 Jan 2023 20:15:27 +0000 Subject: [PATCH] Added some print to send_request and fixed the top_p description --- cogs/gpt_3_commands_and_converser.py | 8 ++++---- models/openai_model.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index 8dff2e3..2a95c22 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -713,16 +713,16 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): name="prompt", description="The prompt to send to GPT3", required=True ) @discord.option( - name="temperature", description="Higher values means the model will take more risks.", required=False, input_type=float, min_value=0, max_value=1 + name="temperature", description="Higher values means the model will take more risks", required=False, input_type=float, min_value=0, max_value=1 ) @discord.option( - name="top_p", description="Higher values means the model will take more risks.", required=False, input_type=float, min_value=0, max_value=1 + name="top_p", description="1 is greedy sampling, 0.1 means only considering the top 10% of probability distribution", required=False, input_type=float, min_value=0, max_value=1 ) @discord.option( - name="frequency_penalty", description=" Decreasing the model's likelihood to repeat the same line verbatim.", required=False, input_type=float, min_value=-2, max_value=2 + name="frequency_penalty", description="Decreasing the model's likelihood to repeat the same line verbatim", required=False, input_type=float, min_value=-2, max_value=2 ) @discord.option( - name="presence_penalty", description=" Increasing the model's likelihood to talk about new topics.", required=False, input_type=float, min_value=-2, max_value=2 + name="presence_penalty", description="Increasing the model's likelihood to talk about new topics", required=False, input_type=float, min_value=-2, max_value=2 ) @discord.guild_only() async def ask(self, ctx: discord.ApplicationContext, prompt: str, temperature: float, top_p:float, frequency_penalty: float, presence_penalty: float): diff --git a/models/openai_model.py b/models/openai_model.py index 96d2d6e..5c430ca 100644 --- a/models/openai_model.py +++ b/models/openai_model.py @@ -398,7 +398,8 @@ class Model: "https://api.openai.com/v1/completions", json=payload, headers=headers ) as resp: response = await resp.json() - print(response) + print(f"Payload -> {payload}") + print(f"Response -> {response}") # Parse the total tokens used for this request and response pair from the response tokens_used = int(response["usage"]["total_tokens"]) self.usage_service.update_usage(tokens_used)