iryna-kondr / scikit-llm

Seamlessly integrate LLMs into scikit-learn.
https://beastbyte.ai/
MIT License
3.29k stars 269 forks source link

APIConnectionError #80

Closed FlavioLaManna closed 9 months ago

FlavioLaManna commented 10 months ago

I am running this code:

from skllm.config import SKLLMConfig
SKLLMConfig.set_openai_key("my key")
SKLLMConfig.set_azure_api_base("my url")
from skllm import ZeroShotGPTClassifier
from skllm.datasets import get_classification_dataset

X, y = get_classification_dataset()

clf = ZeroShotGPTClassifier(openai_model="azure::gpt-35-turbo")
clf.fit(X, y)
labels = clf.predict(X)

And i get this error:

1%|          | 1/109 [00:27<49:23, 27.44s/it]
Could not obtain the completion after 3 retries: `APIConnectionError :: Error communicating with OpenAI: HTTPSConnectionPool(host='gen-ai-sweden.openai.azure.com', port=443): Max retries exceeded with url: //openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-05-15 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000018D602595D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))`
None
Could not extract the label from the completion: 'NoneType' object is not subscriptable

I am using openai version 0.28.0

OKUA1 commented 9 months ago

@FlavioLaManna do you still have the same issue with the latest Scikit-LLM release ? I could not reproduce the issue.

FlavioLaManna commented 9 months ago

No thanks, it was a problem with my internet connection. Changing it solved the problem