Skip to content

Commit

Permalink
Added code examples (#1999)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

Issue link:#1915

### Type of change


- [x] Documentation Update
  • Loading branch information
writinwaters authored Oct 9, 2024
1 parent a1940fc commit b2ff61f
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 95 deletions.
7 changes: 1 addition & 6 deletions docs/references/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
---
sidebar_position: 0
slug: /contribution_guidelines
---

# Contribution Guidelines

Thanks for wanting to contribute to Infinity. This document offers guidelines and major considerations for submitting your contributions.
Thanks for wanting to contribute to Infinity. This document offers guidelines and major considerations for submitting your contributions.

- To report a bug, file a [GitHub issue](https://github.com/infiniflow/infinity/issues/new/choose) with us.
- For further questions, you can explore existing discussions or initiate a new one in [Discussions](https://github.com/orgs/infiniflow/discussions).
Expand Down
2 changes: 1 addition & 1 deletion docs/getstarted/build_from_source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The `cmake` build type (`CMAKE_BUILD_TYPE`) can be one of the following:
Optimizes with `-O3`; without symbol information.
The built executables are significantly smaller than those of `RelWithDebInfo`.

:::note
:::tip NOTE
The following procedures set `CMAKE_BUILD_TYPE` to `Debug`. Change it as you see necessary.
:::

Expand Down
14 changes: 7 additions & 7 deletions docs/getstarted/deploy_infinity_server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import infinity_embedded
infinity_obj = infinity_embedded.connect("absolute/path/to/save/to")
```

:::note
For detailed information about the Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::tip NOTE
For detailed information about the capabilities and usage of Infinity's Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::


Expand Down Expand Up @@ -117,8 +117,8 @@ res = table_object.output(["*"])
print(res)
```

:::note
For detailed information about the Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::tip NOTE
For detailed information about the capabilities and usage of Infinity's Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::

## Deploy Infinity using binary
Expand Down Expand Up @@ -180,7 +180,7 @@ pip install infinity-sdk==0.4.0.dev2
```python
import infinity

infinity_obj = infinity.connect(infinity.NetworkAddress("<SERVER_IP_ADDRESS>", 23817))
infinity_object = infinity.connect(infinity.NetworkAddress("<SERVER_IP_ADDRESS>", 23817))
db_object = infinity_object.get_database("default_db")
table_object = db_object.create_table("my_table", {"num": {"type": "integer"}, "body": {"type": "varchar"}, "vec": {"type": "vector, 4, float"}})
table_object.insert([{"num": 1, "body": "unnecessary and harmful", "vec": [1.0, 1.2, 0.8, 0.9]}])
Expand All @@ -191,7 +191,7 @@ res = table_object.output(["*"])
print(res)
```

:::note
For detailed information about the Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::tip NOTE
For detailed information about the capabilities and usage of Infinity's Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
:::

45 changes: 36 additions & 9 deletions docs/references/http_api_reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ Creates an index on a specified table. If an index with the same name exists, th

#### Request example

- Creates an HNSW index on a vector column:
- Creates an HNSW index on a dense vector or a multivector column:

```shell
curl --request POST \
Expand All @@ -833,7 +833,7 @@ curl --request POST \
{
"fields":
[
"vector_column"
"dense_column"
],
"index":
{
Expand Down Expand Up @@ -868,7 +868,7 @@ curl --request POST \
} '
```

- Creates a BMP index on a tensor column
- Creates a BMP index on a sparse column

```shell
curl --request POST \
Expand All @@ -879,17 +879,39 @@ curl --request POST \
{
"fields":
[
"vector_column"
"sparse_column"
],
"index":
{
"type": "BMP",
"block_size": "16",
"compress_type": "raw"
},
"create_option": "ignore_if_exists"
} '
```

- Creates a secondary index on a varchar column

```shell
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"varchar_column"
],
"index":
{
"type": "Secondary"
},
"create_option": "ignore_if_exists"
} '
```

#### Request parameters

- `database_name`: (*Path parameter*)
Expand Down Expand Up @@ -1758,9 +1780,12 @@ curl --request GET \
"match_method": "sparse",
"fields": "sparse_column",
"query_vector": {"10":1.1, "20":2.2, "30": 3.3},
"metric_type": "l2",
"metric_type": "ip",
"topn": 3,
"params": {"ef": "150"}
"params": {
"alpha": "1.0",
"beta": "1.0"
}
},
{
"fusion_method": "rrf",
Expand Down Expand Up @@ -1832,9 +1857,11 @@ curl --request GET \
- `"uint8"`.
- `metric_type`: `string`, *Required*
The distance metric to use in similarity search. Used *only* when `"match_method"` is set to `"dense"` or `"sparse"`.
- `"ip"`: Inner product.
- `"l2"`: Euclidean distance.
- `"cosine"`: Cosine similarity.
- When `"match_method"` is set to `"dense"`:
- `"ip"`: Inner product.
- `"l2"`: Euclidean distance.
- `"cosine"`: Cosine similarity.
- When `"match_method"` is set to `"sparse"`, only `"ip"` can be used.
- `"fusion_method"`: (*Body parameter*), `enum<string>`, *Required when you have specified multiple matching methods*
- `"rrf"`: [Reciprocal rank fusion](https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf)
RRF is a method for combining multiple result sets with varying relevance indicators into a single result set. It requires no tuning, and the relevance indicators need not be related to achieve high-quality results. RRF is particularly useful when you are uncertain of the relative importance of each retrieval way.
Expand Down
Loading

0 comments on commit b2ff61f

Please sign in to comment.