Links

Conversations

Create, manage and query Conversations.

Overview

Once you have ingested content into Graphlit, and built a knowledge graph from your data, we make it easy to have a conversation about content.
Conversations can be started in two ways.
  1. 1.
    Create a conversation, and specify the details of the Large Language Model (LLM) you wish to use, and assign a content filter to constrain the content to be 'conversed over'. Then prompt the newly created conversation.
  2. 2.
    Jump right into a conversation across all the content in your project, by providing a user prompt to start the conversation. This will use the default LLM specification for your project.
Conversations are named, but the name is not required to be unique across the Graphlit project. Each conversation has a unique id field, in GUID format.
Conversations are created in the OPENED state, which means that messages can be added to or removed from it. See the closeConversation mutation for the ability to close (or lock) the conversation, so no messages can be added/removed.
For more information on LLM specifications, look here.

Operations

Prompt Conversation
Prompt Conversation
The promptConversation mutation enables the creation of a conversation by accepting the user prompt and it returns essential details, including the conversation ID, the LLM's response to the user prompt (including token usage and time to complete the prompt), and the total message count of the conversation.
If you don't provide a conversation as an input parameter to the mutation, a new conversation will be created.
Prompting a conversation will add a message with the USER role (the user-provided prompt), and a message with the ASSISTANT role (the LLM completion). So, each turn of the conversation will add two messages to the conversation.
Mutation:
mutation PromptConversation($prompt: String!, $id: ID) {
promptConversation(prompt: $prompt, id: $id) {
conversation {
id
}
message {
role
author
message
tokens
completionTime
}
messageCount
}
}
Variables:
{
"prompt": "Provide a summary of the term 'unstructured data', in 200 words or less."
}
Response:
{
"conversation": {
"id": "fc1d1795-1e51-463c-8f83-b60531a94b71"
},
"message": {
"role": "ASSISTANT",
"message": "Unstructured data refers to any data that does not have a predefined data model or structure. This type of data is typically not organized in a database or spreadsheet, making it difficult to analyze and process using traditional data analysis tools. Examples of unstructured data include text documents, images, audio and video files, social media posts, and sensor data from IoT devices. Unstructured data is often generated in large volumes and at high velocity, making it a challenge to store and manage effectively. However, advances in machine learning and natural language processing have enabled organizations to extract valuable insights from unstructured data, which can be used to improve decision-making and gain a competitive advantage. Effective management and analysis of unstructured data can provide valuable insights into customer behavior, market trends, and other key business metrics, making it a valuable asset for organizations across a range of industries.",
"tokens": 170,
"completionTime": "PT4.497279S"
},
"messageCount": 2
}
Continue Conversation
Once you have an existing conversation, thepromptConversation mutation enables the continuation of a conversation by accepting the conversation ID and user prompt. The mutation returns essential details, including the conversation ID, the LLM's response to the user prompt (including token usage and time to complete the prompt), and the total message count of the conversation.
Mutation:
mutation PromptConversation($prompt: String!, $id: ID) {
promptConversation(prompt: $prompt, id: $id) {
conversation {
id
}
message {
role
author
message
tokens
completionTime
}
messageCount
}
}
Variables:
{
"prompt": "Sorry I meant, can you provide a summary of the term 'unstructured data' in 50 words or less?",
"id": "fc1d1795-1e51-463c-8f83-b60531a94b71"
}
Response:
{
"conversation": {
"id": "fc1d1795-1e51-463c-8f83-b60531a94b71"
},
"message": {
"role": "ASSISTANT",
"message": "Unstructured data refers to data that lacks a predefined structure or organization, making it difficult to analyze using traditional data analysis tools. This type of data includes text documents, images, videos, and social media posts, and is often generated in large volumes and at high velocity. Advances in machine learning and natural language processing have enabled organizations to extract valuable insights from unstructured data.",
"tokens": 74,
"completionTime": "PT2.5219146S"
},
"messageCount": 4
}
Create Conversation
Create Conversation
The createConversation mutation enables the creation of a conversation by accepting the conversation name and it returns essential details, including the ID, name, state, and type of the newly generated conversation.
Mutation:
mutation CreateConversation($conversation: ConversationInput!) {
createConversation(conversation: $conversation) {
id
name
state
type
}
}
Variables:
{
"conversation": {
"name": "Ask A Question"
}
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED"
}
Create Conversation With Specification
The createConversation mutation enables the creation of a conversation by accepting the conversation name and desired specification, and it returns essential details, including the ID, name, state, and type of the newly generated conversation.
Specifications contain the configuration for the LLM, which is used to complete the user prompts provided to the conversation. For example, the LLM system prompt, model temperature, and LLM service to use (i.e. Azure OpenAI).
For more details on specifications, see here.
Mutation:
mutation CreateConversation($conversation: ConversationInput!) {
createConversation(conversation: $conversation) {
id
name
state
type
}
}
Variables:
{
"conversation": {
"specification": {
"id": "08746105-5c2a-4f59-8170-eedddd58faf7"
},
"name": "Ask A Question"
}
}
Response:
{
"type": "CONTENT",
"id": "59e6411d-e0a3-4ef5-ac77-d7014a889bcc",
"name": "Ask A Question",
"state": "OPENED"
}
Create Conversation About Podcasts
The createConversation mutation enables the creation of a conversation by accepting the conversation name and desired content filter, and it returns essential details, including the ID, name, state, and type of the newly generated conversation.
The content filter provides a way to constrain the set of content which acts as the context for the converation.
For example, here we are asking Graphlit to have a conversation about FILE content types, which are AUDIO files.
Content filters accept a variety of filtering options, such as by feed, by collection, by date and more. See here for more detailed information on what filter options are supported.
Mutation:
mutation CreateConversation($conversation: ConversationInput!) {
createConversation(conversation: $conversation) {
id
name
state
type
}
}
Variables:
{
"conversation": {
"filter": {
"types": [
"FILE"
],
"fileTypes": [
"AUDIO"
]
},
"name": "Ask A Question About Podcasts"
}
}
Response:
{
"type": "CONTENT",
"id": "1f4bc1d5-00ce-41c5-8a0c-3ce1374742d3",
"name": "Ask A Question About Podcasts",
"state": "OPENED"
}
Undo Conversation
The undoConversation mutation gives the ability to undo the most recent prompting of a conversation by utilizing the id parameter, and it returns the ID and state of the conversation.
For use cases where the most recent user prompt was incorrect, mistyped or otherwise undesired, this provides a way to remove the most recent USER role message and its correspondingASSISTANT role message. This resets the conversation to the state right before the most recent call to promptConversation.
Mutation:
mutation UndoConversation($id: ID!) {
undoConversation(id: $id) {
id
name
state
type
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED"
}
Clear Conversation
The clearConversation mutation allows the clearing of a conversation by utilizing the id parameter, and it returns the ID and state of the conversation.
This will clear the list of saved messages in the conversation - from both USER and ASSISTANT roles, resulting in a message count of zero.
Mutation:
mutation ClearConversation($id: ID!) {
clearConversation(id: $id) {
id
name
state
type
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED"
}
Close Conversation
The closeConversation mutation allows the closing of an opened conversation by utilizing the id parameter, and it returns the ID and state of the closed conversation.
Once a conversation has been closed, any calls to the promptConversation or clearConversation mutations - passing the closed conversation - will return an error.
Mutation:
mutation CloseConversation($id: ID!) {
closeConversation(id: $id) {
id
name
state
type
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "CLOSED"
}
Open Conversation
The openConversation mutation allows the opening of a closed conversation by utilizing the id parameter, and it returns the ID and state of the opened conversation.
Mutation:
mutation OpenConversation($id: ID!) {
openConversation(id: $id) {
id
name
state
type
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED"
}
Delete Conversation
The deleteConversation mutation allows the deletion of a conversation by utilizing the id parameter, and it returns the ID and state of the deleted conversation.
Mutation:
mutation DeleteConversation($id: ID!) {
deleteConversation(id: $id) {
id
state
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"state": "DELETED"
}
Get Conversation
The conversation query allows you to retrieve specific details of a conversation by providing the id parameter, including the ID, name, creation date, state, owner ID, and type associated with the conversation.
Query:
query GetConversation($id: ID!) {
conversation(id: $id) {
id
name
creationDate
state
owner {
id
}
type
}
}
Variables:
{
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295"
}
Response:
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED",
"creationDate": "2023-07-04T19:17:52Z",
"owner": {
"id": "9422b73d-f8d6-4faf-b7a9-152250c862a4"
}
}
Query Conversations
Query Conversations
The conversations query allows you to retrieve all conversations. It returns a list of conversation results, including the ID, name, creation date, state, owner ID, and type for each conversation.
Query:
query QueryConversations($filter: ConversationFilter!) {
conversations(filter: $filter) {
results {
id
name
creationDate
state
owner {
id
}
type
}
}
}
Variables:
{
"filter": {
"offset": 0,
"limit": 100
}
}
Response:
{
"results": [
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED",
"creationDate": "2023-07-04T19:17:52Z",
"owner": {
"id": "9422b73d-f8d6-4faf-b7a9-152250c862a4"
}
}
]
}
Query Conversations By Name
The conversations query allows you to retrieve conversations based on a specific filter criteria, via the name parameter. In this example, the name is set to "Question." It returns a list of conversation results containing the ID, name, creation date, state, owner ID, and type for each matching conversation.
Query:
query QueryConversations($filter: ConversationFilter!) {
conversations(filter: $filter) {
results {
id
name
creationDate
state
owner {
id
}
type
}
}
}
Variables:
{
"filter": {
"name": "Question",
"offset": 0,
"limit": 100
}
}
Response:
{
"results": [
{
"type": "CONTENT",
"id": "373cdb14-a0df-4c0d-83c9-da64793d6295",
"name": "Ask A Question",
"state": "OPENED",
"creationDate": "2023-07-04T19:17:52Z",
"owner": {
"id": "9422b73d-f8d6-4faf-b7a9-152250c862a4"
}
}
]
}
Queries
Mutations
Objects