Consensus
Responses
A route mimicking the OpenAI responses API with additional consensus capability. This endpoint allows for consensus-based completions where multiple LLM instances are used to generate responses and reach agreement, enhancing output reliability. The n_consensus parameter controls how many models will be used in the consensus process.
POST
/
v1
/
consensus
/
responses
Copy
from uiform import UiForm
from pydantic import BaseModel
client = UiForm()
class Step(BaseModel):
explanation: str
output: str
class MathReasoning(BaseModel):
steps: list[Step]
final_answer: str
response = client.consensus.responses.parse(
model="gpt-4o-2024-08-06",
input=[
{
"role": "system",
"content": "You are a helpful math tutor. Guide the user through the solution step by step.",
},
{"role": "user", "content": "how can I solve 8x + 7 = -23"},
],
text_format=MathReasoning,
n_consensus=4
)
math_reasoning = response.output_parsed
Copy
{
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "'{"steps": [{"explanation": "Start with the equation 8x + 7 = -23.", "output": "8x + 7 = -23"}, {"explanation": "Subtract 7 from both sides to isolate the term with the variable.", "output": "8x = -23 - 7"}, {"explanation": "Simplify the right side of the equation.", "output": "8x = -30"}, {"explanation": "Divide both sides by 8 to solve for x.", "output": "x = -30 / 8"}, {"explanation": "Simplify the fraction.", "output": "x = -15 / 4"}], "final_answer": "x = -15 / 4"}'",
"annotations": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null
},
"store": true,
"temperature": 1.0,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1.0,
"truncation": "disabled",
"usage": {
"input_tokens": 36,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 87,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 123
},
"user": null,
"metadata": {}
}
Copy
from uiform import UiForm
from pydantic import BaseModel
client = UiForm()
class Step(BaseModel):
explanation: str
output: str
class MathReasoning(BaseModel):
steps: list[Step]
final_answer: str
response = client.consensus.responses.parse(
model="gpt-4o-2024-08-06",
input=[
{
"role": "system",
"content": "You are a helpful math tutor. Guide the user through the solution step by step.",
},
{"role": "user", "content": "how can I solve 8x + 7 = -23"},
],
text_format=MathReasoning,
n_consensus=4
)
math_reasoning = response.output_parsed
Copy
{
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "'{"steps": [{"explanation": "Start with the equation 8x + 7 = -23.", "output": "8x + 7 = -23"}, {"explanation": "Subtract 7 from both sides to isolate the term with the variable.", "output": "8x = -23 - 7"}, {"explanation": "Simplify the right side of the equation.", "output": "8x = -30"}, {"explanation": "Divide both sides by 8 to solve for x.", "output": "x = -30 / 8"}, {"explanation": "Simplify the fraction.", "output": "x = -15 / 4"}], "final_answer": "x = -15 / 4"}'",
"annotations": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null
},
"store": true,
"temperature": 1.0,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1.0,
"truncation": "disabled",
"usage": {
"input_tokens": 36,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 87,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 123
},
"user": null,
"metadata": {}
}
Authorizations
Headers
Body
application/json
Response
200
application/json
Successful Response
The response is of type object
.
Copy
from uiform import UiForm
from pydantic import BaseModel
client = UiForm()
class Step(BaseModel):
explanation: str
output: str
class MathReasoning(BaseModel):
steps: list[Step]
final_answer: str
response = client.consensus.responses.parse(
model="gpt-4o-2024-08-06",
input=[
{
"role": "system",
"content": "You are a helpful math tutor. Guide the user through the solution step by step.",
},
{"role": "user", "content": "how can I solve 8x + 7 = -23"},
],
text_format=MathReasoning,
n_consensus=4
)
math_reasoning = response.output_parsed
Copy
{
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "'{"steps": [{"explanation": "Start with the equation 8x + 7 = -23.", "output": "8x + 7 = -23"}, {"explanation": "Subtract 7 from both sides to isolate the term with the variable.", "output": "8x = -23 - 7"}, {"explanation": "Simplify the right side of the equation.", "output": "8x = -30"}, {"explanation": "Divide both sides by 8 to solve for x.", "output": "x = -30 / 8"}, {"explanation": "Simplify the fraction.", "output": "x = -15 / 4"}], "final_answer": "x = -15 / 4"}'",
"annotations": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null
},
"store": true,
"temperature": 1.0,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1.0,
"truncation": "disabled",
"usage": {
"input_tokens": 36,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 87,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 123
},
"user": null,
"metadata": {}
}
Assistant
Responses are generated using AI and may contain mistakes.