GraphServer
A class for defining and running a Raphtory GraphQL server
Methods
| Method | Description |
|---|---|
run | Run the server until completion. |
set_embeddings | Setup the server to vectorise graphs with a default template. |
start | Start the server and return a handle to it. |
turn_off_index | Turn off index for all graphs |
with_vectorised_graphs | Vectorise a subset of the graphs of the server. |
Method Details
run
Signature: run(port=1736, timeout_ms=180000)
Run the server until completion.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
port | int, optional | 1736 | The port to use. Defaults to 1736. |
timeout_ms | int, optional | 180000 | Timeout for waiting for the server to start. Defaults to 180000. |
Returns
| Type | Description |
|---|---|
| None |
set_embeddings
Signature: set_embeddings(cache, embedding=None, nodes=True, edges=True)
Setup the server to vectorise graphs with a default template.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
cache | str | - | the directory to use as cache for the embeddings. |
embedding | Callable, optional | None | the embedding function to translate documents to embeddings. |
nodes | bool | str, optional | True | if nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
edges | bool | str, optional | True | if edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
Returns
| Type | Description |
|---|---|
| GraphServer | A new server object with embeddings setup. |
start
Signature: start(port=1736, timeout_ms=5000)
Start the server and return a handle to it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
port | int, optional | 1736 | the port to use. Defaults to 1736. |
timeout_ms | int, optional | 5000 | wait for server to be online. Defaults to 5000. The server is stopped if not online within timeout_ms but manages to come online as soon as timeout_ms finishes! |
Returns
| Type | Description |
|---|---|
| RunningGraphServer | The running server |
turn_off_index
Turn off index for all graphs
Returns
| Type | Description |
|---|---|
| GraphServer | The server with indexing disabled |
with_vectorised_graphs
Signature: with_vectorised_graphs(graph_names, nodes=True, edges=True)
Vectorise a subset of the graphs of the server.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
graph_names | list[str] | - | the names of the graphs to vectorise. All by default. |
nodes | bool | str, optional | True | if nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
edges | bool | str, optional | True | if edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
Returns
| Type | Description |
|---|---|
| GraphServer | A new server object containing the vectorised graphs. |