chatWithTools method
Future<ChatResponse>
chatWithTools(
- List<
ChatMessage> messages, - List<
Tool> ? tools, { - CancelToken? cancelToken,
override
Sends a chat request to the provider with a sequence of messages and tools.
messages
- The conversation history as a list of chat messages
tools
- Optional list of tools to use in the chat
cancelToken
- Optional token to cancel the request
Returns the provider's response or throws an LLMError
Implementation
@override
Future<ChatResponse> chatWithTools(
List<ChatMessage> messages,
List<Tool>? tools, {
CancelToken? cancelToken,
}) async {
final requestBody = _buildRequestBody(messages, tools, false);
final responseData = await client.postJson(
chatEndpoint,
requestBody,
cancelToken: cancelToken,
);
return _parseResponse(responseData);
}