backend
Candid Interface Definition
backend.did
backend.didThis file defines the Candid interface for the backend canister. It specifies data types and service methods so that clients (frontend or other canisters) can interact with the backend.
Type Definitions
AssistantMessage
type AssistantMessage = record {
content : opt text;
tool_calls : vec ToolCall;
};Represents a message from the assistant (e.g., an AI system).
contentβ Optional text content of the message.tool_callsβ A list of tools/functions the assistant is requesting to call.
ChatMessage
type ChatMessage = variant {
tool : record { content : text; tool_call_id : text };
user : record { content : text };
assistant : AssistantMessage;
system : record { content : text };
};Represents a message in a conversation.
toolβ A tool response containingcontentand thetool_call_idthat triggered it.userβ A message sent by the user.assistantβ A message from the assistant, including optional content and tool calls.systemβ A message from the system, usually containing instructions or context.
FunctionCall
Represents a call to a specific function.
nameβ Name of the function to execute.argumentsβ List of named arguments passed to the function.
ToolCall
Represents a request to execute a tool or function.
idβ Unique identifier for this tool call.functionβ Details of the function to be executed.
ToolCallArgument
Represents a single argument for a tool call.
nameβ Name of the argument.valueβ Value of the argument.
Service Definition
Methods
chatInput: A list of
ChatMessageobjects representing the conversation history.Output: A
textresponse from the assistant.Purpose: Handles conversational interactions between the user and the assistant.
create_accountInput:
text(account address).Output:
textstatus message ("Account created"or"Already exists").Purpose: Adds a new account address to the backendβs account list.
get_accounts(query method)Input: None.
Output: A vector of
textvalues, each representing an account address.Purpose: Retrieves all registered accounts without modifying state.
promptInput:
textprompt.Output:
textresponse.Purpose: Sends a single prompt to the assistant and returns its reply, without passing a full chat history.
Last updated