Does Leiolai support function calling and tool use?
Yes. Leiolai supports client-defined functions through Chat Completions, Responses, and Messages. Your application supplies the tool definitions, receives the requested function and arguments, runs the function, and sends the result back to continue the conversation.
Read the Leiolai API reference
What does the application do during a tool call?
Define a function with a clear description and argument schema. When Leiolai requests the function, your application decides whether to run the action, performs the work, and returns the result. The conversation can then continue using that result.
How are tools returned in Chat Completions?
Keep the Leiolai assistant message containing tool_calls. Run each requested function in your application, then add one role: tool message per result with the matching tool_call_id. Send that updated history in the next request.
Use Chat Completions historyHow are tools returned in Responses?
Leiolai Responses returns function_call output items. Send matching function_call_output items with call_id and the function result when continuing. Include the prior output items needed for the conversation in the next input.
Continue a Responses conversationHow are tools returned in Messages?
Messages tools use input_schema. Leiolai can return a tool_use content block; your application returns a tool_result matching the tool_use_id in a user message. Keep the original tool_use block in the conversation history.
Messages tool blocksWhat makes a function definition clear?
Give each function a name, action description, and argument schema. For a calendar lookup, define the date range and timezone. For a document lookup, define the document identifier and query. Mark necessary arguments as required so Leiolai can request the information your function needs.
Can I receive several independent function calls?
Leiolai Chat Completions and Responses support parallel_tool_calls. Keep each call’s ID with its result, even if the functions finish in a different order. Let your application’s own action rules decide which independent calls can run together.
How do I handle arguments delivered in a stream?
Collect the fragments for the same call before parsing the JSON and executing the function. Leiolai Chat Completions, Responses, and Messages use different argument events. Use the endpoint’s call identifier to keep concurrent arguments from mixing.
Parse streamed function argumentsCan I ask for a JSON schema and tools in the same request?
No. Complete the Leiolai function round trip, then request final JSON separately with response_format in Chat Completions or text.format in Responses.
Return structured JSONWhich endpoint should a text Completions client use for tools?
Move tool work to Leiolai Chat Completions, Responses, or Messages. The text Completions endpoint accepts one string prompt and has no tool-definition or tool-result fields.