-
Notifications
You must be signed in to change notification settings - Fork 0
cleaned up the code to support different embedding model #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleaned up the code to support different embedding model #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
src/innieme/document_processor.py
Outdated
| def __init__(self, docs_dir, embedding_config={}): | ||
| self.docs_dir = docs_dir | ||
| self.embedding_type = embedding_type | ||
| self.embedding_config = embedding_config or {} | ||
| self.embedding_config = embedding_config |
Copilot
AI
Apr 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a mutable default argument for embedding_config can lead to unexpected behavior. Consider using None as the default value and initializing with {} inside the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
| # Only import if needed | ||
| from langchain_openai import OpenAIEmbeddings | ||
| api_key = self.embedding_config.get("api_key", os.getenv("OPENAI_API_KEY")) | ||
| api_key = self.embedding_config["api_key"] |
Copilot
AI
Apr 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the fallback using os.getenv may lead to a KeyError when the API key is not provided. Consider restoring fallback behavior by using self.embedding_config.get('api_key', os.getenv('OPENAI_API_KEY')).
| api_key = self.embedding_config["api_key"] | |
| api_key = self.embedding_config.get('api_key', os.getenv('OPENAI_API_KEY')) |
No description provided.