NocAI constructor Null safety
Creates a NocAI client with a simple constructor matching C++ NocLLM.
apiKey: API key for authentication (can be empty for local models).baseUrl: Base URL of the LLM API endpoint.model: Model identifier (e.g., 'gpt-3.5-turbo', 'gemini-1.5-flash').temperature: Optional temperature parameter (0.0 - 2.0).maxTokens: Optional maximum tokens for the response.systemPrompt: Optional system prompt prepended to conversations.
Implementation
NocAI({
required String apiKey,
required String baseUrl,
required String model,
double? temperature,
int? maxTokens,
String? systemPrompt,
http.Client? httpClient,
}) : _config = NocAIConfig(
apiKey: apiKey,
baseUrl: baseUrl,
model: model,
temperature: temperature,
maxTokens: maxTokens,
systemPrompt: systemPrompt,
),
_httpClient = httpClient ?? http.Client(),
_ownsClient = httpClient == null;