mirror of
https://github.com/langchain-ai/langchain-milvus.git
synced 2026-07-01 19:54:58 -04:00
add more warnings and update CONTRIBUTING.md (#56)
Signed-off-by: ChengZi <chen.zhang@zilliz.com>
This commit is contained in:
+56
-6
@@ -13,6 +13,15 @@ cd libs/milvus
|
||||
poetry install
|
||||
```
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Fork the repository and create your branch from `main`.
|
||||
2. Make your changes.
|
||||
3. Run tests and linting to ensure your code meets the project's standards.
|
||||
4. Update documentation if necessary.
|
||||
5. Submit a pull request.
|
||||
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Running Tests
|
||||
@@ -26,6 +35,9 @@ make test
|
||||
# Run specific test file
|
||||
make test TEST_FILE=tests/unit_tests/specific_test.py
|
||||
|
||||
# Run specific test method
|
||||
make test TEST_FILE=tests/unit_tests/specific_test.py::test_method_name
|
||||
|
||||
# Run integration tests
|
||||
make integration_tests
|
||||
|
||||
@@ -80,13 +92,51 @@ make spell_fix
|
||||
make check_imports
|
||||
```
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Fork the repository and create your branch from `master`.
|
||||
2. Make your changes.
|
||||
3. Run tests and linting to ensure your code meets the project's standards.
|
||||
4. Update documentation if necessary.
|
||||
5. Submit a pull request.
|
||||
### Managing Dependencies with Poetry
|
||||
|
||||
If you want to modify project dependencies, you can refer to the [Poetry document](https://python-poetry.org/docs/managing-dependencies/). Here are some common commands to manage dependencies:
|
||||
|
||||
#### Adding Dependencies
|
||||
|
||||
```bash
|
||||
# Add a regular dependency
|
||||
poetry add package-name
|
||||
|
||||
# Add a development dependency
|
||||
poetry add --group dev package-name
|
||||
|
||||
# Add a dependency with specific version
|
||||
poetry add package-name==1.2.3
|
||||
|
||||
# Add a dependency with version constraints
|
||||
poetry add "package-name>=1.0.0,<2.0.0"
|
||||
```
|
||||
|
||||
#### Updating Dependencies
|
||||
|
||||
To update the project's dependencies:
|
||||
|
||||
```bash
|
||||
# Update all dependencies
|
||||
poetry update
|
||||
|
||||
# Update a specific dependency
|
||||
poetry update package-name
|
||||
```
|
||||
|
||||
#### Locking Dependencies
|
||||
|
||||
After adding or updating dependencies, Poetry automatically updates the `poetry.lock` file. If you need to manually generate or update the lock file:
|
||||
|
||||
```bash
|
||||
# Generate/update the lock file without installing dependencies
|
||||
poetry lock
|
||||
|
||||
# Update the lock file and install dependencies
|
||||
poetry lock --no-update
|
||||
```
|
||||
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
|
||||
@@ -1265,8 +1265,21 @@ class Milvus(VectorStore):
|
||||
res = self.col.insert(batch_insert_list, timeout=timeout, **kwargs)
|
||||
pks.extend(res.primary_keys)
|
||||
except MilvusException as e:
|
||||
first_entity = {}
|
||||
if batch_insert_list:
|
||||
first_entity = batch_insert_list[0]
|
||||
log_entity = {}
|
||||
for k, v in first_entity.items():
|
||||
if isinstance(v, list) and len(v) > 10:
|
||||
log_entity[k] = f"{v[:10]}... (truncated, total len: {len(v)})"
|
||||
else:
|
||||
log_entity[k] = v
|
||||
logger.error(
|
||||
"Failed to insert batch starting at entity: %s/%s", i, total_count
|
||||
"Failed to insert batch starting at entity: %s/%s. "
|
||||
"First entity data: %s",
|
||||
i,
|
||||
total_count,
|
||||
log_entity,
|
||||
)
|
||||
raise e
|
||||
return pks
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from langchain_milvus.vectorstores.milvus import Milvus
|
||||
|
||||
@@ -70,5 +71,16 @@ class Zilliz(Milvus):
|
||||
ValueError: If the pymilvus python package is not installed.
|
||||
"""
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"The Zilliz class will be deprecated in the future. "
|
||||
"Please use the Milvus class instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# For backwards compatibility, this class is preserved.
|
||||
# But it is recommended to use Milvus instead.
|
||||
|
||||
Reference in New Issue
Block a user