Can Leiolai return structured JSON and call my tools?

Yes. Leiolai Chat Completions and Responses support structured JSON output and client-defined function tools in separate requests. Use a JSON schema for a result your application must parse. Define functions when Leiolai should request information or an action; your application runs the function and returns its result.

How do I get a JSON object from Leiolai?

Use the structured-output field supported by your API format. Leiolai Chat Completions uses response_format; Responses uses text.format. JSON-object mode returns a JSON object, and JSON-schema mode specifies the fields and types you need.

Which API formats support function calling?

Leiolai Chat Completions, Responses, and Anthropic Messages support client-defined function tools. Provide the tool names, descriptions, and input definitions in the format required by your chosen endpoint.

Who runs a function requested by Leiolai?

Your application runs the requested function and sends the result back in a follow-up request.

Can Leiolai request several tools in one turn?

The Leiolai Chat Completions and Responses formats provide parallel_tool_calls for independent function calls. Return the result for each requested call with the matching call identifier.

Should I use structured output or function tools?

Use structured output for a JSON result, such as a classification with fixed fields. Use function tools when your application must retrieve information or perform an action before Leiolai can continue. Do not combine structured output and function tools in the same request; finish the tool conversation, then request the final JSON separately.

Which field requests a structured answer?

Leiolai Chat Completions uses response_format, while Responses uses text.format. Choose json_object for a JSON object or json_schema for the fields and types your application requires. Successful content contains the JSON value without prose or fences.

Structured-output configuration

What happens after Leiolai requests a function?

After a Leiolai function request, your client receives the function name and arguments, runs the action, and returns a matching result. Preserve the call ID so the result belongs to the correct request. The conversation then continues with the supplied result.

Function calls and results

Can Messages use client-defined functions?

Yes.

Messages defines tools with input_schema, returns tool_use blocks, and accepts matching tool_result blocks.

Messages tool support

How do I build a workflow that needs both tools and final JSON?

Complete the Leiolai tool conversation first, then send a separate request for the final structured JSON result. Keep the schema focused on fields the next step needs. Check successful completion before parsing and acting on the result.

Check response success and errors