openai sdk

天问 9aa561e25e Update 'README.md' 2 months ago
README.md 9aa561e25e Update 'README.md' 2 months ago

README.md

dart_openai

openai sdk

Usage

  dart_openai: ^1.9.1
  
  

Reference

类似项目:

  • chat_gpt_sdk

    _openAI = OpenAI.instance.build(
            token: OPENAI_API_KEY,
            baseOption: HttpSetup(receiveTimeout: const Duration(seconds: 5)),
            enableLog: true);
                
    
    final request = ChatCompleteText(
    model: GptTurbo0301ChatModel(),
    messages: messagesHistory,
    maxToken: 200);
    
    final response = await _openAI.onChatCompletion(request: request);
    
    return response!.choices
    .map((choice) => ChatMessage(
        user: ChatUser(id: '2'),
        createdAt: DateTime.now(),
        text: choice.message!.content))
    .toList();
    }