Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_prompt():

def get_test_email():
try:
with open('data/email-001-ko.txt', 'r') as file:
with open('data/email-001-ko.txt', 'r', encoding='utf-8') as file:
email_content = file.read()
except FileNotFoundError:
email_content = "Error: File not found!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ def initialize_model():
api_key = os.getenv('API_KEY')
if not api_key:
raise ValueError("API_KEY environment variable not found. Did you set it in your .env file?")

genai.configure(api_key=api_key)
return genai.GenerativeModel('gemini-1.5-flash') # Return the initialized model

model = genai.GenerativeModel('gemini-2.5-flash')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and avoid using 'magic strings', it's a good practice to define the model name 'gemini-2.5-flash' as a constant at the module level (e.g., GEMINI_MODEL_NAME = 'gemini-2.5-flash'). This makes it easier to locate and update the model name in the future if it changes again.

return model

def create_message_processor():
"""Creates a message processor function with a persistent model."""
Expand Down