docs: fix Pinecone index name mismatch between README, NewsModel.py, and Database.py - #238
Open
Shrishagk wants to merge 1 commit into
Open
docs: fix Pinecone index name mismatch between README, NewsModel.py, and Database.py#238Shrishagk wants to merge 1 commit into
Shrishagk wants to merge 1 commit into
Conversation
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.
Summary
Fixes #237 — the README instructs users to create a Pinecone index named
news-index, but the actual code never reads that name. The read path (NewsModel.py) hardcodes a different literal (cybernews-hybrid-test-2) than the write path (db_update/Update.py, which already readsPINECONE_INDEX_NAMEfrom.env), so following the README exactly still results in a broken setup — the read and write paths point at two different indexes with no single value a user can set to make them agree.This PR makes
PINECONE_INDEX_NAMEthe single source of truth for both paths, removes an unused hardcoded name, and updates the README to match.Changes
models/NewsModel.py(line 8)Replaced the hardcoded
self.index_name = "cybernews-hybrid-test-2"with the same.env-driven lookup already used indb_update/Update.py:Added
from dotenv import dotenv_valuesto support this.config/Database.py(line 11)Removed the unused
index_name = "cybernews-index"variable. It was never imported anywhere else in the codebase (onlyclientis imported from this module), so this is dead-code cleanup with no behavioral impact — but it removes a third, misleading candidate name from the source for anyone trying to figure out the "correct" index name.db_update/Update.pyNo change — this file was already correct. It's the reference implementation for the
PINECONE_INDEX_NAMEpattern now applied toNewsModel.py.README.md(line 32)Why
news-indexper the README and setting onlyPINECONE_API_KEYcausesdb_update/Update.pyto crash (PINECONE_INDEX_NAMEisNone, andstr.lower(None)raisesTypeError). SettingPINECONE_INDEX_NAME=news-indexto work around that letsdb_update/Update.pypopulatenews-indexsuccessfully — butNewsModel.pystill queriescybernews-hybrid-test-2, which doesn't exist, so every/newsand/news_keywordsrequest returns empty results.PINECONE_INDEX_NAME) controls both the write path and the read path, and the README no longer hardcodes a name the code doesn't use.Scope
This applies to the root application (
app.py,config/,models/,db_update/) — the pre-migration, Pinecone-based path the README's Setup section documents.api-service/(used bydocker-compose.yml) has already moved off Pinecone onto Postgres + pgvector and is unaffected by this change.Testing
PINECONE_INDEX_NAMEin.envto a name of your choicedb_update/Update.py— confirm it creates/populates that index without errorflask --app app.py run) and hit/mistralai/news— confirm it now returns data from the same indexdb_update/Update.pypopulatedRelated
Fixes #237