copyWith method

XAIProvider copyWith({
  1. String? apiKey,
  2. String? baseUrl,
  3. String? model,
  4. int? maxTokens,
  5. double? temperature,
  6. String? systemPrompt,
  7. Duration? timeout,
  8. bool? stream,
  9. double? topP,
  10. int? topK,
  11. List<Tool>? tools,
  12. ToolChoice? toolChoice,
  13. StructuredOutputFormat? jsonSchema,
  14. String? embeddingEncodingFormat,
  15. int? embeddingDimensions,
  16. SearchParameters? searchParameters,
  17. bool? liveSearch,
})

Create a new provider with updated configuration

Implementation

XAIProvider copyWith({
  String? apiKey,
  String? baseUrl,
  String? model,
  int? maxTokens,
  double? temperature,
  String? systemPrompt,
  Duration? timeout,
  bool? stream,
  double? topP,
  int? topK,
  List<Tool>? tools,
  ToolChoice? toolChoice,
  StructuredOutputFormat? jsonSchema,
  String? embeddingEncodingFormat,
  int? embeddingDimensions,
  SearchParameters? searchParameters,
  bool? liveSearch,
}) {
  final newConfig = config.copyWith(
    apiKey: apiKey,
    baseUrl: baseUrl,
    model: model,
    maxTokens: maxTokens,
    temperature: temperature,
    systemPrompt: systemPrompt,
    timeout: timeout,
    topP: topP,
    topK: topK,
    tools: tools,
    toolChoice: toolChoice,
    jsonSchema: jsonSchema,
    embeddingEncodingFormat: embeddingEncodingFormat,
    embeddingDimensions: embeddingDimensions,
    searchParameters: searchParameters,
    liveSearch: liveSearch,
  );

  return XAIProvider(newConfig);
}