Retrieve information relevant to a specific query.
query
method.
graph_id
is an optional parameter. If not set, it defaults to the default
graph.
The res.response
will be a natural language response to your query.
with_references
, it is possible to include the references to the sources used to generate an answer.
These sources can then be formatted and injected into the answer with the function .format_references
.
.format_references
(the default being lambda i, _: f"[{i}]"
).
For example, assuming each memory’s metadata contains a URL, we can provide markdown formatting with links to the sources used.
i
is an incremental index automatically generated for each source used.
only_context=True
when querying a graph.
The context will be available via .context
:
Data | # Tokens |
---|---|
Entities | 4000 |
Relations | 3000 |
Chunks | 9000 |
entities_max_tokens
, relations_max_tokens
, chunks_max_tokens
. For example: