Group graphs can be used to create and manage additional non-user specific graphs.

A user graph is tied to a specific user; a group graph is just like a user graph, except it is not tied to a specific user. So a group graph can be used to create and manage an arbitrary graph that can be used as memory for an entire group of users, or for a more complex use case.

For example, a group graph could store information about a company’s product, and when your chatbot responds, it could utilize a memory context string from both that user’s graph as well as from the product group graph.

Creating a Group

1group = await client.group.add(
2 group_id="some-group-id",
3 description="This is a description.",
4 name="Group Name"
5)

Adding Data to a Group Graph

Adding data to a group graph requires using the graph.add method. Below is an example, and for more on this method, see Adding Data to the Graph and our API Reference.

1await client.graph.add(
2 group_id=group_id,
3 data="Hello world!",
4 type="text",
5)

Searching a Group Graph

Searching a group graph requires using the graph.search method. Below is an example, and for more on this method, see Searching the Graph and our API Reference.

1search_results = await client.graph.search(
2 group_id=group_id,
3 query="Banana",
4 scope="nodes",
5)

Deleting a Group

1await client.group.delete(group_id)
Built with