Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed host lookup: 'api.openai.com' #149

Closed
apoleo88 opened this issue Dec 31, 2023 · 1 comment
Closed

Failed host lookup: 'api.openai.com' #149

apoleo88 opened this issue Dec 31, 2023 · 1 comment

Comments

@apoleo88
Copy link

Testing on Windows 10.
The function works, a correct answer is returned from Openai, but it keeps throwing this error every time I call the function.

try {
    chatCompletion = await OpenAI.instance.chat.create(

      model: modelName,
      messages: [
          OpenAIChatCompletionChoiceMessageModel(
              content:[
                OpenAIChatCompletionChoiceMessageContentItemModel.text(prompt),
              ],
              role: OpenAIChatMessageRole.user,
          ),
      ]
      maxTokens: maxTokens,
    );
  } catch (e) {
    print("ERROR: $e")  ;
    rethrow;
  }

SocketException: Failed host lookup: 'api.openai.com' (OS Error: Host sconosciuto. , errno = 11001)
OS Error: Host sconosciuto. , errno = 11001

The Catch does not catch anything!

And the function returns a correct answer from Openai!

@anasfik
Copy link
Owner

anasfik commented Feb 21, 2024

This is likely to be related to this issue

@anasfik anasfik closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants