Query
Query
Before querying data, make sure to configure the API key in your environment.
In the current Beta version, memories are eventually consistent.
Memories may not be available for querying for up to 10 minutes after adding them for the first time. We will soon release an update that will eliminate this limitation. Following this update, ingestion will be almost instantaneous. If you would like to request earlier access to this new feature, reach out at support@circlemind.co
.
You can query a graph by using the query
method.
The 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.
Include references
Using the keyword 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
.
It is possible to provide custom formatting when injecting the references by passing a custom replacing function to .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.
where i
is an incremental index automatically generated for each source used.