AIService class

Service for interacting with AI language models via HTTP APIs.

This service provides methods to send messages to AI services like OpenAI and receive responses. It supports both single message requests and streaming responses.

Example:

final aiService = AIService();
aiService.apiKey = 'your-api-key';
final response = await aiService.sendMessage('Hello, AI!');

Constructors

AIService.new()
Creates a new AI service instance.

Properties

apiKey String?
API key for authentication with the AI service.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendMessage(String message) Future<String>
Sends a message to the AI service and returns the response.
sendMessageStream(String message) Stream<String>
Sends a message to the AI service and returns a stream of responses.
testConnection() Future<bool>
Tests the connection to the AI service.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited