Skip to content

Commit

Permalink
Fix typo in main.yml and update test
Browse files Browse the repository at this point in the history
instructions in test_pgvector.py
  • Loading branch information
kaischuygon committed Nov 30, 2023
1 parent 873a953 commit ca24497
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
POSTGRES_USER: mock_user
POSTGRES_PASSWORD: mock_password
POSTGRES_DB: mock_db
ports: # give multiple ports for each python versionto avoid conflicts
ports: # give multiple ports for each python version to avoid conflicts
- 5433:5432
- 5432:5432

Expand Down
52 changes: 5 additions & 47 deletions test/embedding/test_pgvector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
'''
Set up a mock Postgres instance with the following commands (make sure you don't have anything running on port 0.0.0.0:5432))):
- docker pull ankane/pgvector
- docker run --name mock-postgres -p 5432:5432 -e POSTGRES_USER=mock_user -e POSTGRES_PASSWORD=mock_password -e POSTGRES_DB=mock_db -d ankane/pgvector
Then run the tests with:
pytest test
or
Expand Down Expand Up @@ -84,50 +89,3 @@ async def test_PGv_embed_pacer():
assert sim_search is not None, Exception("No results returned from perfect search")

await vDB.drop_table()

# @pytest.mark.asyncio
# async def test_PGv_embed_many_pacer():
# dummy_model = SentenceTransformer('mock_transformer')
# dummy_model.encode.return_value = np.array([1, 2, 3])
# print(f'EMODEL: {dummy_model}')
# TABLE_NAME = 'embedding_test'
# try:
# vDB = await DocDB.from_conn_params(
# embedding_model=dummy_model,
# table_name=TABLE_NAME,
# db_name=DB_NAME,
# host=HOST,
# port=int(PORT),
# user=USER,
# password=PASSWORD)
# except ConnectionRefusedError:
# pytest.skip("No Postgres instance made available for test. Skipping.", allow_module_level=True)

# assert vDB is not None, ConnectionError("Postgres docker instance not available for testing PG code")

# # Create tables
# await vDB.drop_table()
# assert await vDB.table_exists() is False, Exception("Table exists before creation")
# await vDB.create_table()
# assert await vDB.table_exists() is True, Exception("Table does not exist after creation")

# # Insert data using insert_many()
# documents = [
# {
# 'content': text,
# 'title': f'Pacer Copypasta line {index}',
# 'page_numbers': [1, 2, 3],
# 'tags': ['fitness', 'pacer', 'copypasta']
# }
# for index, text in enumerate(pacer_copypasta)
# ]
# await vDB.insert_many(documents)

# assert await vDB.count_items() == len(pacer_copypasta), Exception("Not all documents inserted")

# # Search table with perfect match
# search_string = '[beep] A single lap should be completed each time you hear this sound.'
# sim_search = await vDB.search(query_string=search_string, limit=3)
# assert sim_search is not None, Exception("No results returned from perfect search")

# await vDB.drop_table()

0 comments on commit ca24497

Please sign in to comment.