GraphServer
#
Bases: object
A class for defining and running a Raphtory GraphQL server
Parameters:
Name | Type | Description | Default |
---|---|---|---|
work_dir
|
str | PathLike
|
the working directory for the server |
required |
cache_capacity
|
int
|
the maximum number of graphs to keep in memory at once |
required |
cache_tti_seconds
|
int
|
the inactive time in seconds after which a graph is evicted from the cache |
required |
log_level
|
str
|
the log level for the server |
required |
tracing
|
bool
|
whether tracing should be enabled |
required |
otlp_agent_host
|
str
|
OTLP agent host for tracing |
required |
otlp_agent_port
|
str
|
OTLP agent port for tracing |
required |
otlp_tracing_service_name
|
str
|
The OTLP tracing service name |
required |
config_path
|
str | PathLike
|
Path to the config file |
required |
auth_public_key
|
|
required | |
auth_enabled_for_reads
|
|
required | |
create_index
|
|
required |
__new__(work_dir, cache_capacity=None, cache_tti_seconds=None, log_level=None, tracing=None, otlp_agent_host=None, otlp_agent_port=None, otlp_tracing_service_name=None, auth_public_key=None, auth_enabled_for_reads=None, config_path=None, create_index=None)
#
Create and return a new object. See help(type) for accurate signature.
run(port=1736, timeout_ms=180000)
#
set_embeddings(cache, embedding=None, nodes=True, edges=True)
#
Setup the server to vectorise graphs with a default template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cache
|
str
|
the directory to use as cache for the embeddings. |
required |
embedding
|
Callable
|
the embedding function to translate documents to embeddings. |
None
|
nodes
|
bool | str
|
if nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
True
|
edges
|
bool | str
|
if edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
GraphServer
|
A new server object with embeddings setup. |
start(port=1736, timeout_ms=5000)
#
Start the server and return a handle to it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port
|
int
|
the port to use. Defaults to 1736. |
1736
|
timeout_ms
|
int
|
wait for server to be online. Defaults to 5000. |
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(graph_names, nodes=True, edges=True)
#
Vectorise a subset of the graphs of the server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph_names
|
list[str]
|
the names of the graphs to vectorise. All by default. |
required |
nodes
|
bool | str
|
if nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
True
|
edges
|
bool | str
|
if edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
GraphServer
|
A new server object containing the vectorised graphs. |