Conversation
db62b9b to
4c8fc6e
Compare
zurfjereluhmie
requested changes
Mar 19, 2026
| model="gpt-4o", | ||
| temperature=0, | ||
| api_key=os.getenv("OPENAI_API_KEY") | ||
| api_key="sk-..." |
Member
There was a problem hiding this comment.
Suggested change
| api_key="sk-..." | |
| api_key=os.getenv("LLM_API_KEY") |
| if not os.getenv("LLM_API_KEY"): | ||
| pytest.skip("LLM_API_KEY not set") | ||
| set_llm_cache(InMemoryCache()) | ||
| llm = init_chat_model(model="gpt-4o", model_provider="openai", temperature=0) |
Member
There was a problem hiding this comment.
Since this PR introduces independence from the LLM provider, shouldn’t this also apply to the tests ?
| return | ||
|
|
||
| # Initialize LLM | ||
| print("🔄 Initializing etter...") |
Member
There was a problem hiding this comment.
I think it was nice to catch early undefined env varaibles. Plus we get correct typing this way
Suggested change
| print("🔄 Initializing etter...") | |
| print("🔄 Initializing etter...") | |
| LLM_API_KEY = os.getenv("LLM_API_KEY") | |
| if not LLM_API_KEY: | |
| print("❌ LLM_API_KEY not set. Please set it in your .env file.") | |
| return | |
| LLM_MODEL = os.getenv("LLM_MODEL", "gpt-4o") | |
| if not LLM_MODEL: | |
| print("❌ LLM_MODEL not set. Please set it in your .env file.") | |
| return |
Comment on lines
+53
to
+55
| model=os.getenv("LLM_MODEL"), | ||
| temperature=0, | ||
| api_key=os.getenv("LLM_API_KEY"), |
Member
There was a problem hiding this comment.
Suggested change
| model=os.getenv("LLM_MODEL"), | |
| temperature=0, | |
| api_key=os.getenv("LLM_API_KEY"), | |
| model=LLM_MODEL, | |
| temperature=0, | |
| api_key=LLM_API_KEY, |
|
|
||
| # Initialize etter components | ||
| llm = ChatOpenAI(model="gpt-4o", temperature=0) | ||
| llm = init_chat_model(model=os.getenv("LLM_MODEL"), temperature=0, api_key=os.getenv("LLM_API_KEY")) |
Member
There was a problem hiding this comment.
By checking for the env variables early we can provide a str to init_chat_model which return a BaseChatModel instad of a _ConfigurableModel and so the typing is correct.
Suggested change
| llm = init_chat_model(model=os.getenv("LLM_MODEL"), temperature=0, api_key=os.getenv("LLM_API_KEY")) | |
| LLM_API_KEY = os.getenv("LLM_API_KEY") | |
| if not LLM_API_KEY: | |
| print("❌ LLM_API_KEY not set. Please set it in your .env file.") | |
| return | |
| LLM_MODEL = os.getenv("LLM_MODEL", "gpt-4o") | |
| if not LLM_MODEL: | |
| print("❌ LLM_MODEL not set. Please set it in your .env file.") | |
| return | |
| llm = init_chat_model(model=LLM_MODEL, temperature=0, api_key=LLM_API_KEY) |
| if not os.getenv("LLM_API_KEY"): | ||
| pytest.skip("LLM_API_KEY not set") | ||
| set_llm_cache(InMemoryCache()) | ||
| llm = init_chat_model(model="gpt-4o", model_provider="openai", temperature=0) |
Member
There was a problem hiding this comment.
Required to pass the API key for it to work
Suggested change
| llm = init_chat_model(model="gpt-4o", model_provider="openai", temperature=0) | |
| llm = init_chat_model(model="gpt-4o", model_provider="openai", temperature=0, api_key=os.getenv("LLM_API_KEY")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.