From ba457fc9a07a38afb412f06256a1ece8ec436568 Mon Sep 17 00:00:00 2001 From: ian <104332334+iankengott@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:11:15 -0400 Subject: [PATCH 1/5] Update main.py --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 9b8ad2e..e11862e 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,10 @@ import discord from discord.ext import commands import os -import Paginator +#import Paginator from model import main - +from dotenv import load_dotenv +load_dotenv() intents = discord.Intents.default() intents.message_content = True intents.members = True @@ -32,4 +33,4 @@ async def peer(ctx, arg): new_embed = discord.Embed(title="Not The Right Channel!", description=output, color=3447003) return await ctx.send(embed=new_embed) -bot.run(os.environ['BOT_TOKEN']) +bot.run(os.getenv('product_spec_bot')) From fa3f8f778676981282ab1b33aa89a64fafc304d4 Mon Sep 17 00:00:00 2001 From: ian <104332334+iankengott@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:12:11 -0400 Subject: [PATCH 2/5] Update model.py --- model.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/model.py b/model.py index 0e5b601..a63422c 100644 --- a/model.py +++ b/model.py @@ -1,10 +1,12 @@ +from dotenv import load_dotenv from notion_extraction import extract_product_spec_text, parse_product_spec_text, extract_id_from_url from prompts import happy_path, milestones, problem, schedule, solution, success_criteria, target_users, tech_stack import requests import os import openai - -openai.api_key = os.environ['OPENAI_API_KEY1'] +from dotenv import load_dotenv +load_dotenv() +openai.api_key = os.getenv('OPENAI_API_KEY1') def main(url): @@ -56,4 +58,4 @@ def main(url): return feedback_summary["choices"][0]["text"] """ - return feedbacks \ No newline at end of file + return feedbacks From 0b8fc4c8d1a664550283f3be29125084df80600c Mon Sep 17 00:00:00 2001 From: ian <104332334+iankengott@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:12:49 -0400 Subject: [PATCH 3/5] Update notion_extraction.py --- notion_extraction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notion_extraction.py b/notion_extraction.py index c049ac9..03c96d9 100644 --- a/notion_extraction.py +++ b/notion_extraction.py @@ -1,7 +1,10 @@ import requests import os +from dotenv import load_dotenv -notion_token = os.environ['NOTION_TOKEN1'] + +load_dotenv() +notion_token = os.getenv('NOTION_TOKEN') def extract_id_from_url(url): return url.split('-')[-1] From 67a554170620bd62b466393ffde786981f68485c Mon Sep 17 00:00:00 2001 From: ian <104332334+iankengott@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:14:30 -0400 Subject: [PATCH 4/5] Update main.py --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e11862e..474eeb9 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ import discord from discord.ext import commands import os -#import Paginator +import Paginator from model import main from dotenv import load_dotenv load_dotenv() From 1b1ed467ba9b6ae7d31ffdb35ecf82d41e305b4c Mon Sep 17 00:00:00 2001 From: ian <104332334+iankengott@users.noreply.github.com> Date: Sun, 6 Nov 2022 18:22:42 -0500 Subject: [PATCH 5/5] Update notion_extraction.py --- notion_extraction.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/notion_extraction.py b/notion_extraction.py index 03c96d9..693521a 100644 --- a/notion_extraction.py +++ b/notion_extraction.py @@ -1,6 +1,8 @@ import requests import os from dotenv import load_dotenv +import openai +import time load_dotenv() @@ -72,15 +74,39 @@ def match_name_to_label(name): # Matches a name to a product spec label highest_similarity_score = 0 most_similar = None - for label in labels: # Finds the label with the highest similarity score + openai.api_key = os.getenv("OPENAI_API_KEY1") + + labels = ['Problem Statement', 'Solution Statement', 'Who Has This Problem?', 'Success Criteria', 'Success Metrics', 'Milestones', 'Schedule of Deliverables', 'Tech Stack', 'Happy Path'] + + questionable_header = name + response = openai.Completion.create( + model="text-curie-001", + prompt=f"prompt: answer the following question only using the header_list, then say where they are in the list\n\nheader_list: 'Problem Statement', 'Solution Statement', 'Who Has This Problem?', 'Success Criteria', 'Success Metrics', 'Milestones', 'Schedule of Deliverables', 'Tech Stack', 'Happy Path'\n\nquestion: out of the header_list which one is most similar to the header \"Other Ideas Further areas of improvement:\"?\n\noutput: \"Other Ideas Further areas of improvement\" is most similar to the header \"Milestones\". milestones is the sixth in header_list\n\nquestion: out of the header_list which one is most similar to the header \"Success Criteria\"?\n\noutput: \"Success Criteria\" is most similar to the header \"Success Criteria\" Success Criteria is the fourth in header_list.\n\nquestion: out of the header_list which one is most similar to the header \"What The Product Will Not Do\"?\n\noutput: \"What The Product Will Not Do\" is most similar to the header \"Success Criteria\" Success Criteria is the fourth in header_list.\n\nquestion: out of the header_list which one is most similar to the header \"{questionable_header}\"?\n\noutput: \"{questionable_header}\" is most similar to the header ", + temperature=1, + max_tokens=75, + top_p=1, + frequency_penalty=0, + presence_penalty=0 + ) + corrected_header = response["choices"][0]["text"] + redone_lables = corrected_header.replace('"',"") + for x in labels: + if x in redone_lables: + print('ai generated labels worked', x) + return x + + for y in range(2): print('jacard runnging as backup for[gtp3 failure]') + print(f"'{redone_lables}' is the out come of '{questionable_header}' delete this line of code later") + for label in labels: # Finds the label with the highest similarity score + similarity_score = jaccard_similarity(label.split(), name.split()) - + if similarity_score > highest_similarity_score: - + most_similar = label highest_similarity_score = similarity_score - + return most_similar