llama-stack/llama_stack
Yuan Tang a79a083e39
Fix broken pgvector provider and memory leaks (#947)
This PR fixes the broken pgvector provider as well as wraps all cursor
object creations with context manager to ensure that they get properly
closed to avoid potential memory leaks.

```
> pytest llama_stack/providers/tests/vector_io/test_vector_io.py   -m "pgvector" --env EMBEDDING_DIMENSION=384 --env PGVECTOR_PORT=7432 --env PGVECTOR_DB=db --env PGVECTOR_USER=user --env PGVECTOR_PASSWORD=pass   -v -s --tb=short --disable-warnings

llama_stack/providers/tests/vector_io/test_vector_io.py::TestVectorIO::test_banks_list[-pgvector] PASSED
llama_stack/providers/tests/vector_io/test_vector_io.py::TestVectorIO::test_banks_register[-pgvector] PASSED
llama_stack/providers/tests/vector_io/test_vector_io.py::TestVectorIO::test_query_documents[-pgvector] The scores are: [0.8168284974053789, 0.8080469278964486, 0.8050996198466661]
PASSED
```

---------

Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
2025-02-05 09:32:05 -08:00
..
apis Make a couple properties optional (#963) 2025-02-04 16:20:24 -08:00
cli Fix precommit check after moving to ruff (#927) 2025-02-02 06:46:45 -08:00
distribution if client.initialize fails, the example should exit (#954) 2025-02-04 13:54:21 -08:00
providers Fix broken pgvector provider and memory leaks (#947) 2025-02-05 09:32:05 -08:00
scripts Fix precommit check after moving to ruff (#927) 2025-02-02 06:46:45 -08:00
templates Fix precommit check after moving to ruff (#927) 2025-02-02 06:46:45 -08:00
__init__.py export LibraryClient 2024-12-13 12:08:00 -08:00