skip to Main Content

I upgraded my package chat_gpt_sdk to 2.0.4 and the flutter sdk to the latest version but now i get this error The argument type ‘int’ can’t be assigned to the parameter type ‘Duration’. I need to be on this version to have access to the chatgpt turbo model. can anyone help me with this

      return 'Count: $count';
    }).take(10);

    openAI = OpenAI.instance.build(
      token: "$Apikey",
      baseOption: HttpSetup(
        receiveTimeout: 30000,
        connectTimeout: 5000,
        sendTimeout: 5000,

      ),
      isLogger: true,
    );
  }

2

Answers


  1. You need to provide receiveTimeout , connectTimeout and sendTimeout in Duration

    baseOption: HttpSetup(
      receiveTimeout: Duration(milliseconds: 30000),
      connectTimeout: Duration(seconds: 5),
      sendTimeout: Duration(seconds: 5),
    ),
    
    Login or Signup to reply.
  2. Those timeout parameters take Duration objects

    openAI = OpenAI.instance.build(
      token: "$Apikey",
      baseOption: HttpSetup(
        receiveTimeout: const Duration(milliseconds: 300000),
        connectTimeout: const Duration(milliseconds: 5000),
        sendTimeout: const Duration(milliseconds: 5000),
    
      ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search