Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ouonline committed Dec 18, 2024
1 parent 175ad4c commit 9e2f0a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/en/Best Practice/rag.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The configuration parameter `store_conf` is a `dict` type that includes the foll
- `chroma`: Uses Chroma for data storage.
- `dir`(required): Directory where data is stored.
- `milvus`: Uses Milvus for data storage.
- `uri`: The Milvus storage address, which can be a file path or a URL in the format of `ip:port`.
- `uri`(required): The Milvus storage address, which can be a file path or a URL in the format of `ip:port`.
- `index_kwargs` (optional): Milvus index configuration, which can be a dictionary or a list. If it is a dictionary, it means that all embedding indexes use the same configuration; if it is a list, the elements in the list are dictionaries, representing the configuration used by the embeddings specified by `embed_key`. Currently, only `floating point embedding` and `sparse embedding` are supported for the two types of embeddings, with the following supported parameters respectively:
- `floating point embedding`: [https://milvus.io/docs/index-vector-fields.md?tab=floating](https://milvus.io/docs/index-vector-fields.md?tab=floating)
- `sparse embedding`: [https://milvus.io/docs/index-vector-fields.md?tab=sparse](https://milvus.io/docs/index-vector-fields.md?tab=sparse)
Expand Down Expand Up @@ -217,9 +217,9 @@ def dummy_similarity_func(query: List[float], nodes: List[DocNode], **kwargs) ->
def dummy_similarity_func(query: List[float], node: DocNode, **kwargs) -> float:
```

The Retriever instance requires the query string to be passed in when used, along with optional filters for field filtering. filters is a dictionary where the key is the field to be filtered on, and the value is a list of acceptable values, indicating that the node will be returned if the field’s value matches any one of the values in the list. Only when all conditions are met will the node be returned.
The `Retriever` instance requires the `query` string to be passed in when used, along with optional `filters` for field filtering. `filters` is a dictionary where the key is the field to be filtered on, and the value is a list of acceptable values, indicating that the node will be returned if the field’s value matches any one of the values in the list. Only when all conditions are met will the node be returned.

Here is an example of using filters:
Here is an example of using `filters`(refer to [Document](../Best%20Practice/rag.md#Document) for configurations of `doc_fields`):

```python
filters = {
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/Best Practice/rag.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def dummy_similarity_func(query: List[float], node: DocNode, **kwargs) -> float:

`Retriever` 实例使用时需要传入要查询的 `query` 字符串,还有可选的过滤器 `filters` 用于字段过滤。`filters` 是一个 dict,其中 key 是要过滤的字段,value 是一个可取值列表,表示只要该字段的值匹配列表中的任意一个值即可。只有当所有的条件都满足该 node 才会被返回。

下面是使用 filters 的例子(`doc_fields` 的配置参考 [Document 的介绍](../Best%20Practice/rag.md#Document)):
下面是使用 `filters` 的例子(`doc_fields` 的配置参考 [Document 的介绍](../Best%20Practice/rag.md#Document)):

```python
filters = {
Expand Down
8 changes: 4 additions & 4 deletions lazyllm/docs/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@
>>> retriever2 = Retriever([document1, document2], group_name='sentences', similarity='cosine', similarity_cut_off=0.4, embed_keys=['local'], topk=3)
>>> print(retriever2("user query"))
filters = {
"author": ["A", "B", "C"],
"public_year": [2002, 2003, 2004],
}
>>> filters = {
>>> "author": ["A", "B", "C"],
>>> "public_year": [2002, 2003, 2004],
>>> }
>>> document3 = Document(dataset_path='/path/to/user/data', embed={'online':m , 'local': m1}, manager=False)
>>> document3.create_node_group(name='sentences', transform=SentenceSplitter, chunk_size=512, chunk_overlap=50)
>>> retriever3 = Retriever([document1, document3], group_name='sentences', similarity='cosine', similarity_cut_off=0.4, embed_keys=['local'], topk=3)
Expand Down

0 comments on commit 9e2f0a7

Please sign in to comment.