Continue Conversation

API Endpoint

POST https://api.genaifactory.ai/v1/conversations/{session_id}

Headers

Name
Type
Required
Description

formacloud-api-key

string

Yes

API key for authentication

Available Action Types

ActionType
Value
Description

CALL_TOOL

"CallTool"

The system invokes an external tool to process the request. If this action is returned, the API must be called again to retrieve the tool's response.

ASK_USER

"AskUser"

The system requires user input to proceed. In this case, the user_input field must be provided in the next API call.

FINISH

"Finish"

The conversation session has reached its final state.

PLAN

"Plan"

The system is generating a structured plan for further execution.

CREATE_TOOL

"CreateTool"

The system dynamically creates a new tool or function based on the conversation's requirements.

Request Body

Name
Type
Required
Description

user_input

string

Yes (if Last StepActionType = ASK_USER)

The user's response in the conversation. Required when the previous action type is ASK_USER. Otherwise, send an empty {}.

query_step_result

bool

No

If true, the API only returns the latest step result without executing a new step. (default: false)

Example Request

When ActionType = ASK_USER (user_input is required)

curl --location 'https://api.genaifactory.ai/v1/conversations/shuxuan-test-1' \
--header 'formacloud-api-key: abc123' \
--header 'Content-Type: application/json' \
--data '{
    "user_input": "create a dog image"
}'

When ActionType is NOT ASK_USER (send an empty {})

Get the latest step result without executing a new step

Response

Returns a JSON object containing the updated conversation step.

Field
Type
Description

session_id

string

Unique session identifier

current_step

object

The latest step in the conversation

Response Handling

If the response contains:ActionType = CALL_TOOL, you must call this API again to retrieve the step result.

Example Response 1

Example Response 2

Next Step: If "action": "CALL_TOOL" and "step_result": null, make another API request to get the step result.

Last updated

Was this helpful?