Archive

Archive for April, 2023

#ChatGPT #API is not blocked in Italy, loophole by design?

It was big news that Italy would be the first country in the EU to block Chat-GPT, and you can see what happens if you use a VPN and set it to an Italian IP, then try to access the service, it gives a warning “ChatGPT disabled for users in Italy”.

But, I was thinking, is the API also blocked, and the answer is no, it’s not. Which means that tools built on ChatGPT can still continue to operate. Quite a glaring loop-hole (One I’m happy about, but shows that somebody accidentally, or purposefully slipped up).

Above is a screenshot showing a response from the ChatGPT API, and the same “blocked screen”, while on an Italian VPN.

Below is the code I used, using the GPT3 Nuget package from Betalgo.

 // Install-Package Betalgo.OpenAI.GPT3
var gpt3 = new OpenAIService(new OpenAiOptions
{
	ApiKey = strSecretKey
});
var question = Console.ReadLine();
var completionResult = await gpt3.Completions.CreateCompletion(new CompletionCreateRequest()
{
	Prompt = question,
	Model = Models.TextDavinciV2,
	Temperature = 0.5F,
	MaxTokens = 100
});
if (completionResult.Successful)
{
	foreach (var choice in completionResult.Choices)
	{
		Console.WriteLine(choice.Text);
	}
}
else
{
	if (completionResult.Error == null)
	{
		throw new Exception("Unknown Error");
	}
	Console.WriteLine($"{completionResult.Error.Code}: {completionResult.Error.Message}");
}
Categories: Uncategorized