Client / Routing
Choose from actions you define
Rank explicit candidates against the current context, then map the top result to an allowlisted application action.POST
/api/v1/routeRank candidates
TypeScripttypescript
const response = await fetch("https://api.neosyntropy.com/api/v1/rank", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NEOSYNTROPY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
context: { message: "I was charged twice for invoice 2048." },
question: "Which support queue should handle this request?",
answers: ["billing", "technical", "general"],
model: "clm-latest",
}),
});
const { ranked } = await response.json();
const selected = ranked[0]; // { rank, candidate, prob }
const handlers = { billing: openBillingCase, technical: openTechCase, general: openGeneralCase };
await handlers[selected.candidate]();Route safely
- Send between 2 and 100 unique, non-empty candidate strings.
- Treat the result as a ranking, not permission to perform a side effect.
- Reject any candidate that is not present in your local handler map.
Use the async Python client
Pythonpython
from neosyntropy import Client
client = Client(api_key="nsk_...")
result = await client.rank(
context={"message": "I was charged twice."},
question="Which support queue should handle this?",
answers=["billing", "technical", "general"],
)
print(result.ranked[0].candidate, result.ranked[0].prob)