diff --git a/models/summerize_model.py b/models/summerize_model.py index cf37669..6a67344 100644 --- a/models/summerize_model.py +++ b/models/summerize_model.py @@ -1,12 +1,9 @@ import os import google.generativeai as genai +# Simple confiuration down below genai.configure(api_key=os.environ["GEMINI_API_KEY"]) - - - memory = [] - generation_config = { "temperature": 0.85, "top_p": 0.95, @@ -14,13 +11,13 @@ "max_output_tokens": 15200, "response_mime_type": "text/plain", } - model = genai.GenerativeModel( model_name="gemini-1.0-pro", generation_config=generation_config, ) +# This function is used to generate a response from the model def generate_response(prompt): response = model.generate_content([ "Your job is to summerize any text given to you. Do not give any other information than what you know from the text you are given. You are giving the user your summery, but they cannot see what you are summerizing, so be sure to include all the details, but in a consise manner. Just tell them the info you are given, but a summery.", @@ -29,4 +26,4 @@ def generate_response(prompt): ]) memory.append(f"input: {prompt}") memory.append(f"output: {response.text}") - return response.text + return response.text \ No newline at end of file diff --git a/models/text_model.py b/models/text_model.py index 0332d05..b5af92e 100644 --- a/models/text_model.py +++ b/models/text_model.py @@ -1,13 +1,12 @@ import os import google.generativeai as genai +# Basic Configuration dir_path = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.join(dir_path, '..', 'data_files', 'training_data.txt') with open(file_path, 'r') as file: training_data = file.read() - memory = [] - generation_config = { "temperature": 0.85, "top_p": 0.95, @@ -15,13 +14,14 @@ "max_output_tokens": 15000, "response_mime_type": "text/plain", } - model = genai.GenerativeModel( model_name="gemini-1.0-pro", generation_config=generation_config, ) + +# Function to generate a response from the model def generate_response(prompt): response = model.generate_content([ training_data,