-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lasr_vector_database_weaviate): service for interacting with dat…
…abase
- Loading branch information
Showing
6 changed files
with
246 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# lasr_vector_database_weaviate | ||
|
||
Integration of the Weaviate vector database into LASR stack. | ||
|
||
This package is maintained by: | ||
- [Paul Makles](mailto:[email protected]) | ||
|
||
## Prerequisites | ||
|
||
This package depends on the following ROS packages: | ||
- catkin (buildtool) | ||
- catkin_virtualenv (build) | ||
- lasr_vector_database_msgs | ||
|
||
This packages requires Python 3.10 to be present. | ||
|
||
This package has 18 Python dependencies: | ||
- [weaviate-client](https://pypi.org/project/weaviate-client)==v4.4b2 | ||
- [requests](https://pypi.org/project/requests)==2.31.0 | ||
- .. and 16 sub dependencies | ||
|
||
Currently this package will only work on Linux amd64. | ||
|
||
## Usage | ||
|
||
Ask the package maintainer to write a `doc/USAGE.md` for their package! | ||
|
||
## Example | ||
|
||
Create a new collection called "Hello": | ||
|
||
```bash | ||
rosservice call /database/vectors/weaviate/create_collection "name: 'Hello' | ||
skip_if_exists: false | ||
clear_if_exists: false" | ||
``` | ||
|
||
Insert some vectors: | ||
|
||
```bash | ||
rosservice call /database/vectors/weaviate/insert "name: 'Hello' | ||
properties: | ||
- key: 'thing' | ||
value: 'true' | ||
vector: | ||
- 0 | ||
- 1 | ||
- 0" | ||
|
||
rosservice call /database/vectors/weaviate/insert "name: 'Hello' | ||
properties: | ||
- key: 'thing' | ||
value: 'false' | ||
vector: | ||
- 1 | ||
- 0 | ||
- 1" | ||
``` | ||
|
||
Now you can query the database: | ||
|
||
```bash | ||
rosservice call /database/vectors/weaviate/query "name: 'Hello' | ||
limit: 3 | ||
vector: | ||
- 1 | ||
- 1 | ||
- 1" | ||
``` | ||
|
||
You should receive results like: | ||
|
||
```yaml | ||
results: | ||
- | ||
certainty: 0.9082483053207397 | ||
properties: | ||
- | ||
key: "thing" | ||
value: "false" | ||
- | ||
certainty: 0.7886751294136047 | ||
properties: | ||
- | ||
key: "thing" | ||
value: "true" | ||
``` | ||
## Technical Overview | ||
Ask the package maintainer to write a `doc/TECHNICAL.md` for their package! | ||
|
||
## ROS Definitions | ||
|
||
### Launch Files | ||
|
||
#### `server` | ||
|
||
Start the Weviate vector database | ||
|
||
```bash | ||
# Default directory and ports | ||
roslaunch lasr_vector_database_weaviate server.launch | ||
# Customise the ports used | ||
roslaunch lasr_vector_database_weaviate server.launch http_port:=40050 grpc_port:=40051 | ||
# Create a separate database instance | ||
roslaunch lasr_vector_database_weaviate server.launch db_name:=your_database_name | ||
``` | ||
|
||
| Argument | Default | Description | | ||
|:-:|:-:|---| | ||
| version | 1.22.11 | Version of Weaviate to download and run | | ||
| http_port | 50050 | Port to bind HTTP service to | | ||
| grpc_port | 50051 | Port to bind GRPC service to | | ||
| db_name | weaviate | Custom database name | | ||
|
||
|
||
|
||
### Messages | ||
|
||
This package has no messages. | ||
|
||
### Services | ||
|
||
This package has no services. | ||
|
||
### Actions | ||
|
||
This package has no actions. |
18 changes: 18 additions & 0 deletions
18
common/helpers/lasr_vector_database_weaviate/launch/server.launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<launch> | ||
<description>Start the Weviate vector database</description> | ||
<usage doc="Default directory and ports"></usage> | ||
<usage doc="Customise the ports used">http_port:=40050 grpc_port:=40051</usage> | ||
<usage doc="Create a separate database instance">db_name:=your_database_name</usage> | ||
|
||
<arg name="version" default="1.22.11" doc="Version of Weaviate to download and run" /> | ||
<arg name="http_port" default="50050" doc="Port to bind HTTP service to" /> | ||
<arg name="grpc_port" default="50051" doc="Port to bind GRPC service to" /> | ||
<arg name="db_name" default="weaviate" doc="Custom database name" /> | ||
|
||
<node name="$(anon weaviate_vector_database)" pkg="lasr_vector_database_weaviate" type="server" output="screen"> | ||
<param name="version" type="str" value="$(arg version)" /> | ||
<param name="http_port" type="str" value="$(arg http_port)" /> | ||
<param name="grpc_port" type="str" value="$(arg grpc_port)" /> | ||
<param name="db_name" type="str" value="$(arg db_name)" /> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
weaviate-client==v4.4b2 | ||
requests==2.31.0 |
16 changes: 8 additions & 8 deletions
16
common/helpers/lasr_vector_database_weaviate/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters