BaseHttpProvider class abstract
Base class for HTTP-based LLM providers
This class provides common functionality for providers that use HTTP APIs, reducing code duplication and ensuring consistent error handling.
- Implemented types
Constructors
- BaseHttpProvider.new(Dio _dio, String loggerName)
Properties
- chatEndpoint → String
-
Get the chat endpoint path
no setter
- dio → Dio
-
Protected access to Dio instance for subclasses
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger → Logger
-
Protected access to Logger instance for subclasses
no setter
- providerName → String
-
Provider-specific name for logging and error messages
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildRequestBody(
List< ChatMessage> messages, List<Tool> ? tools, bool stream) → Map<String, dynamic> - Build the request body for chat requests
-
chat(
List< ChatMessage> messages) → Future<ChatResponse> -
Sends a chat request to the provider with a sequence of messages.
inherited
-
chatStream(
List< ChatMessage> messages, {List<Tool> ? tools}) → Stream<ChatStreamEvent> -
Sends a streaming chat request to the provider
override
-
chatWithTools(
List< ChatMessage> messages, List<Tool> ? tools) → Future<ChatResponse> -
Sends a chat request to the provider with a sequence of messages and tools.
override
-
handleDioError(
DioException e) → LLMError - Handle Dio exceptions with consistent error mapping
-
memoryContents(
) → Future< List< ChatMessage> ?> -
Get current memory contents if provider supports memory
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseResponse(
Map< String, dynamic> responseData) → ChatResponse - Parse the response into a ChatResponse
-
parseStreamEvents(
String chunk) → List< ChatStreamEvent> - Parse streaming events
-
summarizeHistory(
List< ChatMessage> messages) → Future<String> -
Summarizes a conversation history into a concise 2-3 sentence summary
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateApiKey(
String? apiKey) → void - Validate API key before making requests
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited