Sunflower Simple Inference
curl --request POST \
--url https://api.sunbird.ai/tasks/sunflower_simple \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'instruction=<string>' \
--data model_type=qwen \
--data temperature=0.3 \
--data 'system_message=<string>'import requests
url = "https://api.sunbird.ai/tasks/sunflower_simple"
payload = {
"instruction": "<string>",
"model_type": "qwen",
"temperature": "0.3",
"system_message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
instruction: '<string>',
model_type: 'qwen',
temperature: '0.3',
system_message: '<string>'
})
};
fetch('https://api.sunbird.ai/tasks/sunflower_simple', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sunbird.ai/tasks/sunflower_simple",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sunbird.ai/tasks/sunflower_simple"
payload := strings.NewReader("instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sunbird.ai/tasks/sunflower_simple")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sunbird.ai/tasks/sunflower_simple")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Legacy AI
Sunflower Simple Inference
deprecated
Simple Sunflower inference endpoint for single instruction/response.
**Deprecated**: use POST /tasks/chat/completions instead.
This is a simplified interface for users who want to send a single instruction
rather than managing conversation history. Uses form-based input for easier
integration with simple clients.
Args:
request: The FastAPI request object (required for rate limiting).
background_tasks: FastAPI background tasks for async operations.
instruction: The question or instruction for the AI.
model_type: Either 'qwen' (default) or 'gemma'.
temperature: Controls randomness (0.0 = deterministic, 1.0 = creative).
system_message: Optional custom system message.
db: Database session.
current_user: The authenticated user.
Returns:
Dictionary containing response, model_type, processing_time, usage, and success.
Raises:
BadRequestError: For validation errors.
ValidationError: For invalid model type.
ServiceUnavailableError: If the model is loading or request times out.
ExternalServiceError: For unexpected errors.
Example:
Form data:
- instruction: "Translate 'hello' to Luganda"
- model_type: "qwen"
- temperature: 0.3
Response:
{
"response": "In Luganda, 'hello' is 'Gyebaleko' or 'Wasuze otya' (Good morning).",
"model_type": "qwen",
"processing_time": 1.5,
"usage": {"completion_tokens": 20, "prompt_tokens": 10, "total_tokens": 30},
"success": true
}
POST
/
tasks
/
sunflower_simple
Sunflower Simple Inference
curl --request POST \
--url https://api.sunbird.ai/tasks/sunflower_simple \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'instruction=<string>' \
--data model_type=qwen \
--data temperature=0.3 \
--data 'system_message=<string>'import requests
url = "https://api.sunbird.ai/tasks/sunflower_simple"
payload = {
"instruction": "<string>",
"model_type": "qwen",
"temperature": "0.3",
"system_message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
instruction: '<string>',
model_type: 'qwen',
temperature: '0.3',
system_message: '<string>'
})
};
fetch('https://api.sunbird.ai/tasks/sunflower_simple', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sunbird.ai/tasks/sunflower_simple",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sunbird.ai/tasks/sunflower_simple"
payload := strings.NewReader("instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sunbird.ai/tasks/sunflower_simple")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sunbird.ai/tasks/sunflower_simple")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "instruction=%3Cstring%3E&model_type=qwen&temperature=0.3&system_message=%3Cstring%3E"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/x-www-form-urlencoded
Response
Successful Response
The response is of type Response Sunflower Simple Inference Tasks Sunflower Simple Post · object.

