Closed
Conversation
- Fixed embeddings.py: The issue was that when using OPENAI_API_KEY, the code was still looking up AZURE_OPENAI_ENDPOINT_EMBEDDING for the base URL. Now it correctly uses OPENAI_BASE_URL for standard OpenAI (which can be left unset for the default OpenAI API endpoint). - Fixed provider.py: sqllite transaction did not work on windows - release.py: just make format changes
There was a problem hiding this comment.
Pull request overview
This PR fixes configuration and database handling issues in demo scripts and core components to prepare for a conference talk. The changes ensure proper environment variable loading, correct OpenAI API endpoint resolution, and improved SQLite transaction handling for corrupt databases.
Changes:
- Added dotenv loading to demo scripts (ingest.py and query.py) to properly load environment variables
- Fixed embeddings.py to correctly use OPENAI_BASE_URL for standard OpenAI instead of incorrectly looking up AZURE_OPENAI_ENDPOINT_EMBEDDING when OPENAI_API_KEY is set
- Updated SQLite connection to use isolation_level=None for manual transaction control to handle corrupt database files with open transactions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| examples/demo/ingest.py | Added dotenv import and load_dotenv() call to load environment variables |
| examples/demo/query.py | Added dotenv import and load_dotenv() call to load environment variables |
| src/typeagent/aitools/embeddings.py | Refactored to separate Azure and OpenAI endpoint configuration with distinct environment variables |
| src/typeagent/storage/sqlite/provider.py | Added isolation_level=None to SQLite connection for manual transaction control |
| tests/test_embeddings.py | Updated test assertions to use renamed azure_endpoint_envvar and openai_endpoint_envvar parameters |
| tests/test_sqlitestore.py | Added test to verify SQLite connection uses isolation_level=None |
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.
this PR replaces PR#177